Commit b45166a1 authored by gwenn's avatar gwenn

Add binding to sqlite3_stmt_readonly.

parent 62d699a6
...@@ -20,11 +20,13 @@ Conn#LastInsertRowid ...@@ -20,11 +20,13 @@ Conn#LastInsertRowid
Conn#Interrupt Conn#Interrupt
Conn#Begin/BeginTransaction(type)/Commit/Rollback Conn#Begin/BeginTransaction(type)/Commit/Rollback
Conn#GetAutocommit Conn#GetAutocommit
Conn#EnableLoadExtension/LoadExtension
Stmt#ExecUpdate Stmt#ExecUpdate
Stmt#BindParameterCount/BindParameterIndex/BindParameterName Stmt#BindParameterCount/BindParameterIndex/BindParameterName
Stmt#ClearBindings Stmt#ClearBindings
Stmt#ColumnCount/ColumnIndex(name)/ColumnName(index)/ColumnType Stmt#ColumnCount/ColumnIndex(name)/ColumnName(index)/ColumnType
Stmt#ReadOnly
Blob: Blob:
ZeroBlobLength ZeroBlobLength
......
...@@ -719,6 +719,11 @@ func (c *Conn) Close() os.Error { ...@@ -719,6 +719,11 @@ func (c *Conn) Close() os.Error {
return nil 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 // Calls http://sqlite.org/c3ref/enable_load_extension.html
func (c *Conn) EnableLoadExtension(b bool) { func (c *Conn) EnableLoadExtension(b bool) {
C.sqlite3_enable_load_extension(c.db, btocint(b)) C.sqlite3_enable_load_extension(c.db, btocint(b))
......
...@@ -177,6 +177,10 @@ func TestInsertWithStatement(t *testing.T) { ...@@ -177,6 +177,10 @@ func TestInsertWithStatement(t *testing.T) {
} }
defer s.Finalize() defer s.Finalize()
if s.ReadOnly() {
t.Errorf("update statement is not readonly")
}
paramCount := s.BindParameterCount() paramCount := s.BindParameterCount()
if paramCount != 3 { if paramCount != 3 {
t.Errorf("bind parameter count error: %d <> 3", paramCount) t.Errorf("bind parameter count error: %d <> 3", paramCount)
...@@ -207,6 +211,9 @@ func TestInsertWithStatement(t *testing.T) { ...@@ -207,6 +211,9 @@ func TestInsertWithStatement(t *testing.T) {
cs, _ := db.Prepare("SELECT COUNT(*) FROM test") cs, _ := db.Prepare("SELECT COUNT(*) FROM test")
defer cs.Finalize() defer cs.Finalize()
if !cs.ReadOnly() {
t.Errorf("update statement is not readonly")
}
if ok := Must(cs.Next()); !ok { if ok := Must(cs.Next()); !ok {
t.Fatal("no result for count") 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