5 #include <sqlite3-binding.h>
16 // ColumnTypeDatabaseTypeName implement RowsColumnTypeDatabaseTypeName.
17 func (rc *SQLiteRows) ColumnTypeDatabaseTypeName(i int) string {
18 return C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i)))
22 func (rc *SQLiteRows) ColumnTypeLength(index int) (length int64, ok bool) {
26 func (rc *SQLiteRows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool) {
31 // ColumnTypeNullable implement RowsColumnTypeNullable.
32 func (rc *SQLiteRows) ColumnTypeNullable(i int) (nullable, ok bool) {
36 // ColumnTypeScanType implement RowsColumnTypeScanType.
37 func (rc *SQLiteRows) ColumnTypeScanType(i int) reflect.Type {
38 switch C.sqlite3_column_type(rc.s.s, C.int(i)) {
39 case C.SQLITE_INTEGER:
40 switch C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i))) {
41 case "timestamp", "datetime", "date":
42 return reflect.TypeOf(time.Time{})
44 return reflect.TypeOf(false)
46 return reflect.TypeOf(int64(0))
48 return reflect.TypeOf(float64(0))
50 return reflect.SliceOf(reflect.TypeOf(byte(0)))
52 return reflect.TypeOf(nil)
54 return reflect.TypeOf("")
56 return reflect.SliceOf(reflect.TypeOf(byte(0)))