SQLite

Check-in [fcbd39344c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Documentation tweaks. (CVS 5322)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fcbd39344c0bf3a734bab6606d3988810b69b7d5
User & Date: drh 2008-06-27 14:51:53.000
Context
2008-06-27
18:59
Changed copy-paste error in comment. Fixes #3193. (CVS 5323) (check-in: 00eee53e86 user: mihailim tags: trunk)
14:51
Documentation tweaks. (CVS 5322) (check-in: fcbd39344c user: drh tags: trunk)
14:05
Fix mem3.c (broken by (5320)). (CVS 5321) (check-in: fef90a21ae user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/sqlite.h.in.
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
** on how SQLite interfaces are suppose to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite.h.in,v 1.360 2008/06/26 18:16:06 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
** on how SQLite interfaces are suppose to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite.h.in,v 1.361 2008/06/27 14:51:53 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492

1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
** There can only be a single busy handler defined for each
** [database connection].  Setting a new busy handler clears any
** previously set handler.  Note that calling [sqlite3_busy_timeout()]
** will also set or clear the busy handler.
**
** INVARIANTS:
**
** {F12311} The [sqlite3_busy_handler()] function replaces the busy handler
**          callback in the database connection identified by the 1st
**          parameter with a new busy handler identified by the 2nd and 3rd
**          parameters.
**
** {F12312} The default busy handler for new database connections is NULL.

**
** {F12314} When two or more database connection share a
**          [sqlite3_enable_shared_cache | common cache],
**          the busy handler for the database connection currently using
**          the cache is invoked when the cache encounters a lock.
**
** {F12316} If a busy handler callback returns zero, then the SQLite interface
**          that provoked the locking event will return [SQLITE_BUSY].
**
** {F12318} SQLite will invokes the busy handler with two arguments which
**          are a copy of the pointer supplied by the 3rd parameter to
**          [sqlite3_busy_handler()] and a count of the number of prior
**          invocations of the busy handler for the same locking event.
**
** LIMITATIONS:
**
** {A12319} A busy handler should not close the database connection
**          or [prepared statement] that invoked the busy handler.
*/
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);

/*
** CAPI3REF: Set A Busy Timeout {F12340}
**







|
|
<
|

|
>

|


|


|

|






|







1480
1481
1482
1483
1484
1485
1486
1487
1488

1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
** There can only be a single busy handler defined for each
** [database connection].  Setting a new busy handler clears any
** previously set handler.  Note that calling [sqlite3_busy_timeout()]
** will also set or clear the busy handler.
**
** INVARIANTS:
**
** {F12311} The [sqlite3_busy_handler(D,C,A)] function shall replace
**          busy callback in the [database connection] D with a new

**          a new busy handler C and application data pointer A.
**
** {F12312} Newly created [database connections] shall have a busy
**          handler of NULL.
**
** {F12314} When two or more [database connections] share a
**          [sqlite3_enable_shared_cache | common cache],
**          the busy handler for the database connection currently using
**          the cache shall be invoked when the cache encounters a lock.
**
** {F12316} If a busy handler callback returns zero, then the SQLite interface
**          that provoked the locking event shall return [SQLITE_BUSY].
**
** {F12318} SQLite shall invokes the busy handler with two arguments which
**          are a copy of the pointer supplied by the 3rd parameter to
**          [sqlite3_busy_handler()] and a count of the number of prior
**          invocations of the busy handler for the same locking event.
**
** LIMITATIONS:
**
** {A12319} A busy handler must not close the database connection
**          or [prepared statement] that invoked the busy handler.
*/
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);

/*
** CAPI3REF: Set A Busy Timeout {F12340}
**
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
** There can only be a single busy handler for a particular
** [database connection] any any given moment.  If another busy handler
** was defined  (using [sqlite3_busy_handler()]) prior to calling
** this routine, that other busy handler is cleared.
**
** INVARIANTS:
**
** {F12341} The [sqlite3_busy_timeout()] function overrides any prior
**          [sqlite3_busy_timeout()] or [sqlite3_busy_handler()] setting
**          on the same database connection.
**
** {F12343} If the 2nd parameter to [sqlite3_busy_timeout()] is less than
**          or equal to zero, then the busy handler is cleared so that
**          all subsequent locking events immediately return [SQLITE_BUSY].
**
** {F12344} If the 2nd parameter to [sqlite3_busy_timeout()] is a positive
**          number N, then a busy handler is set that repeatedly calls
**          the xSleep() method in the VFS interface until either the
**          lock clears or until the cumulative sleep time reported back
**          by xSleep() exceeds N milliseconds.
*/
int sqlite3_busy_timeout(sqlite3*, int ms);

/*
** CAPI3REF: Convenience Routines For Running Queries {F12370}
**
** Definition: A <b>result table</b> is memory data structure created by the







|

|


|



|
|
|
|







1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
** There can only be a single busy handler for a particular
** [database connection] any any given moment.  If another busy handler
** was defined  (using [sqlite3_busy_handler()]) prior to calling
** this routine, that other busy handler is cleared.
**
** INVARIANTS:
**
** {F12341} The [sqlite3_busy_timeout()] function shall override any prior
**          [sqlite3_busy_timeout()] or [sqlite3_busy_handler()] setting
**          on the same [database connection].
**
** {F12343} If the 2nd parameter to [sqlite3_busy_timeout()] is less than
**          or equal to zero, then the busy handler shall be cleared so that
**          all subsequent locking events immediately return [SQLITE_BUSY].
**
** {F12344} If the 2nd parameter to [sqlite3_busy_timeout()] is a positive
**          number N, then a busy handler shall be set that repeatedly calls
**          the xSleep() method in the [sqlite3_vfs | VFS interface] until
**          either the lock clears or until the cumulative sleep time
**          reported back by xSleep() exceeds N milliseconds.
*/
int sqlite3_busy_timeout(sqlite3*, int ms);

/*
** CAPI3REF: Convenience Routines For Running Queries {F12370}
**
** Definition: A <b>result table</b> is memory data structure created by the
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625

1626
1627
1628
1629
1630

1631
1632






1633
1634



1635

1636

1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
** interface defined here.  As a consequence, errors that occur in the
** wrapper layer outside of the internal [sqlite3_exec()] call are not
** reflected in subsequent calls to [sqlite3_errcode()] or [sqlite3_errmsg()].
**
** INVARIANTS:
**
** {F12371} If a [sqlite3_get_table()] fails a memory allocation, then
**          it frees the result table under construction, aborts the
**          query in process, skips any subsequent queries, sets the
**          *resultp output pointer to NULL and returns [SQLITE_NOMEM].
**
** {F12373} If the ncolumn parameter to [sqlite3_get_table()] is not NULL

**          then [sqlite3_get_table()] writes the number of columns in the
**          result set of the query into *ncolumn if the query is
**          successful (if the function returns SQLITE_OK).
**
** {F12374} If the nrow parameter to [sqlite3_get_table()] is not NULL

**          then [sqlite3_get_table()] writes the number of rows in the
**          result set of the query into *nrow if the query is






**          successful (if the function returns SQLITE_OK).
**



** {F12376} The [sqlite3_get_table()] function sets its *ncolumn value to the

**          number of columns in the result set of the query in the sql

**          parameter, or to zero if the query in sql has an empty result set.
*/
int sqlite3_get_table(
  sqlite3*,             /* An open database */
  const char *sql,      /* SQL to be evaluated */
  char ***pResult,      /* Results of the query */
  int *nrow,            /* Number of result rows written here */
  int *ncolumn,         /* Number of result columns written here */
  char **errmsg         /* Error msg written here */
);
void sqlite3_free_table(char **result);

/*
** CAPI3REF: Formatted String Printing Functions {F17400}
**
** These routines are workalikes of the "printf()" family of functions







|
|
|

|
>
|
|
<

|
>
|
|
>
>
>
>
>
>
|

>
>
>
|
>
|
>
|


|
|
|
|
|
|







1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628

1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
** interface defined here.  As a consequence, errors that occur in the
** wrapper layer outside of the internal [sqlite3_exec()] call are not
** reflected in subsequent calls to [sqlite3_errcode()] or [sqlite3_errmsg()].
**
** INVARIANTS:
**
** {F12371} If a [sqlite3_get_table()] fails a memory allocation, then
**          it shall free the result table under construction, abort the
**          query in process, skip any subsequent queries, set the
**          *pazResult output pointer to NULL and return [SQLITE_NOMEM].
**
** {F12373} If the pnColumn parameter to [sqlite3_get_table()] is not NULL
**          then a successful invocation of [sqlite3_get_table()] shall
**          write the number of columns in the
**          result set of the query into *pnColumn.

**
** {F12374} If the pnRow parameter to [sqlite3_get_table()] is not NULL
**          then a successful invocation of [sqlite3_get_table()] shall
**          writes the number of rows in the
**          result set of the query into *pnRow.
**
** {F12376} A successful invocation of [sqlite3_get_table()] that computes
**          N rows of result with C columns per row shall make *pazResult
**          point to an array of pointers to (N+1)*C strings where the first
**          C strings are column names as obtained from
**          [sqlite3_column_name()] and the rest are column result values
**          obtained from [sqlite3_column_text()].
**
** {F12379} The values in the pazResult array returned by [sqlite3_get_table()]
**          shall remain valid until cleared by [sqlite3_free_table()].
**
** {F12382} When an error occurs during evaluation of [sqlite3_get_table()]
**          the function shall set *pazResult to NULL, write an error message
**          into memory obtained from [sqlite3_malloc()], make
**          **pzErrmsg point to that error message, and return a
**          appropriate [error code].
*/
int sqlite3_get_table(
  sqlite3 *db,          /* An open database */
  const char *zSql,     /* SQL to be evaluated */
  char ***pazResult,    /* Results of the query */
  int *pnRow,           /* Number of result rows written here */
  int *pnColumn,        /* Number of result columns written here */
  char **pzErrmsg       /* Error msg written here */
);
void sqlite3_free_table(char **result);

/*
** CAPI3REF: Formatted String Printing Functions {F17400}
**
** These routines are workalikes of the "printf()" family of functions