Permalink
Browse files

Documentation fixed.

  • Loading branch information...
1 parent 8714814 commit a61577646845a5d84047bdb4c51d2ab118a764aa @marpie marpie committed Feb 1, 2012
Showing with 22 additions and 19 deletions.
  1. +1 −1 backup.go
  2. +16 −15 database.go
  3. +1 −1 query_parameter.go
  4. +1 −0 result_column.go
  5. +1 −0 sqlite3.go
  6. +2 −2 statement.go
View
@@ -5,7 +5,7 @@ import "C"
// Backup implements the SQLite Online Backup API.
//
-// The backup API copies the content of one database into another. It is
+// The backup API copies the content of one database to another. It is
// useful either for creating backups of databases or for copying in-memory
// databases to or from persistent files.
type Backup struct {
View
@@ -84,6 +84,7 @@ var errText = map[Errno]string{
SAVEPOINT: "invalid or unknown savepoint identifier",
}
+// Database implements high level view of the underlying database.
type Database struct {
handle *C.sqlite3
Filename string
@@ -135,21 +136,21 @@ func (db *Database) Open(flags ...int) (e error) {
return
}
-// Close shuts down the database engine for this database.
+// Close is used to close the database.
func (db *Database) Close() {
C.sqlite3_close(db.handle)
db.handle = nil
}
-// LastInsertRowID returns the id of the most recent successful INSERT.
+// LastInsertRowID returns the id of the most recently successful INSERT.
//
// Each entry in an SQLite table has a unique 64-bit signed integer key
// called the "rowid". The rowid is always available as an undeclared column
// named ROWID, OID, or _ROWID_ as long as those names are not also used by
// explicitly declared columns. If the table has a column of type
// INTEGER PRIMARY KEY then that column is another alias for the rowid.
//
-// This routine returns the rowid of the most recent successful INSERT into
+// This routine returns the rowid of the most recently successful INSERT into
// the database from the database connection in the first argument. As of
// SQLite version 3.7.7, this routines records the last insert rowid of both
// ordinary tables and virtual tables. If no successful INSERTs have ever
@@ -180,7 +181,7 @@ func (db *Database) TotalChanges() int {
return int(C.sqlite3_total_changes(db.handle))
}
-// Error returns the numeric result code for the most recent failed database
+// Error returns the numeric result code for the most recently failed database
// call.
func (db *Database) Error() error {
return Errno(C.sqlite3_errcode(db.handle))
@@ -265,6 +266,16 @@ func (db *Database) Mark(id interface{}) (e error) {
// MergeSteps can be seen as the equivalent of COMMIT for a Mark command.
//
+func (db *Database) MergeSteps(id interface{}) (e error) {
+ if st, err := db.Prepare("RELEASE SAVEPOINT ?", savepointID(id)); err == nil {
+ _, e = st.All()
+ } else {
+ e = err
+ }
+ return
+}
+
+// Release rolls back all transactions to the specified SAVEPOINT (Mark).
// More specificly ...
// - Some people view RELEASE as the equivalent of COMMIT for a SAVEPOINT.
// This is an acceptable point of view as long as one remembers that the
@@ -280,16 +291,6 @@ func (db *Database) Mark(id interface{}) (e error) {
// ROLLBACK TO command rewinds the timeline back to a point just after
// the named mark, and the RELEASE command erases marks from the timeline
// without actually making any changes to the database.
-func (db *Database) MergeSteps(id interface{}) (e error) {
- if st, err := db.Prepare("RELEASE SAVEPOINT ?", savepointID(id)); err == nil {
- _, e = st.All()
- } else {
- e = err
- }
- return
-}
-
-// Release rolls back all transactions to the specified SAVEPOINT (Mark).
func (db *Database) Release(id interface{}) (e error) {
if st, err := db.Prepare("ROLLBACK TRANSACTION TO SAVEPOINT ?", savepointID(id)); err == nil {
_, e = st.All()
@@ -333,7 +334,7 @@ type BackupParameters struct {
Interval time.Duration
}
-// Backup creates a copy (backup) of the current database to the Target file
+// Backup creates a copy (backup) of the current database to the target file
// specified in BackupParameters.
func (db *Database) Backup(p BackupParameters) (r Reporter, e error) {
if target, e := Open(p.Target); e == nil {
View
@@ -25,7 +25,7 @@ func (p QueryParameter) bind_blob(s *Statement, v []byte) error {
// Bind replaces the literals placed in the SQL statement with the actual
// values supplied to the function.
//
-// The following templates may be replaced by the parameters:
+// The following templates may be replaced by the values:
// - ?
// - ?NNN
// - :VVV
View
@@ -17,6 +17,7 @@ const(
)
+// ResultColumn implements the high level view of the SQLite result column.
type ResultColumn int
func (c ResultColumn) make_buffer(s *Statement, addr interface{}) (buffer string) {
View
@@ -1,3 +1,4 @@
+// Package sqlite3 implements a Go interface to the SQLite database.
package sqlite3
// #cgo LDFLAGS: -lsqlite3
View
@@ -41,7 +41,7 @@ func (s *Statement) Column(column int) (value interface{}) {
return ResultColumn(column).Value(s)
}
-// Row returns the all values of the row.
+// Row returns all values of the row.
func (s *Statement) Row() (values []interface{}) {
for i := 0; i < s.Columns(); i++ {
values = append(values, s.Column(i))
@@ -86,7 +86,7 @@ func (s *Statement) Finalize() error {
}
// Step must be called one or more times to evaluate the statement after the
-// prepared statement has been prepared using `Prepare`.
+// prepared statement has been prepared.
func (s *Statement) Step(f... func(*Statement, ...interface{})) (e error) {
r := Errno(C.sqlite3_step(s.cptr))
switch r {

0 comments on commit a615776

Please sign in to comment.