Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src add a sqlite(3lua) manual page



details:   https://anonhg.NetBSD.org/src/rev/dbfc48785a40
branches:  trunk
changeset: 790941:dbfc48785a40
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Sun Oct 27 12:47:54 2013 +0000

description:
add a sqlite(3lua) manual page

diffstat:

 distrib/sets/lists/man/mi     |    5 +-
 share/man/man3lua/Makefile    |    4 +-
 share/man/man3lua/sqlite.3lua |  323 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 329 insertions(+), 3 deletions(-)

diffs (truncated from 372 to 300 lines):

diff -r aa32fe2a8314 -r dbfc48785a40 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sun Oct 27 12:38:08 2013 +0000
+++ b/distrib/sets/lists/man/mi Sun Oct 27 12:47:54 2013 +0000
@@ -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
diff -r aa32fe2a8314 -r dbfc48785a40 share/man/man3lua/Makefile
--- a/share/man/man3lua/Makefile        Sun Oct 27 12:38:08 2013 +0000
+++ b/share/man/man3lua/Makefile        Sun Oct 27 12:47:54 2013 +0000
@@ -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 \
diff -r aa32fe2a8314 -r dbfc48785a40 share/man/man3lua/sqlite.3lua
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3lua/sqlite.3lua     Sun Oct 27 12:47:54 2013 +0000
@@ -0,0 +1,323 @@
+.\"    $NetBSD: sqlite.3lua,v 1.1 2013/10/27 12:47:54 mbalmer Exp $
+.\"
+.\" Copyright (c) 2013 Marc Balmer <mbalmer%NetBSD.org@localhost>. 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.



Home | Main Index | Thread Index | Old Index