Ejemplo n.º 1
0
// ScanBool scans result value from a query.
// The leftmost column/index is number 0.
// Returns true when column is null.
// (See sqlite3_column_int: http://sqlite.org/c3ref/column_blob.html)
func (s *Stmt) ScanBool(index int) (value bool, isNull bool, err error) {
	ctype := s.ColumnType(index)
	if ctype == Null {
		isNull = true
	} else {
		if CheckTypeMismatch {
			err = s.checkTypeMismatch(ctype, Integer)
		}
		value = C.sqlite3_column_int(s.stmt, C.int(index)) != 0
	}
	return
}
Ejemplo n.º 2
0
// ScanInt scans result value from a query.
// The leftmost column/index is number 0.
// Returns true when column is null.
// (See sqlite3_column_int: http://sqlite.org/c3ref/column_blob.html)
// TODO Factorize with ScanByte, ScanBool
func (s *Stmt) ScanInt(index int) (value int, isNull bool, err error) {
	ctype := s.ColumnType(index)
	if ctype == Null {
		isNull = true
	} else {
		if CheckTypeMismatch {
			err = s.checkTypeMismatch(ctype, Integer)
		}
		if i64 {
			value = int(C.sqlite3_column_int64(s.stmt, C.int(index)))
		} else {
			value = int(C.sqlite3_column_int(s.stmt, C.int(index)))
		}
	}
	return
}
Ejemplo n.º 3
0
func (h *Statement) ColumnInt(column int) int {
	rv := C.sqlite3_column_int(h.cptr, C.int(column))
	return int(rv)
}
Ejemplo n.º 4
0
Archivo: low.go Proyecto: newblue/sql
func (self *sqlStatement) sqlColumnInt(col int) int {
	return int(C.sqlite3_column_int(self.handle, C.int(col)))
}