Exemple #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
}
Exemple #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
}
Exemple #3
0
func (h *Statement) ColumnInt(column int) int {
	rv := C.sqlite3_column_int(h.cptr, C.int(column))
	return int(rv)
}
Exemple #4
0
func (self *sqlStatement) sqlColumnInt(col int) int {
	return int(C.sqlite3_column_int(self.handle, C.int(col)))
}