00001 using System;
00002 using System.Data;
00003
00004 using SQLiteCSLib.Inner;
00005
00006 namespace SQLiteCSLib
00007 {
00011 public class SQLiteParameter : IDbDataParameter, IDataParameter, IComparable
00012 {
00016 public SQLiteParameter()
00017 {
00018 }
00019
00023 public byte Precision
00024 {
00025 get
00026 {
00027 return 0;
00028 }
00029 set
00030 {
00031 }
00032 }
00033
00037 public byte Scale
00038 {
00039 get
00040 {
00041 return 0;
00042 }
00043 set
00044 {
00045 }
00046 }
00047
00051 public int Size
00052 {
00053 get
00054 {
00055 return 0;
00056 }
00057 set
00058 {
00059 }
00060 }
00061
00065 protected ParameterDirection m_dir = ParameterDirection.InputOutput;
00066
00070 public ParameterDirection Direction
00071 {
00072 get
00073 {
00074 return m_dir;
00075 }
00076 set
00077 {
00078 m_dir = value;
00079 }
00080 }
00081
00085 protected DbType m_type = DbType.Object;
00086
00090 public DbType DbType
00091 {
00092 get
00093 {
00094 return m_type;
00095 }
00096 set
00097 {
00098 m_type = value;
00099 }
00100 }
00101
00105 protected object m_value = null;
00106
00110 public object Value
00111 {
00112 get
00113 {
00114 return m_value;
00115 }
00116 set
00117 {
00118 m_value = value;
00119
00120
00121 if( m_value is string )
00122 {
00123 DbType = DbType.String;
00124 }
00125 else
00126 if( m_value is Int64 )
00127 {
00128 DbType = DbType.Int64;
00129 }
00130 else
00131 if( m_value is Int32 )
00132 {
00133 DbType = DbType.Int32;
00134 }
00135 else
00136 if( m_value is Int16 )
00137 {
00138 DbType = DbType.Int16;
00139 }
00140 else
00141 if( m_value is Boolean )
00142 {
00143 DbType = DbType.Boolean;
00144 }
00145 else
00146 if( m_value is double || m_value is float )
00147 {
00148 DbType = DbType.Double;
00149 }
00150 else
00151 if( m_value is decimal )
00152 {
00153 DbType = DbType.Decimal;
00154 }
00155 else
00156 if( m_value is Byte[] )
00157 {
00158 DbType = DbType.Binary;
00159 }
00160 else
00161 if( m_value == null )
00162 {
00163 DbType = DbType.Object;
00164 }
00165 else
00166 throw new DataException( string.Format("未サポートの型です {0}",value.GetType().ToString()), null );
00167 }
00168 }
00169
00173 protected bool m_isnull = true;
00174
00179 public bool IsNullable
00180 {
00181 get
00182 {
00183 return m_isnull;
00184 }
00185 }
00186
00190 protected DataRowVersion m_datarowver = DataRowVersion.Current;
00191
00195 public DataRowVersion SourceVersion
00196 {
00197 get
00198 {
00199 return m_datarowver;
00200 }
00201 set
00202 {
00203 m_datarowver = value;
00204 }
00205 }
00206
00210 protected string m_paraname = "";
00211
00215 public string ParameterName
00216 {
00217 get
00218 {
00219 return m_paraname;
00220 }
00221 set
00222 {
00223 m_paraname = value;
00224 }
00225 }
00226
00230 protected string m_column = "";
00231
00235 public string SourceColumn
00236 {
00237 get
00238 {
00239 return m_column;
00240 }
00241 set
00242 {
00243 m_column = value;
00244 }
00245 }
00246
00250 protected int m_order = 0;
00251
00255 public int Order
00256 {
00257 get
00258 {
00259 return m_order;
00260 }
00261 set
00262 {
00263 m_order = value;
00264 }
00265 }
00266
00272 public int CompareTo(object obj)
00273 {
00274 SQLiteParameter target = obj as SQLiteParameter;
00275
00276 if( m_order < target.m_order )
00277 return -1;
00278
00279 if( m_order > target.m_order )
00280 return 1;
00281
00282 return 0;
00283 }
00284 }
00285 }