Beispiel #1
0
 object ReadCol(IntPtr stmt, int index, SQLite3.ColType type, Type clrType)
 {
     if (type == SQLite3.ColType.Null)
     {
         return(null);
     }
     else
     {
         if (clrType == typeof(String))
         {
             return(SQLite3.ColumnString(stmt, index));
         }
         else if (clrType == typeof(Int32))
         {
             return((int)SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(Boolean))
         {
             return(SQLite3.ColumnInt(stmt, index) == 1);
         }
         else if (clrType == typeof(double))
         {
             return(SQLite3.ColumnDouble(stmt, index));
         }
         else if (clrType == typeof(float))
         {
             return((float)SQLite3.ColumnDouble(stmt, index));
         }
         else if (clrType == typeof(DateTime))
         {
             var text = SQLite3.ColumnString(stmt, index);
             return(DateTime.Parse(text));
         }
         else if (clrType.IsEnum)
         {
             return(SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(Int64))
         {
             return(SQLite3.ColumnInt64(stmt, index));
         }
         else if (clrType == typeof(UInt32))
         {
             return((uint)SQLite3.ColumnInt64(stmt, index));
         }
         else if (clrType == typeof(decimal))
         {
             return((decimal)SQLite3.ColumnDouble(stmt, index));
         }
         else if (clrType == typeof(Byte))
         {
             return((byte)SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(UInt16))
         {
             return((ushort)SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(Int16))
         {
             return((short)SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(sbyte))
         {
             return((sbyte)SQLite3.ColumnInt(stmt, index));
         }
         else if (clrType == typeof(byte[]))
         {
             return(SQLite3.ColumnByteArray(stmt, index));
         }
         else
         {
             throw new NotSupportedException("Don't know how to read " + clrType);
         }
     }
 }
Beispiel #2
0
 void Finalize(IntPtr stmt)
 {
     SQLite3.Finalize(stmt);
 }