Module Name:    src
Committed By:   mbalmer
Date:           Sun Oct 27 12:47:54 UTC 2013

Modified Files:
        src/distrib/sets/lists/man: mi
        src/share/man/man3lua: Makefile
Added Files:
        src/share/man/man3lua: sqlite.3lua

Log Message:
add a sqlite(3lua) manual page


To generate a diff of this commit:
cvs rdiff -u -r1.1444 -r1.1445 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.2 -r1.3 src/share/man/man3lua/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man3lua/sqlite.3lua

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1444 src/distrib/sets/lists/man/mi:1.1445
--- src/distrib/sets/lists/man/mi:1.1444	Sun Oct 27 09:27:23 2013
+++ src/distrib/sets/lists/man/mi	Sun Oct 27 12:47:54 2013
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1444 2013/10/27 09:27:23 apb Exp $
+# $NetBSD: mi,v 1.1445 2013/10/27 12:47:54 mbalmer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -648,6 +648,7 @@
 ./usr/share/man/cat3lua/gpio.unset.0		man-sys-catman		.cat
 ./usr/share/man/cat3lua/gpio.write.0		man-sys-catman		.cat
 ./usr/share/man/cat3lua/intro.0			man-sys-catman		.cat
+./usr/share/man/cat3lua/sqlite.0		man-sys-catman		.cat
 ./usr/share/man/cat4/aac.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ac97.0			man-sys-catman		.cat
 ./usr/share/man/cat4/acardide.0			man-sys-catman		.cat
@@ -3691,6 +3692,7 @@
 ./usr/share/man/html3lua/gpio.unset.html	man-sys-htmlman		html
 ./usr/share/man/html3lua/gpio.write.html	man-sys-htmlman		html
 ./usr/share/man/html3lua/intro.html		man-sys-htmlman		html
+./usr/share/man/html3lua/sqlite.html		man-sys-htmlman		html
 ./usr/share/man/html4/aac.html			man-sys-htmlman		html
 ./usr/share/man/html4/ac97.html			man-sys-htmlman		html
 ./usr/share/man/html4/acardide.html		man-sys-htmlman		html
@@ -6408,6 +6410,7 @@
 ./usr/share/man/man3lua/gpio.unset.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/gpio.write.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/intro.3lua		man-sys-man		.man
+./usr/share/man/man3lua/sqlite.3lua		man-sys-man		.man
 ./usr/share/man/man4/aac.4			man-sys-man		.man
 ./usr/share/man/man4/ac97.4			man-sys-man		.man
 ./usr/share/man/man4/acardide.4			man-sys-man		.man

Index: src/share/man/man3lua/Makefile
diff -u src/share/man/man3lua/Makefile:1.2 src/share/man/man3lua/Makefile:1.3
--- src/share/man/man3lua/Makefile:1.2	Sat Oct 26 10:48:19 2013
+++ src/share/man/man3lua/Makefile	Sun Oct 27 12:47:54 2013
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.2 2013/10/26 10:48:19 mbalmer Exp $
+#	$NetBSD: Makefile,v 1.3 2013/10/27 12:47:54 mbalmer Exp $
 
-MAN=	gpio.3lua intro.3lua
+MAN=	gpio.3lua intro.3lua sqlite.3lua
 
 MLINKS+=gpio.3lua gpio.open.3lua \
 	gpio.3lua gpio.info.3lua \

Added files:

Index: src/share/man/man3lua/sqlite.3lua
diff -u /dev/null src/share/man/man3lua/sqlite.3lua:1.1
--- /dev/null	Sun Oct 27 12:47:54 2013
+++ src/share/man/man3lua/sqlite.3lua	Sun Oct 27 12:47:54 2013
@@ -0,0 +1,323 @@
+.\"	$NetBSD: sqlite.3lua,v 1.1 2013/10/27 12:47:54 mbalmer Exp $
+.\"
+.\" Copyright (c) 2013 Marc Balmer <mbal...@netbsd.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"
+.Dd October 28, 2013
+.Dt SQLITE 3lua
+.Os
+.Sh NAME
+.Nm sqlite
+.Nd access
+SQLite3 files from Lua
+.Sh SYNOPSIS
+.Cd "local sqlite = require 'sqlite'"
+.Pp
+.Bl -tag -width XXXX -compact
+.\"
+.\" GENERAL FUNCTIONS
+.\"
+.It Dv err = sqlite.initialize()
+.It Dv sqlite.shutdown()
+.It Dv db, err = sqlite.open(file [, flags])
+.It Dv version = sqlite.libversion()
+.It Dv version = sqlite.libversion_number()
+.It Dv id = sqlite.sourceid()
+.\"
+.\" DATABASE FUNCTIONS
+.\"
+.Pp
+.It Dv err = sqlite.close(db)
+.It Dv stmt, err = sqlite.prepare(db, sql)
+.It Dv err = sqlite.exec(db, sql)
+.It Dv err = sqlite.errcode(db)
+.It Dv msg = sqlite.errmsg(db)
+.It Dv res = sqlite.get_autocommit(db)
+.It Dv res = sqlite.changes(db)
+.\"
+.\" STATEMENT FUNCTIONS
+.\"
+.Pp
+.It Dv err = sqlite.bind(stmt, pidx, value)
+.It Dv count = sqlite.bind_parameter_count(stmt)
+.It Dv pidx = sqlite.bind_parameter_index(stmt, name)
+.It Dv name = sqlite.bind_parameter_name(stmt, pidx)
+.It Dv err = sqlite.step(stmt)
+.It Dv value = sqlite.column(stmt, cidx)
+.It Dv sqlite.reset(stmt)
+.It Dv sqlite.clear_bindings(stmt)
+.It Dv sqlite.finalize(stmt)
+.It Dv name = sqlite.column_name(stmt, cidx)
+.It Dv count = sqlite.column_count(stmt)
+.El
+.Sh DESCRIPTION
+The
+.Nm
+Lua binding provides access to SQLite3 files.
+.Pp
+.Sh GENERAL FUNCTIONS
+.Bl -tag -width XXXX -compact
+.It Dv err = sqlite.initialize()
+Initialize the SQLite3 library.
+Workstation applications using SQLite normally do not need to invoke this
+function.
+.Pp
+.It Dv sqlite.shutdown()
+Deallocate any resources that were allocated by sqlite.initialize().
+Workstation applications using SQLite normally do not need to invoke this
+function.
+.Pp
+.It Dv db, err = sqlite.open(file [, flags])
+Open a database, optionally passing flags.
+When called without flags, the database will be opened for reading and
+writing and it will be created if it does not yet exist.
+The following flags are defined:
+.Pp
+.Bl -tag -width XXXX -compact
+.It Dv sqlite.OPEN_READONLY
+The database is opened in read-only mode.
+If the database does not already exist, an error is returned.
+.Pp
+.It Dv sqlite.OPEN_READWRITE
+The database is opened for reading and writing if possible, or reading only if
+the file is write protected by the operating system.
+In either case the database must already exist, otherwise an error is returned.
+.Pp
+.It Dv sqlite.OPEN_CREATE
+The database is opened for reading and writing, and is created if it does not
+already exist.
+.El
+.Pp
+.It Dv version = sqlite.libversion()
+Return the SQLite3 library version number as a string.
+.Pp
+.It Dv version = sqlite.libversion_number()
+Return the SQLite3 library version number as a number.
+.Pp
+.It Dv id = sqlite.sourceid()
+Return teh SQLite3 library source id as a string.
+.EL
+.Sh DATABASE FUNCTIONS
+Database functions operate on database objects returned by
+.Em sqlite.open() .
+.Pp
+.Bl -tag -width XXXX -compact
+.It Dv err = sqlite.close(db)
+Close an open database.
+Like with all remaining database functions, this function can also be called
+using the Lua "colon" syntactic sugar as
+.Em db:close() .
+.Pp
+.It Dv stmt, err = sqlite.prepare(db, sql)
+Return a prepared statement.
+.Pp
+.It Dv err = sqlite.exec(db, sql)
+Directly execute an SQL statement.
+Be careful when creating SQL on the fly (SQL injection attacks).
+.Pp
+.It Dv err = sqlite.errcode(db)
+Return the numeric error code.
+.Pp
+.It Dv msg = sqlite.errmsg(db)
+Return the error message as a string.
+.Pp
+.It Dv res = sqlite.get_autocommit(db)
+Return the autocommit flag.
+.Pp
+.It Dv res = sqlite.changes(db)
+This function returns the number of database rows that were changed or inserted
+or deleted by the most recently completed SQL statement on the database.
+.El
+.Sh STATEMENT FUNCTIONS
+.Bl -tag -width XXXX -compact
+.It Dv err = sqlite.bind(stmt, pidx, value)
+Bind
+.Ar value
+to the paramter
+.Ar pidx
+in the prepared statment
+.Ar stmt .
+.Pp
+.It Dv count = sqlite.bind_parameter_count(stmt)
+Return the number of paramaters in the prepared statement
+.Ar stmt .
+.Pp
+.It Dv pidx = sqlite.bind_parameter_index(stmt, name)
+Return the paramter index for
+.Ar name
+in the prepared statement
+.Ar stmt .
+.Pp
+.It Dv name = sqlite.bind_parameter_name(stmt, pidx)
+Return the parameter name for the paramater index
+.Ar pidx
+in the prepared statement
+.Ar stmt .
+.Pp
+.It Dv err = sqlite.step(stmt)
+Execute prepared statement
+.Ar stmt .
+.Pp
+.It Dv value = sqlite.column(stmt, cidx)
+Return the value at column
+.Ar cidx
+in the prepared statement
+.Ar stmt .
+.Pp
+.It Dv sqlite.reset(stmt)
+The sqlite.reset() function is called to reset a prepared statement object back
+to its initial state, ready to be re-executed.
+.Pp
+.It Dv sqlite.clear_bindings(stmt)
+Contrary to the intuition of many, sqlite.reset() does not reset the bindings on
+a prepared statement.
+Use this routine to reset all host parameters to NULL.
+.Pp
+.It Dv sqlite.finalize(stmt)
+The sqlite.finalize() function is called to delete a prepared statement.
+.Pp
+.It Dv name = sqlite.column_name(stmt, cidx)
+Return the name assigned to a particular column in the result set of a SELECT
+statement.
+.Pp
+.It Dv count = sqlite.column_count(stmt)
+Return the number of columns in the result set returned by the prepared
+statement
+.Ar stmt .
+This routine returns 0 if
+.Ar stmt
+is an SQL statement that does not return data (for example an UPDATE).
+.El
+.Sh EROROR CODES
+Most functions return an error code, the following error codes
+are defined:
+.Pp
+.Bl -tag -widht XXXX -compact
+.It Dv sqlite.OK
+Successful result.
+.Pp
+.It Dv sqlite.ERROR
+SQL error or missing database.
+.Pp
+.It Dv sqlite.INTERNAL
+Internal logic error in SQLite.
+.Pp
+.It Dv sqlite.PERM
+Access permission denied.
+.Pp
+.It Dv sqlite.ABORT
+Callback routine requested an abort.
+.Pp
+.It Dv sqlite.BUSY
+The database file is locked.
+.Pp
+.It Dv sqlite.LOCKED
+A table in the database is locked.
+.Pp
+.It Dv sqlite.NOMEM
+Out of memory.
+.Pp
+.It Dv sqlite.READONLY
+Attempt to write a readonly database.
+.Pp
+.It Dv sqlite.INTERRUPT
+Operation terminated by sqlite3_interrupt().
+.Pp
+.It Dv sqlite.IOERR
+Some kind of disk I/O error occurred.
+.Pp
+.It Dv sqlite.CORRUPT
+The database disk image is malformed.
+.Pp
+.It Dv sqlite.NOTFOUND
+Unknown opcode in sqlite3_file_control().
+.Pp
+.It Dv sqlite.FULL
+Insertion failed because database is full.
+.Pp
+.It Dv sqlite.CANTOPEN
+Unable to open the database file.
+.Pp
+.It Dv sqlite.PROTOCOL
+Database lock protocol error.
+.Pp
+.It Dv sqlite.EMPTY
+Database is empty.
+.Pp
+.It Dv sqlite.SCHEMA
+The database schema changed.
+.Pp
+.It Dv sqlite.TOOBIG
+String or BLOB exceeds size limit.
+.Pp
+.It Dv sqlite.CONSTRAINT
+Abort due to constraint violation.
+.Pp
+.It Dv sqlite.MISMATCH
+Data type mismatch.
+.Pp
+.It Dv sqlite.MISUSE
+Library used incorrectly.
+.Pp
+.It Dv sqlite.NOLFS
+Uses OS features not supported on host.
+.Pp
+.It Dv sqlite.AUTH
+Authorization denied.
+.Pp
+.It Dv sqlite.FORMAT
+Auxiliary database format error.
+.Pp
+.It Dv sqlite.RANGE
+2nd parameter to sqlite.bind() out of range.
+.Pp
+.It Dv sqlite.NOTADB
+File opened that is not a database file.
+.Pp
+.It Dv sqlite.ROW
+sqlite.step() has another row ready.
+.Pp
+.It Dv sqlite.DONE
+sqlite.step() has finished executing.
+.El
+.Pp
+.Sh SEE ALSO
+.Xr lua 1 ,
+.Xr luac 1 ,
+.Xr sqlite3 1,
+.Xr intro 3lua
+.Sh HISTORY
+An
+.Nm
+manual appeared in
+.Nx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+Lua binding was written by
+.An Marc Balmer Aq Mt mbal...@netbsd.org .

Reply via email to