** This file defines the interface to the database backend (Dbbe).
**
** The database backend is designed to be as general as possible
** so that it can easily be replaced by a different backend.
** This library was originally designed to support the following
** backends: GDBM, NDBM, SDBM, Berkeley DB.
**
** $Id: dbbe.h,v 1.12 2001/04/03 16:53:22 drh Exp $
*/
#ifndef _SQLITE_DBBE_H_
#define _SQLITE_DBBE_H_
#include <stdio.h>
/*
** The database backend supports two opaque structures. A Dbbe is
................................................................................
/* Write an entry into a table. If another entry already exists with
** the same key, the old entry is discarded first.
*/
int (*Put)(DbbeCursor*, int nKey, char *pKey, int nData, char *pData);
/* Remove an entry from the table */
int (*Delete)(DbbeCursor*, int nKey, char *pKey);
};
/*
** This is the structure returned by sqliteDbbeOpen(). It contains
** information common to all the different backend drivers.
**
** The information in this structure (with the exception the method

** This file defines the interface to the database backend (Dbbe).
**
** The database backend is designed to be as general as possible
** so that it can easily be replaced by a different backend.
** This library was originally designed to support the following
** backends: GDBM, NDBM, SDBM, Berkeley DB.
**
** $Id: dbbe.h,v 1.13 2001/04/04 11:48:57 drh Exp $
*/
#ifndef _SQLITE_DBBE_H_
#define _SQLITE_DBBE_H_
#include <stdio.h>
/*
** The database backend supports two opaque structures. A Dbbe is
................................................................................
/* Write an entry into a table. If another entry already exists with
** the same key, the old entry is discarded first.
*/
int (*Put)(DbbeCursor*, int nKey, char *pKey, int nData, char *pData);
/* Remove an entry from the table */
int (*Delete)(DbbeCursor*, int nKey, char *pKey);
/* Begin a transaction. */ int (*BeginTransaction)(Dbbe*); /* Commit a transaction. */ int (*Commit)(Dbbe*); /* Rollback a transaction. */ int (*Rollback)(Dbbe*);
};
/*
** This is the structure returned by sqliteDbbeOpen(). It contains
** information common to all the different backend drivers.
**
** The information in this structure (with the exception the method

proc chng {date desc} {
puts "<DT><B>$date</B></DT>"
puts "<DD><P><UL>$desc</UL></P></DD>"
}
chng {2001 Apr 4 (1.0.28)} {
<li>Added limited support for transactions. At this point, transactions will do table locking on the GDBM backend. There is no support (yet) for rollback or atomic commit.</li><li>Added special column names ROWID, OID, and _ROWID_ that refer to the unique random integer key associated with every row of every table.</li><li>Additional tests added to the regression suite to cover the new ROWID feature and the TCL interface bugs mentioned below.</li>
<li>Changes to the "lemon" parser generator to help it work better when
compiled using MSVC.</li>
<li>Bug fixes in the TCL interface identified by Oleg Oleinick.</li>
}
chng {2001 Mar 20 (1.0.27)} {
<li>When doing DELETE and UPDATE, the library used to write the record

#
# Run this Tcl script to generate the sqlite.html file.
#
set rcsid {$Id: lang.tcl,v 1.6 2001/02/20 13:06:31 drh Exp $}
puts {<html>
<head>
<title>Query Language Understood By SQLite</title>
</head>
<body bgcolor=white>
<h1 align=center>
................................................................................
{INSERT insert}
{DELETE delete}
{UPDATE update}
{SELECT select}
{COPY copy}
{EXPLAIN explain}
{expression expr}
}] {
puts "<li><a href=\"#[lindex $section 1]\">[lindex $section 0]</a></li>"
}
puts {</ul></p>
<p>Details on the implementation of each command are provided in
the sequel.</p>
................................................................................
}
puts "<h1>$name</h1>\n"
}
proc Example {text} {
puts "<blockquote><pre>$text</pre></blockquote>"
}
Section COPY copy
Syntax {sql-statement} {
COPY <table-name> FROM <filename>
}
................................................................................
side against lower case characters on the other.</p>"
puts {
<p>The GLOB operator is similar to LIKE but uses the Unix
file globbing syntax for its wildcards. Also, GLOB is case
sensitive, unlike LIKE. Both GLOB and LIKE may be preceded by
the NOT keyword to invert the sense of the test.</p>
<p>SELECT statements can appear in expressions as either the
right-hand operand of the IN operator or as a scalar quantity.
In both cases, the SELECT should have only a single column in its
result. Compound SELECTs (connected with keywords like UNION or
EXCEPT) are allowed. Any ORDER BY clause on the select is ignored.
A SELECT in an expression is evaluated once before any other processing

#
# Run this Tcl script to generate the sqlite.html file.
#
set rcsid {$Id: lang.tcl,v 1.7 2001/04/04 11:48:58 drh Exp $}
puts {<html>
<head>
<title>Query Language Understood By SQLite</title>
</head>
<body bgcolor=white>
<h1 align=center>
................................................................................
{INSERT insert}
{DELETE delete}
{UPDATE update}
{SELECT select}
{COPY copy}
{EXPLAIN explain}
{expression expr}
{{BEGIN TRANSACTION} transaction}
}] {
puts "<li><a href=\"#[lindex $section 1]\">[lindex $section 0]</a></li>"
}
puts {</ul></p>
<p>Details on the implementation of each command are provided in
the sequel.</p>
................................................................................
}
puts "<h1>$name</h1>\n"
}
proc Example {text} {
puts "<blockquote><pre>$text</pre></blockquote>"
}
Section {BEGIN TRANSACTION} createindexSyntax {sql-statement} {BEGIN [TRANSACTION [<name>]]}Syntax {sql-statement} {END [TRANSACTION [<name>]]}Syntax {sql-statement} {COMMIT [TRANSACTION [<name>]]}Syntax {sql-statement} {ROLLBACK [TRANSACTION [<name>]]}puts {<p>Support for transactions in SQLite is thin. Transactionsmay not be nested. The GDBM backend does not support an atomiccommit or rollback, but it does support locking. (Note, however,that the compilation instructions on this website for using GDBM under Windows will disable locking.) The MEM backend has no transactionsupport and silently ignores all requests to begin or endtransactions. A new backend is currently underdevelopment for SQLite 2.0 that will support both atomic commits and rollback,but that driver is not yet available.</p><p>Under GDBM, starting a transaction just locks alltables that are either read or written during the course of thetransaction. The locks are removed when the transaction is ended.Thus, transactions can be used to make changes to multiple tableswith the assurance that other threads or processes will not touchthe same tables at the same time. For example:</p><blockquote><b>SELECT data1, data2, ... FROM table1 WHERE ...;</b><br>... Make a decision to update the table ...<br><b>BEGIN TRANSACTION;<br>SELECT data1, data2, ... FROM table1 WHERE ...;</b><br>... Make sure no other process changed the table in betweenthe first SELECT and the BEGIN TRANSACTION. ...<br><b>UPDATE table1 SET data1=... WHERE ...;<br>END TRANSACTION;</b></blockquote><p>In the code above, the <b>table1</b> table is locked bythe second SELECT because of the transaction. Thus we know thatno other process has modified <b>table1</b> when the UPDATEoccurs. The END TRANSACTION releases the lock.</p>}
Section COPY copy
Syntax {sql-statement} {
COPY <table-name> FROM <filename>
}
................................................................................
side against lower case characters on the other.</p>"
puts {
<p>The GLOB operator is similar to LIKE but uses the Unix
file globbing syntax for its wildcards. Also, GLOB is case
sensitive, unlike LIKE. Both GLOB and LIKE may be preceded by
the NOT keyword to invert the sense of the test.</p>
<p>A column name can be any of the names defined in the CREATE TABLEstatement or one of the following special identifiers: "<b>ROWID</b>","<b>OID</b>", or "<b>_ROWID_</b>".These special identifiers all describe theunique random integer key (the "row key") associated every every row of every table.The special identifiers only refer to the row key if the CREATE TABLEstatement does not define a real column with the same name. Row keysact like read-only columns. A row key can be used anywhere a regularcolumn can be used, except that you cannot change the valueof a row key in an UPDATE or INSERT statement."SELECT * ..." does not return the row key.</p>
<p>SELECT statements can appear in expressions as either the
right-hand operand of the IN operator or as a scalar quantity.
In both cases, the SELECT should have only a single column in its
result. Compound SELECTs (connected with keywords like UNION or
EXCEPT) are allowed. Any ORDER BY clause on the select is ignored.
A SELECT in an expression is evaluated once before any other processing

This page was generated in about
0.209s by
Fossil 2.7 [869841cb04] 2018-12-12 20:03:50