Commit b45166a1 authored by gwenn's avatar gwenn

Add binding to sqlite3_stmt_readonly.

parent 62d699a6
......@@ -20,11 +20,13 @@ Conn#LastInsertRowid
Conn#Interrupt
Conn#Begin/BeginTransaction(type)/Commit/Rollback
Conn#GetAutocommit
Conn#EnableLoadExtension/LoadExtension
Stmt#ExecUpdate
Stmt#BindParameterCount/BindParameterIndex/BindParameterName
Stmt#ClearBindings
Stmt#ColumnCount/ColumnIndex(name)/ColumnName(index)/ColumnType
Stmt#ReadOnly
Blob:
ZeroBlobLength
......
......@@ -719,6 +719,11 @@ func (c *Conn) Close() os.Error {
return nil
}
// Calls http://sqlite.org/c3ref/stmt_readonly.html
func (s *Stmt) ReadOnly() bool {
return C.sqlite3_stmt_readonly(s.stmt) == 1;
}
// Calls http://sqlite.org/c3ref/enable_load_extension.html
func (c *Conn) EnableLoadExtension(b bool) {
C.sqlite3_enable_load_extension(c.db, btocint(b))
......
......@@ -177,6 +177,10 @@ func TestInsertWithStatement(t *testing.T) {
}
defer s.Finalize()
if s.ReadOnly() {
t.Errorf("update statement is not readonly")
}
paramCount := s.BindParameterCount()
if paramCount != 3 {
t.Errorf("bind parameter count error: %d <> 3", paramCount)
......@@ -207,6 +211,9 @@ func TestInsertWithStatement(t *testing.T) {
cs, _ := db.Prepare("SELECT COUNT(*) FROM test")
defer cs.Finalize()
if !cs.ReadOnly() {
t.Errorf("update statement is not readonly")
}
if ok := Must(cs.Next()); !ok {
t.Fatal("no result for count")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment