Permalink
Browse files

Better documentation.

Close() now invalidates the Statement.
  • Loading branch information...
1 parent 2eb5498 commit c178ef40d1c2c8292c15115dd745af05271b30ff @phf committed Dec 13, 2009
Showing with 11 additions and 3 deletions.
  1. +11 −3 statement.go
View
@@ -6,25 +6,33 @@ package sqlite3
import "os";
-// SQLite statements
+// SQLite prepared statements.
type Statement struct {
handle *sqlStatement;
connection *Connection;
}
+// Original query language string.
func (self *Statement) String() string {
- sql := self.handle.sqlSql();
- return sql;
+ return self.handle.sqlSql();
}
+// Free all associated resources. After a call to
+// Close() the statement can not be used anymore.
+// If results from the statement are still being
+// processed, bad things will happen.
func (self *Statement) Close() (error os.Error) {
rc := self.handle.sqlFinalize();
if rc != StatusOk {
error = self.connection.error()
}
+ self.handle = nil;
+ self.connection = nil;
return;
}
+// Make the statement ready for re-binding parameters
+// and re-execution.
func (self *Statement) clear() (error os.Error) {
rc := self.handle.sqlReset();
if rc == StatusOk {

0 comments on commit c178ef4

Please sign in to comment.