object ReadCol(IntPtr stmt, int index, Type clrType) { var type = SQLite3.ColumnType(stmt, index); if (type == SQLite3.ColType.Null) { return(null); } else { if (clrType == typeof(Byte) || clrType == typeof(UInt16) || clrType == typeof(SByte) || clrType == typeof(Int16) || clrType == typeof(Int32)) { return(Convert.ChangeType(SQLite3.ColumnInt(stmt, index), clrType)); } else if (clrType == typeof(UInt32) || clrType == typeof(Int64)) { return(Convert.ChangeType(SQLite3.ColumnInt64(stmt, index), clrType)); } else if (clrType == typeof(Single) || clrType == typeof(Double) || clrType == typeof(Decimal)) { return(Convert.ChangeType(SQLite3.ColumnDouble(stmt, index), clrType)); } else if (clrType == typeof(String)) { return(Convert.ChangeType(SQLite3.ColumnText(stmt, index), clrType)); } else if (clrType == typeof(DateTime)) { return(Convert.ChangeType(SQLite3.ColumnText(stmt, index), clrType)); } else { throw new NotSupportedException("Don't know how to read " + clrType); } } }