diff options
Diffstat (limited to '')
53 files changed, 10465 insertions, 0 deletions
diff --git a/www/session.html b/www/session.html new file mode 100644 index 0000000..dacb386 --- /dev/null +++ b/www/session.html @@ -0,0 +1,1874 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="sqlite.css" rel="stylesheet"> +<title>SQLite Session Module C/C++ Interface</title> +<!-- path= --> +</head> +<body> +<div class=nosearch> +<a href="index.html"> +<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='about.html'>About</a> +<li class='desktoponly'><a href="docs.html">Documentation</a> +<li class='desktoponly'><a href="download.html">Download</a> +<li class='wideonly'><a href='copyright.html'>License</a> +<li class='desktoponly'><a href="support.html">Support</a> +<li class='desktoponly'><a href="prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='about.html'>About</a> +<li><a href='docs.html'>Documentation</a> +<li><a href='download.html'>Download</a> +<li><a href='support.html'>Support</a> +<li><a href='prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> + + +<h2>SQLite Session Module C/C++ Interface</h2> + + + +<p>This page defines the C-language interface to the SQLite + <a href="sessionintro.html">session extension</a>. + This is not a tutorial. These pages are designed to be precise, not easy + to read. A tutorial is <a href="sessionintro.html">available separately</a>. + +<p>This page contains all C-language interface information +in a single HTML file. The same information is also available +broken out into <a href="../session/intro.html">some smaller pages</a> +for easier viewing, if you prefer.</p> + +<p>This document is created by a script which scans comments in the source +code file sqlite3session.h.</p> + +<hr> + + +<h2>Objects:</h2> +<div class='columns' style='columns: 15em auto;'> +<ul style='padding-top:0;'> +<li><a href='#sqlite3_changegroup'>sqlite3_changegroup</a></li> +<li><a href='#sqlite3_changeset_iter'>sqlite3_changeset_iter</a></li> +<li><a href='#sqlite3_rebaser'>sqlite3_rebaser<small><i>(exp)</i></small></a></li> +<li><a href='#sqlite3_session'>sqlite3_session</a></li> +</ul> +</div> +<hr> + +<h2>Constants:</h2> +<div class='columns' style='columns: 20em auto;'> +<ul style='padding-top:0;'> +<li><a href='#SQLITE_CHANGESETAPPLY_FKNOACTION'>SQLITE_CHANGESETAPPLY_FKNOACTION</a></li> +<li><a href='#SQLITE_CHANGESETAPPLY_FKNOACTION'>SQLITE_CHANGESETAPPLY_IGNORENOOP</a></li> +<li><a href='#SQLITE_CHANGESETAPPLY_FKNOACTION'>SQLITE_CHANGESETAPPLY_INVERT</a></li> +<li><a href='#SQLITE_CHANGESETAPPLY_FKNOACTION'>SQLITE_CHANGESETAPPLY_NOSAVEPOINT</a></li> +<li><a href='#SQLITE_CHANGESETSTART_INVERT'>SQLITE_CHANGESETSTART_INVERT</a></li> +<li><a href='#SQLITE_CHANGESET_ABORT'>SQLITE_CHANGESET_ABORT</a></li> +<li><a href='#SQLITE_CHANGESET_CONFLICT'>SQLITE_CHANGESET_CONFLICT</a></li> +<li><a href='#SQLITE_CHANGESET_CONFLICT'>SQLITE_CHANGESET_CONSTRAINT</a></li> +<li><a href='#SQLITE_CHANGESET_CONFLICT'>SQLITE_CHANGESET_DATA</a></li> +<li><a href='#SQLITE_CHANGESET_CONFLICT'>SQLITE_CHANGESET_FOREIGN_KEY</a></li> +<li><a href='#SQLITE_CHANGESET_CONFLICT'>SQLITE_CHANGESET_NOTFOUND</a></li> +<li><a href='#SQLITE_CHANGESET_ABORT'>SQLITE_CHANGESET_OMIT</a></li> +<li><a href='#SQLITE_CHANGESET_ABORT'>SQLITE_CHANGESET_REPLACE</a></li> +<li><a href='#SQLITE_SESSION_CONFIG_STRMSIZE'>SQLITE_SESSION_CONFIG_STRMSIZE</a></li> +<li><a href='#SQLITE_SESSION_OBJCONFIG_ROWID'>SQLITE_SESSION_OBJCONFIG_ROWID</a></li> +<li><a href='#SQLITE_SESSION_OBJCONFIG_ROWID'>SQLITE_SESSION_OBJCONFIG_SIZE</a></li> +</ul> +</div> +<hr> + +<h2>Functions:</h2> +<div class='columns' style='columns: 15em auto;'> +<ul style='padding-top:0;'> +<li><a href='#sqlite3changegroup_add'>sqlite3changegroup_add</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changegroup_add_strm</a></li> +<li><a href='#sqlite3changegroup_delete'>sqlite3changegroup_delete</a></li> +<li><a href='#sqlite3changegroup_new'>sqlite3changegroup_new</a></li> +<li><a href='#sqlite3changegroup_output'>sqlite3changegroup_output</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changegroup_output_strm</a></li> +<li><a href='#sqlite3changegroup_schema'>sqlite3changegroup_schema</a></li> +<li><a href='#sqlite3changeset_apply'>sqlite3changeset_apply</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_apply_strm</a></li> +<li><a href='#sqlite3changeset_apply'>sqlite3changeset_apply_v2</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_apply_v2_strm</a></li> +<li><a href='#sqlite3changeset_concat'>sqlite3changeset_concat</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_concat_strm</a></li> +<li><a href='#sqlite3changeset_conflict'>sqlite3changeset_conflict</a></li> +<li><a href='#sqlite3changeset_finalize'>sqlite3changeset_finalize</a></li> +<li><a href='#sqlite3changeset_fk_conflicts'>sqlite3changeset_fk_conflicts</a></li> +<li><a href='#sqlite3changeset_invert'>sqlite3changeset_invert</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_invert_strm</a></li> +<li><a href='#sqlite3changeset_new'>sqlite3changeset_new</a></li> +<li><a href='#sqlite3changeset_next'>sqlite3changeset_next</a></li> +<li><a href='#sqlite3changeset_old'>sqlite3changeset_old</a></li> +<li><a href='#sqlite3changeset_op'>sqlite3changeset_op</a></li> +<li><a href='#sqlite3changeset_pk'>sqlite3changeset_pk</a></li> +<li><a href='#sqlite3changeset_start'>sqlite3changeset_start</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_start_strm</a></li> +<li><a href='#sqlite3changeset_start'>sqlite3changeset_start_v2</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3changeset_start_v2_strm</a></li> +<li><a href='#sqlite3changeset_upgrade'>sqlite3changeset_upgrade</a></li> +<li><a href='#sqlite3rebaser_configure'>sqlite3rebaser_configure<small><i>(exp)</i></small></a></li> +<li><a href='#sqlite3rebaser_create'>sqlite3rebaser_create<small><i>(exp)</i></small></a></li> +<li><a href='#sqlite3rebaser_delete'>sqlite3rebaser_delete<small><i>(exp)</i></small></a></li> +<li><a href='#sqlite3rebaser_rebase'>sqlite3rebaser_rebase<small><i>(exp)</i></small></a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3rebaser_rebase_strm</a></li> +<li><a href='#sqlite3session_attach'>sqlite3session_attach</a></li> +<li><a href='#sqlite3session_changeset'>sqlite3session_changeset</a></li> +<li><a href='#sqlite3session_changeset_size'>sqlite3session_changeset_size</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3session_changeset_strm</a></li> +<li><a href='#sqlite3session_config'>sqlite3session_config</a></li> +<li><a href='#sqlite3session_create'>sqlite3session_create</a></li> +<li><a href='#sqlite3session_delete'>sqlite3session_delete</a></li> +<li><a href='#sqlite3session_diff'>sqlite3session_diff</a></li> +<li><a href='#sqlite3session_enable'>sqlite3session_enable</a></li> +<li><a href='#sqlite3session_indirect'>sqlite3session_indirect</a></li> +<li><a href='#sqlite3session_isempty'>sqlite3session_isempty</a></li> +<li><a href='#sqlite3session_memory_used'>sqlite3session_memory_used</a></li> +<li><a href='#sqlite3session_object_config'>sqlite3session_object_config</a></li> +<li><a href='#sqlite3session_patchset'>sqlite3session_patchset</a></li> +<li><a href='#sqlite3changegroup_add_strm'>sqlite3session_patchset_strm</a></li> +<li><a href='#sqlite3session_table_filter'>sqlite3session_table_filter</a></li> +</ul> +</div> +<hr> +<a name="SQLITE_CHANGESETSTART_INVERT"></a> +<h2>Flags for sqlite3changeset_start_v2</h2><blockquote><pre>#define SQLITE_CHANGESETSTART_INVERT 0x0002 +</pre></blockquote><p> +The following flags may passed via the 4th parameter to +<a href="#sqlite3changeset_start">sqlite3changeset_start_v2</a> and <a href="#sqlite3changegroup_add_strm">sqlite3changeset_start_v2_strm</a>:</p> + +<p><dt>SQLITE_CHANGESETAPPLY_INVERT <dd> + Invert the changeset while iterating through it. This is equivalent to + inverting a changeset using sqlite3changeset_invert() before applying it. + It is an error to specify this flag with a patchset. +</p><hr><a name="SQLITE_SESSION_CONFIG_STRMSIZE"></a> +<h2>Values for sqlite3session_config().</h2><blockquote><pre>#define SQLITE_SESSION_CONFIG_STRMSIZE 1 +</pre></blockquote><p></p><hr><a name="sqlite3_changegroup"></a> +<h2>Changegroup Handle</h2><blockquote><pre>typedef struct sqlite3_changegroup sqlite3_changegroup; +</pre></blockquote><p> +A changegroup is an object used to combine two or more +<a href="sessionintro.html#changeset">changesets</a> or <a href="sessionintro.html#changeset">patchsets</a> +</p><p>Constructor: <a href="#sqlite3changegroup_new">sqlite3changegroup_new()</a></p> +<p>Destructor: <a href="#sqlite3changegroup_delete">sqlite3changegroup_delete()</a></p> +<p>Methods: + <a href="#sqlite3changegroup_add">sqlite3changegroup_add()</a>, +<a href="#sqlite3changegroup_output">sqlite3changegroup_output()</a></p> +<hr><a name="sqlite3_changeset_iter"></a> +<h2>Changeset Iterator Handle</h2><blockquote><pre>typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; +</pre></blockquote><p> +An instance of this object acts as a cursor for iterating +over the elements of a <a href="sessionintro.html#changeset">changeset</a> or <a href="sessionintro.html#changeset">patchset</a>. +</p><p>Constructors: + <a href="#sqlite3changeset_start">sqlite3changeset_start()</a>, +<a href="#sqlite3changeset_start">sqlite3changeset_start_v2()</a></p> +<div class='columns' style='columns: 17em auto;'> +<ul style='padding-top:0;'> +<li><a href='#sqlite3changeset_conflict'>sqlite3changeset_conflict</a></li> +<li><a href='#sqlite3changeset_finalize'>sqlite3changeset_finalize</a></li> +<li><a href='#sqlite3changeset_fk_conflicts'>sqlite3changeset_fk_conflicts</a></li> +<li><a href='#sqlite3changeset_new'>sqlite3changeset_new</a></li> +<li><a href='#sqlite3changeset_next'>sqlite3changeset_next</a></li> +<li><a href='#sqlite3changeset_old'>sqlite3changeset_old</a></li> +<li><a href='#sqlite3changeset_op'>sqlite3changeset_op</a></li> +<li><a href='#sqlite3changeset_pk'>sqlite3changeset_pk</a></li> +</ul> +</div> +</p> +<hr><a name="sqlite3_rebaser"></a> +<h2>Rebasing changesets</h2><blockquote><pre>typedef struct sqlite3_rebaser sqlite3_rebaser; +</pre></blockquote><p><b>Important:</b> This interface is <a href="c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Suppose there is a site hosting a database in state S0. And that +modifications are made that move that database to state S1 and a +changeset recorded (the "local" changeset). Then, a changeset based +on S0 is received from another site (the "remote" changeset) and +applied to the database. The database is then in state +(S1+"remote"), where the exact state depends on any conflict +resolution decisions (OMIT or REPLACE) made while applying "remote". +Rebasing a changeset is to update it to take those conflict +resolution decisions into account, so that the same conflicts +do not have to be resolved elsewhere in the network. </p> + +<p>For example, if both the local and remote changesets contain an +INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":</p> + +<p> local: INSERT INTO t1 VALUES(1, 'v1'); + remote: INSERT INTO t1 VALUES(1, 'v2');</p> + +<p>and the conflict resolution is REPLACE, then the INSERT change is +removed from the local changeset (it was overridden). Or, if the +conflict resolution was "OMIT", then the local changeset is modified +to instead contain:</p> + +<p> UPDATE t1 SET b = 'v2' WHERE a=1;</p> + +<p>Changes within the local changeset are rebased as follows:</p> + +<p><dl> +<dt>Local INSERT<dd> + This may only conflict with a remote INSERT. If the conflict + resolution was OMIT, then add an UPDATE change to the rebased + changeset. Or, if the conflict resolution was REPLACE, add + nothing to the rebased changeset.</p> + +<p><dt>Local DELETE<dd> + This may conflict with a remote UPDATE or DELETE. In both cases the + only possible resolution is OMIT. If the remote operation was a + DELETE, then add no change to the rebased changeset. If the remote + operation was an UPDATE, then the old.* fields of change are updated + to reflect the new.* values in the UPDATE.</p> + +<p><dt>Local UPDATE<dd> + This may conflict with a remote UPDATE or DELETE. If it conflicts + with a DELETE, and the conflict resolution was OMIT, then the update + is changed into an INSERT. Any undefined values in the new.* record + from the update change are filled in using the old.* values from + the conflicting DELETE. Or, if the conflict resolution was REPLACE, + the UPDATE change is simply omitted from the rebased changeset.</p> + +<p> If conflict is with a remote UPDATE and the resolution is OMIT, then + the old.* values are rebased using the new.* values in the remote + change. Or, if the resolution is REPLACE, then the change is copied + into the rebased changeset with updates to columns also updated by + the conflicting remote UPDATE removed. If this means no columns would + be updated, the change is omitted. +</dl></p> + +<p>A local change may be rebased against multiple remote changes +simultaneously. If a single key is modified by multiple remote +changesets, they are combined as follows before the local changeset +is rebased:</p> + +<p><ul> + <li> If there has been one or more REPLACE resolutions on a + key, it is rebased according to a REPLACE.</p> + +<p> <li> If there have been no REPLACE resolutions on a key, then + the local changeset is rebased according to the most recent + of the OMIT resolutions. +</ul></p> + +<p>Note that conflict resolutions from multiple remote changesets are +combined on a per-field basis, not per-row. This means that in the +case of multiple remote UPDATE operations, some fields of a single +local change may be rebased for REPLACE while others are rebased for +OMIT.</p> + +<p>In order to rebase a local changeset, the remote changeset must first +be applied to the local database using sqlite3changeset_apply_v2() and +the buffer of rebase information captured. Then:</p> + +<p><ol> + <li> An sqlite3_rebaser object is created by calling + sqlite3rebaser_create(). + <li> The new object is configured with the rebase buffer obtained from + sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). + If the local changeset is to be rebased against multiple remote + changesets, then sqlite3rebaser_configure() should be called + multiple times, in the same order that the multiple + sqlite3changeset_apply_v2() calls were made. + <li> Each local changeset is rebased by calling sqlite3rebaser_rebase(). + <li> The sqlite3_rebaser object is deleted by calling + sqlite3rebaser_delete(). +</ol> +</p><hr><a name="sqlite3_session"></a> +<h2>Session Object Handle</h2><blockquote><pre>typedef struct sqlite3_session sqlite3_session; +</pre></blockquote><p> +An instance of this object is a <a href="sessionintro.html">session</a> that can be used to +record changes to a database. +</p><p>Constructor: <a href="#sqlite3session_create">sqlite3session_create()</a></p> +<p>Destructor: <a href="#sqlite3session_delete">sqlite3session_delete()</a></p> +<div class='columns' style='columns: 17em auto;'> +<ul style='padding-top:0;'> +<li><a href='#sqlite3session_attach'>sqlite3session_attach</a></li> +<li><a href='#sqlite3session_changeset'>sqlite3session_changeset</a></li> +<li><a href='#sqlite3session_changeset_size'>sqlite3session_changeset_size</a></li> +<li><a href='#sqlite3session_diff'>sqlite3session_diff</a></li> +<li><a href='#sqlite3session_enable'>sqlite3session_enable</a></li> +<li><a href='#sqlite3session_indirect'>sqlite3session_indirect</a></li> +<li><a href='#sqlite3session_object_config'>sqlite3session_object_config</a></li> +<li><a href='#sqlite3session_patchset'>sqlite3session_patchset</a></li> +<li><a href='#sqlite3session_table_filter'>sqlite3session_table_filter</a></li> +</ul> +</div> +</p> +<hr><a name="sqlite3changegroup_add"></a> +<h2>Add A Changeset To A Changegroup</h2><blockquote><pre>int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +</pre></blockquote><p> +Add all changes within the changeset (or patchset) in buffer pData (size +nData bytes) to the changegroup. </p> + +<p>If the buffer contains a patchset, then all prior calls to this function +on the same changegroup object must also have specified patchsets. Or, if +the buffer contains a changeset, so must have the earlier calls to this +function. Otherwise, SQLITE_ERROR is returned and no changes are added +to the changegroup.</p> + +<p>Rows within the changeset and changegroup are identified by the values in +their PRIMARY KEY columns. A change in the changeset is considered to +apply to the same row as a change already present in the changegroup if +the two rows have the same primary key.</p> + +<p>Changes to rows that do not already appear in the changegroup are +simply copied into it. Or, if both the new changeset and the changegroup +contain changes that apply to a single row, the final contents of the +changegroup depends on the type of each change, as follows:</p> + +<p><table border=1 style="margin-left:8ex;margin-right:8ex"> + <tr><th style="white-space:pre">Existing Change </th> + <th style="white-space:pre">New Change </th> + <th>Output Change + <tr><td>INSERT <td>INSERT <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>INSERT <td>UPDATE <td> + The INSERT change remains in the changegroup. The values in the + INSERT change are modified as if the row was inserted by the + existing change and then updated according to the new change. + <tr><td>INSERT <td>DELETE <td> + The existing INSERT is removed from the changegroup. The DELETE is + not added. + <tr><td>UPDATE <td>INSERT <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>UPDATE <td>UPDATE <td> + The existing UPDATE remains within the changegroup. It is amended + so that the accompanying values are as if the row was updated once + by the existing change and then again by the new change. + <tr><td>UPDATE <td>DELETE <td> + The existing UPDATE is replaced by the new DELETE within the + changegroup. + <tr><td>DELETE <td>INSERT <td> + If one or more of the column values in the row inserted by the + new change differ from those in the row deleted by the existing + change, the existing DELETE is replaced by an UPDATE within the + changegroup. Otherwise, if the inserted row is exactly the same + as the deleted row, the existing DELETE is simply discarded. + <tr><td>DELETE <td>UPDATE <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>DELETE <td>DELETE <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. +</table></p> + +<p>If the new changeset contains changes to a table that is already present +in the changegroup, then the number of columns and the position of the +primary key columns for the table must be consistent. If this is not the +case, this function fails with SQLITE_SCHEMA. Except, if the changegroup +object has been configured with a database schema using the +sqlite3changegroup_schema() API, then it is possible to combine changesets +with different numbers of columns for a single table, provided that +they are otherwise compatible.</p> + +<p>If the input changeset appears to be corrupt and the corruption is +detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition +occurs during processing, this function returns SQLITE_NOMEM. </p> + +<p>In all cases, if an error occurs the state of the final contents of the +changegroup is undefined. If no error occurs, SQLITE_OK is returned. +</p><hr><a name="sqlite3changegroup_delete"></a> +<h2>Delete A Changegroup Object</h2><blockquote><pre>void sqlite3changegroup_delete(sqlite3_changegroup*); +</pre></blockquote><p></p><hr><a name="sqlite3changegroup_new"></a> +<h2>Create A New Changegroup Object</h2><blockquote><pre>int sqlite3changegroup_new(sqlite3_changegroup **pp); +</pre></blockquote><p> +An sqlite3_changegroup object is used to combine two or more changesets +(or patchsets) into a single changeset (or patchset). A single changegroup +object may combine changesets or patchsets, but not both. The output is +always in the same format as the input.</p> + +<p>If successful, this function returns SQLITE_OK and populates (*pp) with +a pointer to a new sqlite3_changegroup object before returning. The caller +should eventually free the returned object using a call to +sqlite3changegroup_delete(). If an error occurs, an SQLite error code +(i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.</p> + +<p>The usual usage pattern for an sqlite3_changegroup object is as follows:</p> + +<p><ul> + <li> It is created using a call to sqlite3changegroup_new().</p> + +<p> <li> Zero or more changesets (or patchsets) are added to the object + by calling sqlite3changegroup_add().</p> + +<p> <li> The result of combining all input changesets together is obtained + by the application via a call to sqlite3changegroup_output().</p> + +<p> <li> The object is deleted using a call to sqlite3changegroup_delete(). +</ul></p> + +<p>Any number of calls to add() and output() may be made between the calls to +new() and delete(), and in any order.</p> + +<p>As well as the regular sqlite3changegroup_add() and +sqlite3changegroup_output() functions, also available are the streaming +versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +</p><hr><a name="sqlite3changegroup_output"></a> +<h2>Obtain A Composite Changeset From A Changegroup</h2><blockquote><pre>int sqlite3changegroup_output( + sqlite3_changegroup*, + int *pnData, /* OUT: Size of output buffer in bytes */ + void **ppData /* OUT: Pointer to output buffer */ +); +</pre></blockquote><p> +Obtain a buffer containing a changeset (or patchset) representing the +current contents of the changegroup. If the inputs to the changegroup +were themselves changesets, the output is a changeset. Or, if the +inputs were patchsets, the output is also a patchset.</p> + +<p>As with the output of the sqlite3session_changeset() and +sqlite3session_patchset() functions, all changes related to a single +table are grouped together in the output of this function. Tables appear +in the same order as for the very first changeset added to the changegroup. +If the second or subsequent changesets added to the changegroup contain +changes for tables that do not appear in the first changeset, they are +appended onto the end of the output changeset, again in the order in +which they are first encountered.</p> + +<p>If an error occurs, an SQLite error code is returned and the output +variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK +is returned and the output variables are set to the size of and a +pointer to the output buffer, respectively. In this case it is the +responsibility of the caller to eventually free the buffer using a +call to sqlite3_free(). +</p><hr><a name="sqlite3changegroup_schema"></a> +<h2>Add a Schema to a Changegroup</h2><blockquote><pre>int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); +</pre></blockquote><p> +This method may be used to optionally enforce the rule that the changesets +added to the changegroup handle must match the schema of database zDb +("main", "temp", or the name of an attached database). If +sqlite3changegroup_add() is called to add a changeset that is not compatible +with the configured schema, SQLITE_SCHEMA is returned and the changegroup +object is left in an undefined state.</p> + +<p>A changeset schema is considered compatible with the database schema in +the same way as for sqlite3changeset_apply(). Specifically, for each +table in the changeset, there exists a database table with:</p> + +<p><ul> + <li> The name identified by the changeset, and + <li> at least as many columns as recorded in the changeset, and + <li> the primary key columns in the same position as recorded in + the changeset. +</ul></p> + +<p>The output of the changegroup object always has the same schema as the +database nominated using this function. In cases where changesets passed +to sqlite3changegroup_add() have fewer columns than the corresponding table +in the database schema, these are filled in using the default column +values from the database schema. This makes it possible to combined +changesets that have different numbers of columns for a single table +within a changegroup, provided that they are otherwise compatible. +</p><hr><a name="sqlite3changeset_concat"></a> +<h2>Concatenate Two Changeset Objects</h2><blockquote><pre>int sqlite3changeset_concat( + int nA, /* Number of bytes in buffer pA */ + void *pA, /* Pointer to buffer containing changeset A */ + int nB, /* Number of bytes in buffer pB */ + void *pB, /* Pointer to buffer containing changeset B */ + int *pnOut, /* OUT: Number of bytes in output changeset */ + void **ppOut /* OUT: Buffer containing output changeset */ +); +</pre></blockquote><p> +This function is used to concatenate two changesets, A and B, into a +single changeset. The result is a changeset equivalent to applying +changeset A followed by changeset B. </p> + +<p>This function combines the two input changesets using an +sqlite3_changegroup object. Calling it produces similar results as the +following code fragment:</p> + +<p><pre> + sqlite3_changegroup *pGrp; + rc = sqlite3_changegroup_new(&pGrp); + if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); + if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB); + if( rc==SQLITE_OK ){ + rc = sqlite3changegroup_output(pGrp, pnOut, ppOut); + }else{ + *ppOut = 0; + *pnOut = 0; + } +</pre></p> + +<p>Refer to the sqlite3_changegroup documentation below for details. +</p><hr><a name="sqlite3changeset_conflict"></a> +<h2>Obtain Conflicting Row Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_conflict( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: Value from conflicting row */ +); +</pre></blockquote><p> +This function should only be used with iterator objects passed to a +conflict-handler callback by <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a> with either +<a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_DATA</a> or <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_CONFLICT</a>. If this function +is called on any other iterator, <a href="rescode.html#misuse">SQLITE_MISUSE</a> is returned and *ppValue +is set to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the +"conflicting row" associated with the current conflict-handler callback +and returns SQLITE_OK.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><hr><a name="sqlite3changeset_finalize"></a> +<h2>Finalize A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); +</pre></blockquote><p> +This function is used to finalize an iterator allocated with +<a href="#sqlite3changeset_start">sqlite3changeset_start()</a>.</p> + +<p>This function should only be called on iterators created using the +<a href="#sqlite3changeset_start">sqlite3changeset_start()</a> function. If an application calls this +function with an iterator passed to a conflict-handler by +<a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a>, <a href="rescode.html#misuse">SQLITE_MISUSE</a> is immediately returned and the +call has no effect.</p> + +<p>If an error was encountered within a call to an sqlite3changeset_xxx() +function (for example an <a href="rescode.html#corrupt">SQLITE_CORRUPT</a> in <a href="#sqlite3changeset_next">sqlite3changeset_next()</a> or an +<a href="rescode.html#nomem">SQLITE_NOMEM</a> in <a href="#sqlite3changeset_new">sqlite3changeset_new()</a>) then an error code corresponding +to that error is returned by this function. Otherwise, SQLITE_OK is +returned. This is to allow the following pattern (pseudo-code):</p> + +<p><pre> + sqlite3changeset_start(); + while( SQLITE_ROW==sqlite3changeset_next() ){ + // Do something with change. + } + rc = sqlite3changeset_finalize(); + if( rc!=SQLITE_OK ){ + // An error has occurred + } +</pre> +</p><hr><a name="sqlite3changeset_fk_conflicts"></a> +<h2>Determine The Number Of Foreign Key Constraint Violations</h2><blockquote><pre>int sqlite3changeset_fk_conflicts( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int *pnOut /* OUT: Number of FK violations */ +); +</pre></blockquote><p> +This function may only be called with an iterator passed to an +SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +it sets the output variable to the total number of known foreign key +violations in the destination database and returns SQLITE_OK.</p> + +<p>In all other cases this function returns SQLITE_MISUSE. +</p><hr><a name="sqlite3changeset_invert"></a> +<h2>Invert A Changeset</h2><blockquote><pre>int sqlite3changeset_invert( + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); +</pre></blockquote><p> +This function is used to "invert" a changeset object. Applying an inverted +changeset to a database reverses the effects of applying the uninverted +changeset. Specifically:</p> + +<p><ul> + <li> Each DELETE change is changed to an INSERT, and + <li> Each INSERT change is changed to a DELETE, and + <li> For each UPDATE change, the old.* and new.* values are exchanged. +</ul></p> + +<p>This function does not change the order in which changes appear within +the changeset. It merely reverses the sense of each individual change.</p> + +<p>If successful, a pointer to a buffer containing the inverted changeset +is stored in *ppOut, the size of the same buffer is stored in *pnOut, and +SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are +zeroed and an SQLite error code returned.</p> + +<p>It is the responsibility of the caller to eventually call sqlite3_free() +on the *ppOut pointer to free the buffer allocation following a successful +call to this function.</p> + +<p>WARNING/TODO: This function currently assumes that the input is a valid +changeset. If it is not, the results are undefined. +</p><hr><a name="sqlite3changeset_new"></a> +<h2>Obtain new.* Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_new( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a>, or an iterator +created by <a href="#sqlite3changeset_start">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="#sqlite3changeset_next">sqlite3changeset_next()</a> must have returned SQLITE_ROW. +Furthermore, it may only be called if the type of change that the iterator +currently points to is either <a href="c3ref/c_alter_table.html">SQLITE_UPDATE</a> or <a href="c3ref/c_alter_table.html">SQLITE_INSERT</a>. Otherwise, +this function returns <a href="rescode.html#misuse">SQLITE_MISUSE</a> and sets *ppValue to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the vector of +new row values stored as part of the UPDATE or INSERT change and +returns SQLITE_OK. If the change is an UPDATE and does not include +a new value for the requested column, *ppValue is set to NULL and +SQLITE_OK returned. The name of the function comes from the fact that +this is similar to the "new.*" columns available to update or delete +triggers.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><hr><a name="sqlite3changeset_next"></a> +<h2>Advance A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_next(sqlite3_changeset_iter *pIter); +</pre></blockquote><p> +This function may only be used with iterators created by the function +<a href="#sqlite3changeset_start">sqlite3changeset_start()</a>. If it is called on an iterator passed to +a conflict-handler callback by <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a>, SQLITE_MISUSE +is returned and the call has no effect.</p> + +<p>Immediately after an iterator is created by sqlite3changeset_start(), it +does not point to any change in the changeset. Assuming the changeset +is not empty, the first call to this function advances the iterator to +point to the first change in the changeset. Each subsequent call advances +the iterator to point to the next change in the changeset (if any). If +no error occurs and the iterator points to a valid change after a call +to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +Otherwise, if all changes in the changeset have already been visited, +SQLITE_DONE is returned.</p> + +<p>If an error occurs, an SQLite error code is returned. Possible error +codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or +SQLITE_NOMEM. +</p><hr><a name="sqlite3changeset_old"></a> +<h2>Obtain old.* Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_old( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a>, or an iterator +created by <a href="#sqlite3changeset_start">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="#sqlite3changeset_next">sqlite3changeset_next()</a> must have returned SQLITE_ROW. +Furthermore, it may only be called if the type of change that the iterator +currently points to is either <a href="c3ref/c_alter_table.html">SQLITE_DELETE</a> or <a href="c3ref/c_alter_table.html">SQLITE_UPDATE</a>. Otherwise, +this function returns <a href="rescode.html#misuse">SQLITE_MISUSE</a> and sets *ppValue to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the vector of +original row values stored as part of the UPDATE or DELETE change and +returns SQLITE_OK. The name of the function comes from the fact that this +is similar to the "old.*" columns available to update or delete triggers.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><hr><a name="sqlite3changeset_op"></a> +<h2>Obtain The Current Operation From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_op( + sqlite3_changeset_iter *pIter, /* Iterator object */ + const char **pzTab, /* OUT: Pointer to table name */ + int *pnCol, /* OUT: Number of columns in table */ + int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ + int *pbIndirect /* OUT: True for an 'indirect' change */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a>, or an iterator +created by <a href="#sqlite3changeset_start">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="#sqlite3changeset_next">sqlite3changeset_next()</a> must have returned <a href="rescode.html#row">SQLITE_ROW</a>. If this +is not the case, this function returns <a href="rescode.html#misuse">SQLITE_MISUSE</a>.</p> + +<p>Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three +outputs are set through these pointers: </p> + +<p>*pOp is set to one of <a href="c3ref/c_alter_table.html">SQLITE_INSERT</a>, <a href="c3ref/c_alter_table.html">SQLITE_DELETE</a> or <a href="c3ref/c_alter_table.html">SQLITE_UPDATE</a>, +depending on the type of change that the iterator currently points to;</p> + +<p>*pnCol is set to the number of columns in the table affected by the change; and</p> + +<p>*pzTab is set to point to a nul-terminated utf-8 encoded string containing +the name of the table affected by the current change. The buffer remains +valid until either sqlite3changeset_next() is called on the iterator +or until the conflict-handler function returns.</p> + +<p>If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change +is an indirect change, or false (0) otherwise. See the documentation for +<a href="#sqlite3session_indirect">sqlite3session_indirect()</a> for a description of direct and indirect +changes.</p> + +<p>If no error occurs, SQLITE_OK is returned. If an error does occur, an +SQLite error code is returned. The values of the output variables may not +be trusted in this case. +</p><hr><a name="sqlite3changeset_pk"></a> +<h2>Obtain The Primary Key Definition Of A Table</h2><blockquote><pre>int sqlite3changeset_pk( + sqlite3_changeset_iter *pIter, /* Iterator object */ + unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ + int *pnCol /* OUT: Number of entries in output array */ +); +</pre></blockquote><p> +For each modified table, a changeset includes the following:</p> + +<p><ul> + <li> The number of columns in the table, and + <li> Which of those columns make up the tables PRIMARY KEY. +</ul></p> + +<p>This function is used to find which columns comprise the PRIMARY KEY of +the table modified by the change that iterator pIter currently points to. +If successful, *pabPK is set to point to an array of nCol entries, where +nCol is the number of columns in the table. Elements of *pabPK are set to +0x01 if the corresponding column is part of the tables primary key, or +0x00 if it is not.</p> + +<p>If argument pnCol is not NULL, then *pnCol is set to the number of columns +in the table.</p> + +<p>If this function is called when the iterator does not point to a valid +entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise, +SQLITE_OK is returned and the output variables populated as described +above. +</p><hr><a name="sqlite3changeset_upgrade"></a> +<h2>Upgrade the Schema of a Changeset/Patchset</h2><blockquote><pre>int sqlite3changeset_upgrade( + sqlite3 *db, + const char *zDb, + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); +</pre></blockquote><p></p><hr><a name="sqlite3rebaser_configure"></a> +<h2>Configure a changeset rebaser object.</h2><blockquote><pre>int sqlite3rebaser_configure( + sqlite3_rebaser*, + int nRebase, const void *pRebase +); +</pre></blockquote><p><b>Important:</b> This interface is <a href="c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Configure the changeset rebaser object to rebase changesets according +to the conflict resolutions described by buffer pRebase (size nRebase +bytes), which must have been obtained from a previous call to +sqlite3changeset_apply_v2(). +</p><hr><a name="sqlite3rebaser_create"></a> +<h2>Create a changeset rebaser object.</h2><blockquote><pre>int sqlite3rebaser_create(sqlite3_rebaser **ppNew); +</pre></blockquote><p><b>Important:</b> This interface is <a href="c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Allocate a new changeset rebaser object. If successful, set (*ppNew) to +point to the new object and return SQLITE_OK. Otherwise, if an error +occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) +to NULL. +</p><hr><a name="sqlite3rebaser_delete"></a> +<h2>Delete a changeset rebaser object.</h2><blockquote><pre>void sqlite3rebaser_delete(sqlite3_rebaser *p); +</pre></blockquote><p><b>Important:</b> This interface is <a href="c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Delete the changeset rebaser object and all associated resources. There +should be one call to this function for each successful invocation +of sqlite3rebaser_create(). +</p><hr><a name="sqlite3rebaser_rebase"></a> +<h2>Rebase a changeset</h2><blockquote><pre>int sqlite3rebaser_rebase( + sqlite3_rebaser*, + int nIn, const void *pIn, + int *pnOut, void **ppOut +); +</pre></blockquote><p><b>Important:</b> This interface is <a href="c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Argument pIn must point to a buffer containing a changeset nIn bytes +in size. This function allocates and populates a buffer with a copy +of the changeset rebased according to the configuration of the +rebaser object passed as the first argument. If successful, (*ppOut) +is set to point to the new buffer containing the rebased changeset and +(*pnOut) to its size in bytes and SQLITE_OK returned. It is the +responsibility of the caller to eventually free the new buffer using +sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +are set to zero and an SQLite error code returned. +</p><hr><a name="sqlite3session_attach"></a> +<h2>Attach A Table To A Session Object</h2><blockquote><pre>int sqlite3session_attach( + sqlite3_session *pSession, /* Session object */ + const char *zTab /* Table name */ +); +</pre></blockquote><p> +If argument zTab is not NULL, then it is the name of a table to attach +to the session object passed as the first argument. All subsequent changes +made to the table while the session object is enabled will be recorded. See +documentation for <a href="#sqlite3session_changeset">sqlite3session_changeset()</a> for further details.</p> + +<p>Or, if argument zTab is NULL, then changes are recorded for all tables +in the database. If additional tables are added to the database (by +executing "CREATE TABLE" statements) after this call is made, changes for +the new tables are also recorded.</p> + +<p>Changes can only be recorded for tables that have a PRIMARY KEY explicitly +defined as part of their CREATE TABLE statement. It does not matter if the +PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY +KEY may consist of a single column, or may be a composite key.</p> + +<p>It is not an error if the named table does not exist in the database. Nor +is it an error if the named table does not have a PRIMARY KEY. However, +no changes will be recorded in either of these scenarios.</p> + +<p>Changes are not recorded for individual rows that have NULL values stored +in one or more of their PRIMARY KEY columns.</p> + +<p>SQLITE_OK is returned if the call completes without error. Or, if an error +occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.</p> + +<p><h3>Special sqlite_stat1 Handling</h3></p> + +<p>As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to +some of the rules above. In SQLite, the schema of sqlite_stat1 is: + <pre> + CREATE TABLE sqlite_stat1(tbl,idx,stat) + </pre></p> + +<p>Even though sqlite_stat1 does not have a PRIMARY KEY, changes are +recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes +are recorded for rows for which (idx IS NULL) is true. However, for such +rows a zero-length blob (SQL value X'') is stored in the changeset or +patchset instead of a NULL value. This allows such changesets to be +manipulated by legacy implementations of sqlite3changeset_invert(), +concat() and similar.</p> + +<p>The sqlite3changeset_apply() function automatically converts the +zero-length blob back to a NULL value when updating the sqlite_stat1 +table. However, if the application calls sqlite3changeset_new(), +sqlite3changeset_old() or sqlite3changeset_conflict on a changeset +iterator directly (including on a changeset iterator passed to a +conflict-handler callback) then the X'' value is returned. The application +must translate X'' to NULL itself if required.</p> + +<p>Legacy (older than 3.22.0) versions of the sessions module cannot capture +changes made to the sqlite_stat1 table. Legacy versions of the +sqlite3changeset_apply() function silently ignore any modifications to the +sqlite_stat1 table that are part of a changeset or patchset. +</p><hr><a name="sqlite3session_changeset"></a> +<h2>Generate A Changeset From A Session Object</h2><blockquote><pre>int sqlite3session_changeset( + sqlite3_session *pSession, /* Session object */ + int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ + void **ppChangeset /* OUT: Buffer containing changeset */ +); +</pre></blockquote><p> +Obtain a changeset containing changes to the tables attached to the +session object passed as the first argument. If successful, +set *ppChangeset to point to a buffer containing the changeset +and *pnChangeset to the size of the changeset in bytes before returning +SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to +zero and return an SQLite error code.</p> + +<p>A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes, +each representing a change to a single row of an attached table. An INSERT +change contains the values of each field of a new database row. A DELETE +contains the original values of each field of a deleted database row. An +UPDATE change contains the original values of each field of an updated +database row along with the updated values for each updated non-primary-key +column. It is not possible for an UPDATE change to represent a change that +modifies the values of primary key columns. If such a change is made, it +is represented in a changeset as a DELETE followed by an INSERT.</p> + +<p>Changes are not recorded for rows that have NULL values stored in one or +more of their PRIMARY KEY columns. If such a row is inserted or deleted, +no corresponding change is present in the changesets returned by this +function. If an existing row with one or more NULL values stored in +PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL, +only an INSERT is appears in the changeset. Similarly, if an existing row +with non-NULL PRIMARY KEY values is updated so that one or more of its +PRIMARY KEY columns are set to NULL, the resulting changeset contains a +DELETE change only.</p> + +<p>The contents of a changeset may be traversed using an iterator created +using the <a href="#sqlite3changeset_start">sqlite3changeset_start()</a> API. A changeset may be applied to +a database with a compatible schema using the <a href="#sqlite3changeset_apply">sqlite3changeset_apply()</a> +API.</p> + +<p>Within a changeset generated by this function, all changes related to a +single table are grouped together. In other words, when iterating through +a changeset or when applying a changeset to a database, all changes related +to a single table are processed before moving on to the next table. Tables +are sorted in the same order in which they were attached (or auto-attached) +to the sqlite3_session object. The order in which the changes related to +a single table are stored is undefined.</p> + +<p>Following a successful call to this function, it is the responsibility of +the caller to eventually free the buffer that *ppChangeset points to using +<a href="c3ref/free.html">sqlite3_free()</a>.</p> + +<p><h3>Changeset Generation</h3></p> + +<p>Once a table has been attached to a session object, the session object +records the primary key values of all new rows inserted into the table. +It also records the original primary key and other column values of any +deleted or updated rows. For each unique primary key value, data is only +recorded once - the first time a row with said primary key is inserted, +updated or deleted in the lifetime of the session.</p> + +<p>There is one exception to the previous paragraph: when a row is inserted, +updated or deleted, if one or more of its primary key columns contain a +NULL value, no record of the change is made.</p> + +<p>The session object therefore accumulates two types of records - those +that consist of primary key values only (created when the user inserts +a new record) and those that consist of the primary key values and the +original values of other table columns (created when the users deletes +or updates a record).</p> + +<p>When this function is called, the requested changeset is created using +both the accumulated records and the current contents of the database +file. Specifically:</p> + +<p><ul> + <li> For each record generated by an insert, the database is queried + for a row with a matching primary key. If one is found, an INSERT + change is added to the changeset. If no such row is found, no change + is added to the changeset.</p> + +<p> <li> For each record generated by an update or delete, the database is + queried for a row with a matching primary key. If such a row is + found and one or more of the non-primary key fields have been + modified from their original values, an UPDATE change is added to + the changeset. Or, if no such row is found in the table, a DELETE + change is added to the changeset. If there is a row with a matching + primary key in the database, but all fields contain their original + values, no change is added to the changeset. +</ul></p> + +<p>This means, amongst other things, that if a row is inserted and then later +deleted while a session object is active, neither the insert nor the delete +will be present in the changeset. Or if a row is deleted and then later a +row with the same primary key values inserted while a session object is +active, the resulting changeset will contain an UPDATE change instead of +a DELETE and an INSERT.</p> + +<p>When a session object is disabled (see the <a href="#sqlite3session_enable">sqlite3session_enable()</a> API), +it does not accumulate records when rows are inserted, updated or deleted. +This may appear to have some counter-intuitive effects if a single row +is written to more than once during a session. For example, if a row +is inserted while a session object is enabled, then later deleted while +the same session object is disabled, no INSERT record will appear in the +changeset, even though the delete took place while the session was disabled. +Or, if one field of a row is updated while a session is disabled, and +another field of the same row is updated while the session is enabled, the +resulting changeset will contain an UPDATE change that updates both fields. +</p><hr><a name="sqlite3session_changeset_size"></a> +<h2>Return An Upper-limit For The Size Of The Changeset</h2><blockquote><pre>sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession); +</pre></blockquote><p> +By default, this function always returns 0. For it to return +a useful result, the sqlite3_session object must have been configured +to enable this API using sqlite3session_object_config() with the +SQLITE_SESSION_OBJCONFIG_SIZE verb.</p> + +<p>When enabled, this function returns an upper limit, in bytes, for the size +of the changeset that might be produced if sqlite3session_changeset() were +called. The final changeset size might be equal to or smaller than the +size in bytes returned by this function. +</p><hr><a name="sqlite3session_config"></a> +<h2>Configure global parameters</h2><blockquote><pre>int sqlite3session_config(int op, void *pArg); +</pre></blockquote><p> +The sqlite3session_config() interface is used to make global configuration +changes to the sessions module in order to tune it to the specific needs +of the application.</p> + +<p>The sqlite3session_config() interface is not threadsafe. If it is invoked +while any other thread is inside any other sessions method then the +results are undefined. Furthermore, if it is invoked after any sessions +related objects have been created, the results are also undefined. </p> + +<p>The first argument to the sqlite3session_config() function must be one +of the SQLITE_SESSION_CONFIG_XXX constants defined below. The +interpretation of the (void*) value passed as the second parameter and +the effect of calling this function depends on the value of the first +parameter.</p> + +<p><dl> +<dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd> + By default, the sessions module streaming interfaces attempt to input + and output data in approximately 1 KiB chunks. This operand may be used + to set and query the value of this configuration setting. The pointer + passed as the second argument must point to a value of type (int). + If this value is greater than 0, it is used as the new streaming data + chunk size for both input and output. Before returning, the (int) value + pointed to by pArg is set to the final value of the streaming interface + chunk size. +</dl></p> + +<p>This function returns SQLITE_OK if successful, or an SQLite error code +otherwise. +</p><hr><a name="sqlite3session_create"></a> +<h2>Create A New Session Object</h2><blockquote><pre>int sqlite3session_create( + sqlite3 *db, /* Database handle */ + const char *zDb, /* Name of db (e.g. "main") */ + sqlite3_session **ppSession /* OUT: New session object */ +); +</pre></blockquote><p> +Create a new session object attached to database handle db. If successful, +a pointer to the new object is written to *ppSession and SQLITE_OK is +returned. If an error occurs, *ppSession is set to NULL and an SQLite +error code (e.g. SQLITE_NOMEM) is returned.</p> + +<p>It is possible to create multiple session objects attached to a single +database handle.</p> + +<p>Session objects created using this function should be deleted using the +<a href="#sqlite3session_delete">sqlite3session_delete()</a> function before the database handle that they +are attached to is itself closed. If the database handle is closed before +the session object is deleted, then the results of calling any session +module function, including <a href="#sqlite3session_delete">sqlite3session_delete()</a> on the session object +are undefined.</p> + +<p>Because the session module uses the <a href="c3ref/preupdate_blobwrite.html">sqlite3_preupdate_hook()</a> API, it +is not possible for an application to register a pre-update hook on a +database handle that has one or more session objects attached. Nor is +it possible to create a session object attached to a database handle for +which a pre-update hook is already defined. The results of attempting +either of these things are undefined.</p> + +<p>The session object will be used to create changesets for tables in +database zDb, where zDb is either "main", or "temp", or the name of an +attached database. It is not an error if database zDb is not attached +to the database when the session object is created. +</p><hr><a name="sqlite3session_delete"></a> +<h2>Delete A Session Object</h2><blockquote><pre>void sqlite3session_delete(sqlite3_session *pSession); +</pre></blockquote><p> +Delete a session object previously allocated using +<a href="#sqlite3session_create">sqlite3session_create()</a>. Once a session object has been deleted, the +results of attempting to use pSession with any other session module +function are undefined.</p> + +<p>Session objects must be deleted before the database handle to which they +are attached is closed. Refer to the documentation for +<a href="#sqlite3session_create">sqlite3session_create()</a> for details. +</p><hr><a name="sqlite3session_diff"></a> +<h2>Load The Difference Between Tables Into A Session</h2><blockquote><pre>int sqlite3session_diff( + sqlite3_session *pSession, + const char *zFromDb, + const char *zTbl, + char **pzErrMsg +); +</pre></blockquote><p> +If it is not already attached to the session object passed as the first +argument, this function attaches table zTbl in the same manner as the +<a href="#sqlite3session_attach">sqlite3session_attach()</a> function. If zTbl does not exist, or if it +does not have a primary key, this function is a no-op (but does not return +an error).</p> + +<p>Argument zFromDb must be the name of a database ("main", "temp" etc.) +attached to the same database handle as the session object that contains +a table compatible with the table attached to the session by this function. +A table is considered compatible if it:</p> + +<p><ul> + <li> Has the same name, + <li> Has the same set of columns declared in the same order, and + <li> Has the same PRIMARY KEY definition. +</ul></p> + +<p>If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables +are compatible but do not have any PRIMARY KEY columns, it is not an error +but no changes are added to the session object. As with other session +APIs, tables without PRIMARY KEYs are simply ignored.</p> + +<p>This function adds a set of changes to the session object that could be +used to update the table in database zFrom (call this the "from-table") +so that its content is the same as the table attached to the session +object (call this the "to-table"). Specifically:</p> + +<p><ul> + <li> For each row (primary key) that exists in the to-table but not in + the from-table, an INSERT record is added to the session object.</p> + +<p> <li> For each row (primary key) that exists in the to-table but not in + the from-table, a DELETE record is added to the session object.</p> + +<p> <li> For each row (primary key) that exists in both tables, but features + different non-PK values in each, an UPDATE record is added to the + session. +</ul></p> + +<p>To clarify, if this function is called and then a changeset constructed +using <a href="#sqlite3session_changeset">sqlite3session_changeset()</a>, then after applying that changeset to +database zFrom the contents of the two compatible tables would be +identical.</p> + +<p>It an error if database zFrom does not exist or does not contain the +required compatible table.</p> + +<p>If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite +error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg +may be set to point to a buffer containing an English language error +message. It is the responsibility of the caller to free this buffer using +sqlite3_free(). +</p><hr><a name="sqlite3session_enable"></a> +<h2>Enable Or Disable A Session Object</h2><blockquote><pre>int sqlite3session_enable(sqlite3_session *pSession, int bEnable); +</pre></blockquote><p> +Enable or disable the recording of changes by a session object. When +enabled, a session object records changes made to the database. When +disabled - it does not. A newly created session object is enabled. +Refer to the documentation for <a href="#sqlite3session_changeset">sqlite3session_changeset()</a> for further +details regarding how enabling and disabling a session object affects +the eventual changesets.</p> + +<p>Passing zero to this function disables the session. Passing a value +greater than zero enables it. Passing a value less than zero is a +no-op, and may be used to query the current state of the session.</p> + +<p>The return value indicates the final state of the session object: 0 if +the session is disabled, or 1 if it is enabled. +</p><hr><a name="sqlite3session_indirect"></a> +<h2>Set Or Clear the Indirect Change Flag</h2><blockquote><pre>int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); +</pre></blockquote><p> +Each change recorded by a session object is marked as either direct or +indirect. A change is marked as indirect if either:</p> + +<p><ul> + <li> The session object "indirect" flag is set when the change is + made, or + <li> The change is made by an SQL trigger or foreign key action + instead of directly as a result of a users SQL statement. +</ul></p> + +<p>If a single row is affected by more than one operation within a session, +then the change is considered indirect if all operations meet the criteria +for an indirect change above, or direct otherwise.</p> + +<p>This function is used to set, clear or query the session object indirect +flag. If the second argument passed to this function is zero, then the +indirect flag is cleared. If it is greater than zero, the indirect flag +is set. Passing a value less than zero does not modify the current value +of the indirect flag, and may be used to query the current state of the +indirect flag for the specified session object.</p> + +<p>The return value indicates the final state of the indirect flag: 0 if +it is clear, or 1 if it is set. +</p><hr><a name="sqlite3session_isempty"></a> +<h2>Test if a changeset has recorded any changes.</h2><blockquote><pre>int sqlite3session_isempty(sqlite3_session *pSession); +</pre></blockquote><p> +Return non-zero if no changes to attached tables have been recorded by +the session object passed as the first argument. Otherwise, if one or +more changes have been recorded, return zero.</p> + +<p>Even if this function returns zero, it is possible that calling +<a href="#sqlite3session_changeset">sqlite3session_changeset()</a> on the session handle may still return a +changeset that contains no changes. This can happen when a row in +an attached table is modified and then later on the original values +are restored. However, if this function returns non-zero, then it is +guaranteed that a call to sqlite3session_changeset() will return a +changeset containing zero changes. +</p><hr><a name="sqlite3session_memory_used"></a> +<h2>Query for the amount of heap memory used by a session object.</h2><blockquote><pre>sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession); +</pre></blockquote><p> +This API returns the total amount of heap memory in bytes currently +used by the session object passed as the only argument. +</p><hr><a name="sqlite3session_object_config"></a> +<h2>Configure a Session Object</h2><blockquote><pre>int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); +</pre></blockquote><p> +This method is used to configure a session object after it has been +created. At present the only valid values for the second parameter are +<a href="#SQLITE_SESSION_OBJCONFIG_ROWID">SQLITE_SESSION_OBJCONFIG_SIZE</a> and <a href="#SQLITE_SESSION_OBJCONFIG_ROWID">SQLITE_SESSION_OBJCONFIG_ROWID</a>.</p> + +<p></p><hr><a name="sqlite3session_patchset"></a> +<h2>Generate A Patchset From A Session Object</h2><blockquote><pre>int sqlite3session_patchset( + sqlite3_session *pSession, /* Session object */ + int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ + void **ppPatchset /* OUT: Buffer containing patchset */ +); +</pre></blockquote><p> +The differences between a patchset and a changeset are that:</p> + +<p><ul> + <li> DELETE records consist of the primary key fields only. The + original values of other fields are omitted. + <li> The original values of any modified fields are omitted from + UPDATE records. +</ul></p> + +<p>A patchset blob may be used with up to date versions of all +sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, +attempting to use a patchset blob with old versions of the +sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. </p> + +<p>Because the non-primary key "old.*" fields are omitted, no +SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset +is passed to the sqlite3changeset_apply() API. Other conflict types work +in the same way as for changesets.</p> + +<p>Changes within a patchset are ordered in the same way as for changesets +generated by the sqlite3session_changeset() function (i.e. all changes for +a single table are grouped together, tables appear in the order in which +they were attached to the session object). +</p><hr><a name="sqlite3session_table_filter"></a> +<h2>Set a table filter on a Session Object.</h2><blockquote><pre>void sqlite3session_table_filter( + sqlite3_session *pSession, /* Session object */ + int(*xFilter)( + void *pCtx, /* Copy of third arg to _filter_table() */ + const char *zTab /* Table name */ + ), + void *pCtx /* First argument passed to xFilter */ +); +</pre></blockquote><p> +The second argument (xFilter) is the "filter callback". For changes to rows +in tables that are not attached to the Session object, the filter is called +to determine whether changes to the table's rows should be tracked or not. +If xFilter returns 0, changes are not tracked. Note that once a table is +attached, xFilter will not be called again. +</p><hr><a name="SQLITE_CHANGESETAPPLY_FKNOACTION"></a> +<h2>Flags for sqlite3changeset_apply_v2</h2><blockquote><pre>#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 +#define SQLITE_CHANGESETAPPLY_INVERT 0x0002 +#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 +#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 +</pre></blockquote><p> +The following flags may passed via the 9th parameter to +<a href="#sqlite3changeset_apply">sqlite3changeset_apply_v2</a> and <a href="#sqlite3changegroup_add_strm">sqlite3changeset_apply_v2_strm</a>:</p> + +<p><dl> +<dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd> + Usually, the sessions module encloses all operations performed by + a single call to apply_v2() or apply_v2_strm() in a <a href="lang_savepoint.html">SAVEPOINT</a>. The + SAVEPOINT is committed if the changeset or patchset is successfully + applied, or rolled back if an error occurs. Specifying this flag + causes the sessions module to omit this savepoint. In this case, if the + caller has an open transaction or savepoint when apply_v2() is called, + it may revert the partially applied changeset by rolling it back.</p> + +<p><dt>SQLITE_CHANGESETAPPLY_INVERT <dd> + Invert the changeset before applying it. This is equivalent to inverting + a changeset using sqlite3changeset_invert() before applying it. It is + an error to specify this flag with a patchset.</p> + +<p><dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd> + Do not invoke the conflict handler callback for any changes that + would not actually modify the database even if they were applied. + Specifically, this means that the conflict handler is not invoked + for: + <ul> + <li>a delete change if the row being deleted cannot be found, + <li>an update change if the modified fields are already set to + their new values in the conflicting row, or + <li>an insert change if all fields of the conflicting row match + the row being inserted. + </ul></p> + +<p><dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd> + If this flag it set, then all foreign key constraints in the target + database behave as if they were declared with "ON UPDATE NO ACTION ON + DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL + or SET DEFAULT. +</p><hr><a name="SQLITE_CHANGESET_ABORT"></a> +<h2>Constants Returned By The Conflict Handler</h2><blockquote><pre>#define SQLITE_CHANGESET_OMIT 0 +#define SQLITE_CHANGESET_REPLACE 1 +#define SQLITE_CHANGESET_ABORT 2 +</pre></blockquote><p> +A conflict handler callback must return one of the following three values.</p> + +<p><dl> +<dt>SQLITE_CHANGESET_OMIT<dd> + If a conflict handler returns this value no special action is taken. The + change that caused the conflict is not applied. The session module + continues to the next change in the changeset.</p> + +<p><dt>SQLITE_CHANGESET_REPLACE<dd> + This value may only be returned if the second argument to the conflict + handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this + is not the case, any changes applied so far are rolled back and the + call to sqlite3changeset_apply() returns SQLITE_MISUSE.</p> + +<p> If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict + handler, then the conflicting row is either updated or deleted, depending + on the type of change.</p> + +<p> If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict + handler, then the conflicting row is removed from the database and a + second attempt to apply the change is made. If this second attempt fails, + the original row is restored to the database before continuing.</p> + +<p><dt>SQLITE_CHANGESET_ABORT<dd> + If this value is returned, any changes applied so far are rolled back + and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +</dl> +</p><hr><a name="SQLITE_CHANGESET_CONFLICT"></a> +<h2>Constants Passed To The Conflict Handler</h2><blockquote><pre>#define SQLITE_CHANGESET_DATA 1 +#define SQLITE_CHANGESET_NOTFOUND 2 +#define SQLITE_CHANGESET_CONFLICT 3 +#define SQLITE_CHANGESET_CONSTRAINT 4 +#define SQLITE_CHANGESET_FOREIGN_KEY 5 +</pre></blockquote><p> +Values that may be passed as the second argument to a conflict-handler.</p> + +<p><dl> +<dt>SQLITE_CHANGESET_DATA<dd> + The conflict handler is invoked with CHANGESET_DATA as the second argument + when processing a DELETE or UPDATE change if a row with the required + PRIMARY KEY fields is present in the database, but one or more other + (non primary-key) fields modified by the update do not contain the + expected "before" values.</p> + +<p> The conflicting row, in this case, is the database row with the matching + primary key.</p> + +<p><dt>SQLITE_CHANGESET_NOTFOUND<dd> + The conflict handler is invoked with CHANGESET_NOTFOUND as the second + argument when processing a DELETE or UPDATE change if a row with the + required PRIMARY KEY fields is not present in the database.</p> + +<p> There is no conflicting row in this case. The results of invoking the + sqlite3changeset_conflict() API are undefined.</p> + +<p><dt>SQLITE_CHANGESET_CONFLICT<dd> + CHANGESET_CONFLICT is passed as the second argument to the conflict + handler while processing an INSERT change if the operation would result + in duplicate primary key values.</p> + +<p> The conflicting row in this case is the database row with the matching + primary key.</p> + +<p><dt>SQLITE_CHANGESET_FOREIGN_KEY<dd> + If foreign key handling is enabled, and applying a changeset leaves the + database in a state containing foreign key violations, the conflict + handler is invoked with CHANGESET_FOREIGN_KEY as the second argument + exactly once before the changeset is committed. If the conflict handler + returns CHANGESET_OMIT, the changes, including those that caused the + foreign key constraint violation, are committed. Or, if it returns + CHANGESET_ABORT, the changeset is rolled back.</p> + +<p> No current or conflicting row information is provided. The only function + it is possible to call on the supplied sqlite3_changeset_iter handle + is sqlite3changeset_fk_conflicts().</p> + +<p><dt>SQLITE_CHANGESET_CONSTRAINT<dd> + If any other constraint violation occurs while applying a change (i.e. + a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is + invoked with CHANGESET_CONSTRAINT as the second argument.</p> + +<p> There is no conflicting row in this case. The results of invoking the + sqlite3changeset_conflict() API are undefined.</p> + +<p></dl> +</p><hr><a name="SQLITE_SESSION_OBJCONFIG_ROWID"></a> +<h2>Options for sqlite3session_object_config</h2><blockquote><pre>#define SQLITE_SESSION_OBJCONFIG_SIZE 1 +#define SQLITE_SESSION_OBJCONFIG_ROWID 2 +</pre></blockquote><p> +The following values may passed as the the 2nd parameter to +sqlite3session_object_config().</p> + +<p><dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd> + This option is used to set, clear or query the flag that enables + the <a href="#sqlite3session_changeset_size">sqlite3session_changeset_size()</a> API. Because it imposes some + computational overhead, this API is disabled by default. Argument + pArg must point to a value of type (int). If the value is initially + 0, then the sqlite3session_changeset_size() API is disabled. If it + is greater than 0, then the same API is enabled. Or, if the initial + value is less than zero, no change is made. In all cases the (int) + variable is set to 1 if the sqlite3session_changeset_size() API is + enabled following the current call, or 0 otherwise.</p> + +<p> It is an error (SQLITE_MISUSE) to attempt to modify this setting after + the first table has been attached to the session object.</p> + +<p><dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd> + This option is used to set, clear or query the flag that enables + collection of data for tables with no explicit PRIMARY KEY.</p> + +<p> Normally, tables with no explicit PRIMARY KEY are simply ignored + by the sessions module. However, if this flag is set, it behaves + as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted + as their leftmost columns.</p> + +<p> It is an error (SQLITE_MISUSE) to attempt to modify this setting after + the first table has been attached to the session object. +</p><hr><a name="sqlite3changegroup_add_strm"></a> +<h2>Streaming Versions of API functions.</h2><blockquote><pre>int sqlite3changeset_apply_strm( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ + void *pIn, /* First arg for xInput */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx /* First argument passed to xConflict */ +); +int sqlite3changeset_apply_v2_strm( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ + void *pIn, /* First arg for xInput */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx, /* First argument passed to xConflict */ + void **ppRebase, int *pnRebase, + int flags +); +int sqlite3changeset_concat_strm( + int (*xInputA)(void *pIn, void *pData, int *pnData), + void *pInA, + int (*xInputB)(void *pIn, void *pData, int *pnData), + void *pInB, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changeset_invert_strm( + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changeset_start_strm( + sqlite3_changeset_iter **pp, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn +); +int sqlite3changeset_start_v2_strm( + sqlite3_changeset_iter **pp, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int flags +); +int sqlite3session_changeset_strm( + sqlite3_session *pSession, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3session_patchset_strm( + sqlite3_session *pSession, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changegroup_add_strm(sqlite3_changegroup*, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn +); +int sqlite3changegroup_output_strm(sqlite3_changegroup*, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3rebaser_rebase_strm( + sqlite3_rebaser *pRebaser, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +</pre></blockquote><p> +The six streaming API xxx_strm() functions serve similar purposes to the +corresponding non-streaming API functions:</p> + +<p><table border=1 style="margin-left:8ex;margin-right:8ex"> + <tr><th>Streaming function<th>Non-streaming equivalent</th> + <tr><td>sqlite3changeset_apply_strm<td><a href="#sqlite3changeset_apply">sqlite3changeset_apply</a> + <tr><td>sqlite3changeset_apply_strm_v2<td><a href="#sqlite3changeset_apply">sqlite3changeset_apply_v2</a> + <tr><td>sqlite3changeset_concat_strm<td><a href="#sqlite3changeset_concat">sqlite3changeset_concat</a> + <tr><td>sqlite3changeset_invert_strm<td><a href="#sqlite3changeset_invert">sqlite3changeset_invert</a> + <tr><td>sqlite3changeset_start_strm<td><a href="#sqlite3changeset_start">sqlite3changeset_start</a> + <tr><td>sqlite3session_changeset_strm<td><a href="#sqlite3session_changeset">sqlite3session_changeset</a> + <tr><td>sqlite3session_patchset_strm<td><a href="#sqlite3session_patchset">sqlite3session_patchset</a> +</table></p> + +<p>Non-streaming functions that accept changesets (or patchsets) as input +require that the entire changeset be stored in a single buffer in memory. +Similarly, those that return a changeset or patchset do so by returning +a pointer to a single large buffer allocated using sqlite3_malloc(). +Normally this is convenient. However, if an application running in a +low-memory environment is required to handle very large changesets, the +large contiguous memory allocations required can become onerous.</p> + +<p>In order to avoid this problem, instead of a single large buffer, input +is passed to a streaming API functions by way of a callback function that +the sessions module invokes to incrementally request input data as it is +required. In all cases, a pair of API function parameters such as</p> + +<p> <pre> + int nChangeset, + void *pChangeset, + </pre></p> + +<p>Is replaced by:</p> + +<p> <pre> + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + </pre></p> + +<p>Each time the xInput callback is invoked by the sessions module, the first +argument passed is a copy of the supplied pIn context pointer. The second +argument, pData, points to a buffer (*pnData) bytes in size. Assuming no +error occurs the xInput method should copy up to (*pnData) bytes of data +into the buffer and set (*pnData) to the actual number of bytes copied +before returning SQLITE_OK. If the input is completely exhausted, (*pnData) +should be set to zero to indicate this. Or, if an error occurs, an SQLite +error code should be returned. In all cases, if an xInput callback returns +an error, all processing is abandoned and the streaming API function +returns a copy of the error code to the caller.</p> + +<p>In the case of sqlite3changeset_start_strm(), the xInput callback may be +invoked by the sessions module at any point during the lifetime of the +iterator. If such an xInput callback returns an error, the iterator enters +an error state, whereby all subsequent calls to iterator functions +immediately fail with the same error code as returned by xInput.</p> + +<p>Similarly, streaming API functions that return changesets (or patchsets) +return them in chunks by way of a callback function instead of via a +pointer to a single large buffer. In this case, a pair of parameters such +as:</p> + +<p> <pre> + int *pnChangeset, + void **ppChangeset, + </pre></p> + +<p>Is replaced by:</p> + +<p> <pre> + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut + </pre></p> + +<p>The xOutput callback is invoked zero or more times to return data to +the application. The first parameter passed to each call is a copy of the +pOut pointer supplied by the application. The second parameter, pData, +points to a buffer nData bytes in size containing the chunk of output +data being returned. If the xOutput callback successfully processes the +supplied data, it should return SQLITE_OK to indicate success. Otherwise, +it should return some other SQLite error code. In this case processing +is immediately abandoned and the streaming API function returns a copy +of the xOutput error code to the application.</p> + +<p>The sessions module never invokes an xOutput callback with the third +parameter set to a value less than or equal to zero. Other than this, +no guarantees are made as to the size of the chunks of data returned. +</p><hr><a name="sqlite3changeset_apply"></a> +<h2>Apply A Changeset To A Database</h2><blockquote><pre>int sqlite3changeset_apply( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void *pChangeset, /* Changeset blob */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx /* First argument passed to xConflict */ +); +int sqlite3changeset_apply_v2( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void *pChangeset, /* Changeset blob */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx, /* First argument passed to xConflict */ + void **ppRebase, int *pnRebase, /* OUT: Rebase data */ + int flags /* SESSION_CHANGESETAPPLY_* flags */ +); +</pre></blockquote><p> +Apply a changeset or patchset to a database. These functions attempt to +update the "main" database attached to handle db with the changes found in +the changeset passed via the second and third arguments. </p> + +<p>The fourth argument (xFilter) passed to these functions is the "filter +callback". If it is not NULL, then for each table affected by at least one +change in the changeset, the filter callback is invoked with +the table name as the second argument, and a copy of the context pointer +passed as the sixth argument as the first. If the "filter callback" +returns zero, then no attempt is made to apply any changes to the table. +Otherwise, if the return value is non-zero or the xFilter argument to +is NULL, all changes related to the table are attempted.</p> + +<p>For each table that is not excluded by the filter callback, this function +tests that the target database contains a compatible table. A table is +considered compatible if all of the following are true:</p> + +<p><ul> + <li> The table has the same name as the name recorded in the + changeset, and + <li> The table has at least as many columns as recorded in the + changeset, and + <li> The table has primary key columns in the same position as + recorded in the changeset. +</ul></p> + +<p>If there is no compatible table, it is not an error, but none of the +changes associated with the table are applied. A warning message is issued +via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +one such warning is issued for each table in the changeset.</p> + +<p>For each change for which there is a compatible table, an attempt is made +to modify the table contents according to the UPDATE, INSERT or DELETE +change. If a change cannot be applied cleanly, the conflict handler +function passed as the fifth argument to sqlite3changeset_apply() may be +invoked. A description of exactly when the conflict handler is invoked for +each type of change is below.</p> + +<p>Unlike the xFilter argument, xConflict may not be passed NULL. The results +of passing anything other than a valid function pointer as the xConflict +argument are undefined.</p> + +<p>Each time the conflict handler function is invoked, it must return one +of <a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_OMIT</a>, <a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_ABORT</a> or +<a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_REPLACE</a>. SQLITE_CHANGESET_REPLACE may only be returned +if the second argument passed to the conflict handler is either +SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler +returns an illegal value, any changes already made are rolled back and +the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different +actions are taken by sqlite3changeset_apply() depending on the value +returned by each invocation of the conflict-handler function. Refer to +the documentation for the three +<a href="#SQLITE_CHANGESET_ABORT">available return values</a> for details.</p> + +<p><dl> +<dt>DELETE Changes<dd> + For each DELETE change, the function checks if the target database + contains a row with the same primary key value (or values) as the + original row values stored in the changeset. If it does, and the values + stored in all non-primary key columns also match the values stored in + the changeset the row is deleted from the target database.</p> + +<p> If a row with matching primary key values is found, but one or more of + the non-primary key fields contains a value different from the original + row value stored in the changeset, the conflict-handler function is + invoked with <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_DATA</a> as the second argument. If the + database table has more columns than are recorded in the changeset, + only the values of those non-primary key fields are compared against + the current database contents - any trailing database table columns + are ignored.</p> + +<p> If no row with matching primary key values is found in the database, + the conflict-handler function is invoked with <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_NOTFOUND</a> + passed as the second argument.</p> + +<p> If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT + (which can only happen if a foreign key constraint is violated), the + conflict-handler function is invoked with <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_CONSTRAINT</a> + passed as the second argument. This includes the case where the DELETE + operation is attempted because an earlier call to the conflict handler + function returned <a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_REPLACE</a>.</p> + +<p><dt>INSERT Changes<dd> + For each INSERT change, an attempt is made to insert the new row into + the database. If the changeset row contains fewer fields than the + database table, the trailing fields are populated with their default + values.</p> + +<p> If the attempt to insert the row fails because the database already + contains a row with the same primary key values, the conflict handler + function is invoked with the second argument set to + <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_CONFLICT</a>.</p> + +<p> If the attempt to insert the row fails because of some other constraint + violation (e.g. NOT NULL or UNIQUE), the conflict handler function is + invoked with the second argument set to <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_CONSTRAINT</a>. + This includes the case where the INSERT operation is re-attempted because + an earlier call to the conflict handler function returned + <a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_REPLACE</a>.</p> + +<p><dt>UPDATE Changes<dd> + For each UPDATE change, the function checks if the target database + contains a row with the same primary key value (or values) as the + original row values stored in the changeset. If it does, and the values + stored in all modified non-primary key columns also match the values + stored in the changeset the row is updated within the target database.</p> + +<p> If a row with matching primary key values is found, but one or more of + the modified non-primary key fields contains a value different from an + original row value stored in the changeset, the conflict-handler function + is invoked with <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_DATA</a> as the second argument. Since + UPDATE changes only contain values for non-primary key fields that are + to be modified, only those fields need to match the original values to + avoid the SQLITE_CHANGESET_DATA conflict-handler callback.</p> + +<p> If no row with matching primary key values is found in the database, + the conflict-handler function is invoked with <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_NOTFOUND</a> + passed as the second argument.</p> + +<p> If the UPDATE operation is attempted, but SQLite returns + SQLITE_CONSTRAINT, the conflict-handler function is invoked with + <a href="#SQLITE_CHANGESET_CONFLICT">SQLITE_CHANGESET_CONSTRAINT</a> passed as the second argument. + This includes the case where the UPDATE operation is attempted after + an earlier call to the conflict handler function returned + <a href="#SQLITE_CHANGESET_ABORT">SQLITE_CHANGESET_REPLACE</a>. +</dl></p> + +<p>It is safe to execute SQL statements, including those that write to the +table that the callback related to, from within the xConflict callback. +This can be used to further customize the application's conflict +resolution strategy.</p> + +<p>All changes made by these functions are enclosed in a savepoint transaction. +If any other error (aside from a constraint failure when attempting to +write to the target database) occurs, then the savepoint transaction is +rolled back, restoring the target database to its original state, and an +SQLite error code returned.</p> + +<p>If the output parameters (ppRebase) and (pnRebase) are non-NULL and +the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +may set (*ppRebase) to point to a "rebase" that may be used with the +sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +is set to the size of the buffer in bytes. It is the responsibility of the +caller to eventually free any such buffer using sqlite3_free(). The buffer +is only allocated and populated if one or more conflicts were encountered +while applying the patchset. See comments surrounding the sqlite3_rebaser +APIs for further details.</p> + +<p>The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +may be modified by passing a combination of +<a href="#SQLITE_CHANGESETAPPLY_FKNOACTION">supported flags</a> as the 9th parameter.</p> + +<p>Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b> +and therefore subject to change. +</p><hr><a name="sqlite3changeset_start"></a> +<h2>Create An Iterator To Traverse A Changeset </h2><blockquote><pre>int sqlite3changeset_start( + sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ + int nChangeset, /* Size of changeset blob in bytes */ + void *pChangeset /* Pointer to blob containing changeset */ +); +int sqlite3changeset_start_v2( + sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ + int nChangeset, /* Size of changeset blob in bytes */ + void *pChangeset, /* Pointer to blob containing changeset */ + int flags /* SESSION_CHANGESETSTART_* flags */ +); +</pre></blockquote><p> +Create an iterator used to iterate through the contents of a changeset. +If successful, *pp is set to point to the iterator handle and SQLITE_OK +is returned. Otherwise, if an error occurs, *pp is set to zero and an +SQLite error code is returned.</p> + +<p>The following functions can be used to advance and query a changeset +iterator created by this function:</p> + +<p><ul> + <li> <a href="#sqlite3changeset_next">sqlite3changeset_next()</a> + <li> <a href="#sqlite3changeset_op">sqlite3changeset_op()</a> + <li> <a href="#sqlite3changeset_new">sqlite3changeset_new()</a> + <li> <a href="#sqlite3changeset_old">sqlite3changeset_old()</a> +</ul></p> + +<p>It is the responsibility of the caller to eventually destroy the iterator +by passing it to <a href="#sqlite3changeset_finalize">sqlite3changeset_finalize()</a>. The buffer containing the +changeset (pChangeset) must remain valid until after the iterator is +destroyed.</p> + +<p>Assuming the changeset blob was created by one of the +<a href="#sqlite3session_changeset">sqlite3session_changeset()</a>, <a href="#sqlite3changeset_concat">sqlite3changeset_concat()</a> or +<a href="#sqlite3changeset_invert">sqlite3changeset_invert()</a> functions, all changes within the changeset +that apply to a single table are grouped together. This means that when +an application iterates through a changeset using an iterator created by +this function, all changes that relate to a single table are visited +consecutively. There is no chance that the iterator will visit a change +the applies to table X, then one for table Y, and then later on visit +another change for table X.</p> + +<p>The behavior of sqlite3changeset_start_v2() and its streaming equivalent +may be modified by passing a combination of +<a href="#SQLITE_CHANGESETSTART_INVERT">supported flags</a> as the 4th parameter.</p> + +<p>Note that the sqlite3changeset_start_v2() API is still <b>experimental</b> +and therefore subject to change. +</p><hr> + + diff --git a/www/session/c_changeset_abort.html b/www/session/c_changeset_abort.html new file mode 100644 index 0000000..69ad8c3 --- /dev/null +++ b/www/session/c_changeset_abort.html @@ -0,0 +1,153 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Constants Returned By The Conflict Handler</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Constants Returned By The Conflict Handler</h2><blockquote><pre>#define SQLITE_CHANGESET_OMIT 0 +#define SQLITE_CHANGESET_REPLACE 1 +#define SQLITE_CHANGESET_ABORT 2 +</pre></blockquote><p> +A conflict handler callback must return one of the following three values.</p> + +<p><dl> +<dt>SQLITE_CHANGESET_OMIT<dd> + If a conflict handler returns this value no special action is taken. The + change that caused the conflict is not applied. The session module + continues to the next change in the changeset.</p> + +<p><dt>SQLITE_CHANGESET_REPLACE<dd> + This value may only be returned if the second argument to the conflict + handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this + is not the case, any changes applied so far are rolled back and the + call to sqlite3changeset_apply() returns SQLITE_MISUSE.</p> + +<p> If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict + handler, then the conflicting row is either updated or deleted, depending + on the type of change.</p> + +<p> If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict + handler, then the conflicting row is removed from the database and a + second attempt to apply the change is made. If this second attempt fails, + the original row is restored to the database before continuing.</p> + +<p><dt>SQLITE_CHANGESET_ABORT<dd> + If this value is returned, any changes applied so far are rolled back + and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +</dl> +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/c_changeset_conflict.html b/www/session/c_changeset_conflict.html new file mode 100644 index 0000000..b3a12bd --- /dev/null +++ b/www/session/c_changeset_conflict.html @@ -0,0 +1,179 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Constants Passed To The Conflict Handler</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Constants Passed To The Conflict Handler</h2><blockquote><pre>#define SQLITE_CHANGESET_DATA 1 +#define SQLITE_CHANGESET_NOTFOUND 2 +#define SQLITE_CHANGESET_CONFLICT 3 +#define SQLITE_CHANGESET_CONSTRAINT 4 +#define SQLITE_CHANGESET_FOREIGN_KEY 5 +</pre></blockquote><p> +Values that may be passed as the second argument to a conflict-handler.</p> + +<p><dl> +<dt>SQLITE_CHANGESET_DATA<dd> + The conflict handler is invoked with CHANGESET_DATA as the second argument + when processing a DELETE or UPDATE change if a row with the required + PRIMARY KEY fields is present in the database, but one or more other + (non primary-key) fields modified by the update do not contain the + expected "before" values.</p> + +<p> The conflicting row, in this case, is the database row with the matching + primary key.</p> + +<p><dt>SQLITE_CHANGESET_NOTFOUND<dd> + The conflict handler is invoked with CHANGESET_NOTFOUND as the second + argument when processing a DELETE or UPDATE change if a row with the + required PRIMARY KEY fields is not present in the database.</p> + +<p> There is no conflicting row in this case. The results of invoking the + sqlite3changeset_conflict() API are undefined.</p> + +<p><dt>SQLITE_CHANGESET_CONFLICT<dd> + CHANGESET_CONFLICT is passed as the second argument to the conflict + handler while processing an INSERT change if the operation would result + in duplicate primary key values.</p> + +<p> The conflicting row in this case is the database row with the matching + primary key.</p> + +<p><dt>SQLITE_CHANGESET_FOREIGN_KEY<dd> + If foreign key handling is enabled, and applying a changeset leaves the + database in a state containing foreign key violations, the conflict + handler is invoked with CHANGESET_FOREIGN_KEY as the second argument + exactly once before the changeset is committed. If the conflict handler + returns CHANGESET_OMIT, the changes, including those that caused the + foreign key constraint violation, are committed. Or, if it returns + CHANGESET_ABORT, the changeset is rolled back.</p> + +<p> No current or conflicting row information is provided. The only function + it is possible to call on the supplied sqlite3_changeset_iter handle + is sqlite3changeset_fk_conflicts().</p> + +<p><dt>SQLITE_CHANGESET_CONSTRAINT<dd> + If any other constraint violation occurs while applying a change (i.e. + a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is + invoked with CHANGESET_CONSTRAINT as the second argument.</p> + +<p> There is no conflicting row in this case. The results of invoking the + sqlite3changeset_conflict() API are undefined.</p> + +<p></dl> +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/c_changesetapply_fknoaction.html b/www/session/c_changesetapply_fknoaction.html new file mode 100644 index 0000000..779c6e4 --- /dev/null +++ b/www/session/c_changesetapply_fknoaction.html @@ -0,0 +1,163 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Flags for sqlite3changeset_apply_v2</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Flags for sqlite3changeset_apply_v2</h2><blockquote><pre>#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 +#define SQLITE_CHANGESETAPPLY_INVERT 0x0002 +#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 +#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 +</pre></blockquote><p> +The following flags may passed via the 9th parameter to +<a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply_v2</a> and <a href="../session/sqlite3changegroup_add_strm.html">sqlite3changeset_apply_v2_strm</a>:</p> + +<p><dl> +<dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd> + Usually, the sessions module encloses all operations performed by + a single call to apply_v2() or apply_v2_strm() in a <a href="../lang_savepoint.html">SAVEPOINT</a>. The + SAVEPOINT is committed if the changeset or patchset is successfully + applied, or rolled back if an error occurs. Specifying this flag + causes the sessions module to omit this savepoint. In this case, if the + caller has an open transaction or savepoint when apply_v2() is called, + it may revert the partially applied changeset by rolling it back.</p> + +<p><dt>SQLITE_CHANGESETAPPLY_INVERT <dd> + Invert the changeset before applying it. This is equivalent to inverting + a changeset using sqlite3changeset_invert() before applying it. It is + an error to specify this flag with a patchset.</p> + +<p><dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd> + Do not invoke the conflict handler callback for any changes that + would not actually modify the database even if they were applied. + Specifically, this means that the conflict handler is not invoked + for: + <ul> + <li>a delete change if the row being deleted cannot be found, + <li>an update change if the modified fields are already set to + their new values in the conflicting row, or + <li>an insert change if all fields of the conflicting row match + the row being inserted. + </ul></p> + +<p><dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd> + If this flag it set, then all foreign key constraints in the target + database behave as if they were declared with "ON UPDATE NO ACTION ON + DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL + or SET DEFAULT. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/c_changesetstart_invert.html b/www/session/c_changesetstart_invert.html new file mode 100644 index 0000000..fb95365 --- /dev/null +++ b/www/session/c_changesetstart_invert.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Flags for sqlite3changeset_start_v2</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Flags for sqlite3changeset_start_v2</h2><blockquote><pre>#define SQLITE_CHANGESETSTART_INVERT 0x0002 +</pre></blockquote><p> +The following flags may passed via the 4th parameter to +<a href="../session/sqlite3changeset_start.html">sqlite3changeset_start_v2</a> and <a href="../session/sqlite3changegroup_add_strm.html">sqlite3changeset_start_v2_strm</a>:</p> + +<p><dt>SQLITE_CHANGESETAPPLY_INVERT <dd> + Invert the changeset while iterating through it. This is equivalent to + inverting a changeset using sqlite3changeset_invert() before applying it. + It is an error to specify this flag with a patchset. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/c_session_config_strmsize.html b/www/session/c_session_config_strmsize.html new file mode 100644 index 0000000..84cbf8b --- /dev/null +++ b/www/session/c_session_config_strmsize.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Values for sqlite3session_config().</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Values for sqlite3session_config().</h2><blockquote><pre>#define SQLITE_SESSION_CONFIG_STRMSIZE 1 +</pre></blockquote><p></p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/c_session_objconfig_rowid.html b/www/session/c_session_objconfig_rowid.html new file mode 100644 index 0000000..97ad39b --- /dev/null +++ b/www/session/c_session_objconfig_rowid.html @@ -0,0 +1,153 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Options for sqlite3session_object_config</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Options for sqlite3session_object_config</h2><blockquote><pre>#define SQLITE_SESSION_OBJCONFIG_SIZE 1 +#define SQLITE_SESSION_OBJCONFIG_ROWID 2 +</pre></blockquote><p> +The following values may passed as the the 2nd parameter to +sqlite3session_object_config().</p> + +<p><dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd> + This option is used to set, clear or query the flag that enables + the <a href="../session/sqlite3session_changeset_size.html">sqlite3session_changeset_size()</a> API. Because it imposes some + computational overhead, this API is disabled by default. Argument + pArg must point to a value of type (int). If the value is initially + 0, then the sqlite3session_changeset_size() API is disabled. If it + is greater than 0, then the same API is enabled. Or, if the initial + value is less than zero, no change is made. In all cases the (int) + variable is set to 1 if the sqlite3session_changeset_size() API is + enabled following the current call, or 0 otherwise.</p> + +<p> It is an error (SQLITE_MISUSE) to attempt to modify this setting after + the first table has been attached to the session object.</p> + +<p><dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd> + This option is used to set, clear or query the flag that enables + collection of data for tables with no explicit PRIMARY KEY.</p> + +<p> Normally, tables with no explicit PRIMARY KEY are simply ignored + by the sessions module. However, if this flag is set, it behaves + as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted + as their leftmost columns.</p> + +<p> It is an error (SQLITE_MISUSE) to attempt to modify this setting after + the first table has been attached to the session object. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/changegroup.html b/www/session/changegroup.html new file mode 100644 index 0000000..e1cc234 --- /dev/null +++ b/www/session/changegroup.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Changegroup Handle</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Changegroup Handle</h2><blockquote><pre>typedef struct sqlite3_changegroup sqlite3_changegroup; +</pre></blockquote><p> +A changegroup is an object used to combine two or more +<a href="../sessionintro.html#changeset">changesets</a> or <a href="../sessionintro.html#changeset">patchsets</a> +</p><p>Constructor: <a href="../session/sqlite3changegroup_new.html">sqlite3changegroup_new()</a></p> +<p>Destructor: <a href="../session/sqlite3changegroup_delete.html">sqlite3changegroup_delete()</a></p> +<p>Methods: + <a href="../session/sqlite3changegroup_add.html">sqlite3changegroup_add()</a>, +<a href="../session/sqlite3changegroup_output.html">sqlite3changegroup_output()</a></p> +<p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/changeset_iter.html b/www/session/changeset_iter.html new file mode 100644 index 0000000..08ff3d3 --- /dev/null +++ b/www/session/changeset_iter.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Changeset Iterator Handle</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Changeset Iterator Handle</h2><blockquote><pre>typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; +</pre></blockquote><p> +An instance of this object acts as a cursor for iterating +over the elements of a <a href="../sessionintro.html#changeset">changeset</a> or <a href="../sessionintro.html#changeset">patchset</a>. +</p><p>Constructors: + <a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>, +<a href="../session/sqlite3changeset_start.html">sqlite3changeset_start_v2()</a></p> +<div class='columns' style='columns: 17em auto;'> +<ul style='padding-top:0;'> +<li><a href='../session/sqlite3changeset_conflict.html'>sqlite3changeset_conflict</a></li> +<li><a href='../session/sqlite3changeset_finalize.html'>sqlite3changeset_finalize</a></li> +<li><a href='../session/sqlite3changeset_fk_conflicts.html'>sqlite3changeset_fk_conflicts</a></li> +<li><a href='../session/sqlite3changeset_new.html'>sqlite3changeset_new</a></li> +<li><a href='../session/sqlite3changeset_next.html'>sqlite3changeset_next</a></li> +<li><a href='../session/sqlite3changeset_old.html'>sqlite3changeset_old</a></li> +<li><a href='../session/sqlite3changeset_op.html'>sqlite3changeset_op</a></li> +<li><a href='../session/sqlite3changeset_pk.html'>sqlite3changeset_pk</a></li> +</ul> +</div> +</p> +<p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/constlist.html b/www/session/constlist.html new file mode 100644 index 0000000..f9f0ab6 --- /dev/null +++ b/www/session/constlist.html @@ -0,0 +1,145 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>List Of SQLite Constants</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a> + +<h2>Constants:</h2> +<div class='columns' style='columns: 20em auto;'> +<ul style='padding-top:0;'> +<li><a href='../session/c_changesetapply_fknoaction.html'>SQLITE_CHANGESETAPPLY_FKNOACTION</a></li> +<li><a href='../session/c_changesetapply_fknoaction.html'>SQLITE_CHANGESETAPPLY_IGNORENOOP</a></li> +<li><a href='../session/c_changesetapply_fknoaction.html'>SQLITE_CHANGESETAPPLY_INVERT</a></li> +<li><a href='../session/c_changesetapply_fknoaction.html'>SQLITE_CHANGESETAPPLY_NOSAVEPOINT</a></li> +<li><a href='../session/c_changesetstart_invert.html'>SQLITE_CHANGESETSTART_INVERT</a></li> +<li><a href='../session/c_changeset_abort.html'>SQLITE_CHANGESET_ABORT</a></li> +<li><a href='../session/c_changeset_conflict.html'>SQLITE_CHANGESET_CONFLICT</a></li> +<li><a href='../session/c_changeset_conflict.html'>SQLITE_CHANGESET_CONSTRAINT</a></li> +<li><a href='../session/c_changeset_conflict.html'>SQLITE_CHANGESET_DATA</a></li> +<li><a href='../session/c_changeset_conflict.html'>SQLITE_CHANGESET_FOREIGN_KEY</a></li> +<li><a href='../session/c_changeset_conflict.html'>SQLITE_CHANGESET_NOTFOUND</a></li> +<li><a href='../session/c_changeset_abort.html'>SQLITE_CHANGESET_OMIT</a></li> +<li><a href='../session/c_changeset_abort.html'>SQLITE_CHANGESET_REPLACE</a></li> +<li><a href='../session/c_session_config_strmsize.html'>SQLITE_SESSION_CONFIG_STRMSIZE</a></li> +<li><a href='../session/c_session_objconfig_rowid.html'>SQLITE_SESSION_OBJCONFIG_ROWID</a></li> +<li><a href='../session/c_session_objconfig_rowid.html'>SQLITE_SESSION_OBJCONFIG_SIZE</a></li> +</ul> +</div> +<p>Other lists: +<a href="../session/objlist.html">Objects</a> and +<a href="../session/funclist.html">Functions</a>.</p> + + diff --git a/www/session/funclist.html b/www/session/funclist.html new file mode 100644 index 0000000..4bae3fa --- /dev/null +++ b/www/session/funclist.html @@ -0,0 +1,178 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>List Of SQLite Functions</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a> + +<h2>Functions:</h2> +<div class='columns' style='columns: 15em auto;'> +<ul style='padding-top:0;'> +<li><a href='../session/sqlite3changegroup_add.html'>sqlite3changegroup_add</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changegroup_add_strm</a></li> +<li><a href='../session/sqlite3changegroup_delete.html'>sqlite3changegroup_delete</a></li> +<li><a href='../session/sqlite3changegroup_new.html'>sqlite3changegroup_new</a></li> +<li><a href='../session/sqlite3changegroup_output.html'>sqlite3changegroup_output</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changegroup_output_strm</a></li> +<li><a href='../session/sqlite3changegroup_schema.html'>sqlite3changegroup_schema</a></li> +<li><a href='../session/sqlite3changeset_apply.html'>sqlite3changeset_apply</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_apply_strm</a></li> +<li><a href='../session/sqlite3changeset_apply.html'>sqlite3changeset_apply_v2</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_apply_v2_strm</a></li> +<li><a href='../session/sqlite3changeset_concat.html'>sqlite3changeset_concat</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_concat_strm</a></li> +<li><a href='../session/sqlite3changeset_conflict.html'>sqlite3changeset_conflict</a></li> +<li><a href='../session/sqlite3changeset_finalize.html'>sqlite3changeset_finalize</a></li> +<li><a href='../session/sqlite3changeset_fk_conflicts.html'>sqlite3changeset_fk_conflicts</a></li> +<li><a href='../session/sqlite3changeset_invert.html'>sqlite3changeset_invert</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_invert_strm</a></li> +<li><a href='../session/sqlite3changeset_new.html'>sqlite3changeset_new</a></li> +<li><a href='../session/sqlite3changeset_next.html'>sqlite3changeset_next</a></li> +<li><a href='../session/sqlite3changeset_old.html'>sqlite3changeset_old</a></li> +<li><a href='../session/sqlite3changeset_op.html'>sqlite3changeset_op</a></li> +<li><a href='../session/sqlite3changeset_pk.html'>sqlite3changeset_pk</a></li> +<li><a href='../session/sqlite3changeset_start.html'>sqlite3changeset_start</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_start_strm</a></li> +<li><a href='../session/sqlite3changeset_start.html'>sqlite3changeset_start_v2</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3changeset_start_v2_strm</a></li> +<li><a href='../session/sqlite3changeset_upgrade.html'>sqlite3changeset_upgrade</a></li> +<li><a href='../session/sqlite3rebaser_configure.html'>sqlite3rebaser_configure<small><i>(exp)</i></small></a></li> +<li><a href='../session/sqlite3rebaser_create.html'>sqlite3rebaser_create<small><i>(exp)</i></small></a></li> +<li><a href='../session/sqlite3rebaser_delete.html'>sqlite3rebaser_delete<small><i>(exp)</i></small></a></li> +<li><a href='../session/sqlite3rebaser_rebase.html'>sqlite3rebaser_rebase<small><i>(exp)</i></small></a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3rebaser_rebase_strm</a></li> +<li><a href='../session/sqlite3session_attach.html'>sqlite3session_attach</a></li> +<li><a href='../session/sqlite3session_changeset.html'>sqlite3session_changeset</a></li> +<li><a href='../session/sqlite3session_changeset_size.html'>sqlite3session_changeset_size</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3session_changeset_strm</a></li> +<li><a href='../session/sqlite3session_config.html'>sqlite3session_config</a></li> +<li><a href='../session/sqlite3session_create.html'>sqlite3session_create</a></li> +<li><a href='../session/sqlite3session_delete.html'>sqlite3session_delete</a></li> +<li><a href='../session/sqlite3session_diff.html'>sqlite3session_diff</a></li> +<li><a href='../session/sqlite3session_enable.html'>sqlite3session_enable</a></li> +<li><a href='../session/sqlite3session_indirect.html'>sqlite3session_indirect</a></li> +<li><a href='../session/sqlite3session_isempty.html'>sqlite3session_isempty</a></li> +<li><a href='../session/sqlite3session_memory_used.html'>sqlite3session_memory_used</a></li> +<li><a href='../session/sqlite3session_object_config.html'>sqlite3session_object_config</a></li> +<li><a href='../session/sqlite3session_patchset.html'>sqlite3session_patchset</a></li> +<li><a href='../session/sqlite3changegroup_add_strm.html'>sqlite3session_patchset_strm</a></li> +<li><a href='../session/sqlite3session_table_filter.html'>sqlite3session_table_filter</a></li> +</ul> +</div> +<p>Other lists: +<a href="../session/constlist.html">Constants</a> and +<a href="../session/objlist.html">Objects</a>.</p> + + diff --git a/www/session/intro.html b/www/session/intro.html new file mode 100644 index 0000000..a46388b --- /dev/null +++ b/www/session/intro.html @@ -0,0 +1,154 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Introduction</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> + + +<p>These pages define the C-language interface for the SQLite +<a href="../sessionintro.html">session extension</a>. +This is not a tutorial. These pages are designed to be precise, not +easy to read. A tutorial is <a href="../sessionintro.html">available separately</a>. + +<p>This version of the C-language interface reference is +broken down into small pages for easy viewing. The +same content is also available as a +<a href="../session.html">single large HTML file</a> +for those who prefer that format.</p> + +<p>The content on these pages is extracted from comments +in the source code.</p> + +<p>The interface is broken down into three categories:</p> + +<ol> +<li><p><a href="../session/objlist.html"><b>List Of Objects.</b></a> + This is a list of the three abstract objects used by the SQLite session + module. + +<li><p><a href="../session/constlist.html"><b>List Of Constants.</b></a> + This is a list of numeric constants used by the SQLite session module + and represented by #defines in the sqlite3session.h header file. There + are constants passed to conflict handler callbacks to indicate the type + of conflict, and constants returned by the conflict handler to indicate + how the conflict should be resolved. + +<li><p><a href="../session/funclist.html"><b>List Of Functions.</b></a> + This is a list of all SQLite session module functions. + +</ol> + + + diff --git a/www/session/objlist.html b/www/session/objlist.html new file mode 100644 index 0000000..447cbf6 --- /dev/null +++ b/www/session/objlist.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>List Of SQLite Objects</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a> + +<h2>Objects:</h2> +<div class='columns' style='columns: 15em auto;'> +<ul style='padding-top:0;'> +<li><a href='../session/changegroup.html'>sqlite3_changegroup</a></li> +<li><a href='../session/changeset_iter.html'>sqlite3_changeset_iter</a></li> +<li><a href='../session/rebaser.html'>sqlite3_rebaser<small><i>(exp)</i></small></a></li> +<li><a href='../session/session.html'>sqlite3_session</a></li> +</ul> +</div> +<p>Other lists: +<a href="../session/constlist.html">Constants</a> and +<a href="../session/funclist.html">Functions</a>. + + diff --git a/www/session/rebaser.html b/www/session/rebaser.html new file mode 100644 index 0000000..f9751f4 --- /dev/null +++ b/www/session/rebaser.html @@ -0,0 +1,217 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Rebasing changesets</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Rebasing changesets</h2><blockquote><pre>typedef struct sqlite3_rebaser sqlite3_rebaser; +</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Suppose there is a site hosting a database in state S0. And that +modifications are made that move that database to state S1 and a +changeset recorded (the "local" changeset). Then, a changeset based +on S0 is received from another site (the "remote" changeset) and +applied to the database. The database is then in state +(S1+"remote"), where the exact state depends on any conflict +resolution decisions (OMIT or REPLACE) made while applying "remote". +Rebasing a changeset is to update it to take those conflict +resolution decisions into account, so that the same conflicts +do not have to be resolved elsewhere in the network. </p> + +<p>For example, if both the local and remote changesets contain an +INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":</p> + +<p> local: INSERT INTO t1 VALUES(1, 'v1'); + remote: INSERT INTO t1 VALUES(1, 'v2');</p> + +<p>and the conflict resolution is REPLACE, then the INSERT change is +removed from the local changeset (it was overridden). Or, if the +conflict resolution was "OMIT", then the local changeset is modified +to instead contain:</p> + +<p> UPDATE t1 SET b = 'v2' WHERE a=1;</p> + +<p>Changes within the local changeset are rebased as follows:</p> + +<p><dl> +<dt>Local INSERT<dd> + This may only conflict with a remote INSERT. If the conflict + resolution was OMIT, then add an UPDATE change to the rebased + changeset. Or, if the conflict resolution was REPLACE, add + nothing to the rebased changeset.</p> + +<p><dt>Local DELETE<dd> + This may conflict with a remote UPDATE or DELETE. In both cases the + only possible resolution is OMIT. If the remote operation was a + DELETE, then add no change to the rebased changeset. If the remote + operation was an UPDATE, then the old.* fields of change are updated + to reflect the new.* values in the UPDATE.</p> + +<p><dt>Local UPDATE<dd> + This may conflict with a remote UPDATE or DELETE. If it conflicts + with a DELETE, and the conflict resolution was OMIT, then the update + is changed into an INSERT. Any undefined values in the new.* record + from the update change are filled in using the old.* values from + the conflicting DELETE. Or, if the conflict resolution was REPLACE, + the UPDATE change is simply omitted from the rebased changeset.</p> + +<p> If conflict is with a remote UPDATE and the resolution is OMIT, then + the old.* values are rebased using the new.* values in the remote + change. Or, if the resolution is REPLACE, then the change is copied + into the rebased changeset with updates to columns also updated by + the conflicting remote UPDATE removed. If this means no columns would + be updated, the change is omitted. +</dl></p> + +<p>A local change may be rebased against multiple remote changes +simultaneously. If a single key is modified by multiple remote +changesets, they are combined as follows before the local changeset +is rebased:</p> + +<p><ul> + <li> If there has been one or more REPLACE resolutions on a + key, it is rebased according to a REPLACE.</p> + +<p> <li> If there have been no REPLACE resolutions on a key, then + the local changeset is rebased according to the most recent + of the OMIT resolutions. +</ul></p> + +<p>Note that conflict resolutions from multiple remote changesets are +combined on a per-field basis, not per-row. This means that in the +case of multiple remote UPDATE operations, some fields of a single +local change may be rebased for REPLACE while others are rebased for +OMIT.</p> + +<p>In order to rebase a local changeset, the remote changeset must first +be applied to the local database using sqlite3changeset_apply_v2() and +the buffer of rebase information captured. Then:</p> + +<p><ol> + <li> An sqlite3_rebaser object is created by calling + sqlite3rebaser_create(). + <li> The new object is configured with the rebase buffer obtained from + sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). + If the local changeset is to be rebased against multiple remote + changesets, then sqlite3rebaser_configure() should be called + multiple times, in the same order that the multiple + sqlite3changeset_apply_v2() calls were made. + <li> Each local changeset is rebased by calling sqlite3rebaser_rebase(). + <li> The sqlite3_rebaser object is deleted by calling + sqlite3rebaser_delete(). +</ol> +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/session.html b/www/session/session.html new file mode 100644 index 0000000..f0b78ce --- /dev/null +++ b/www/session/session.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Session Object Handle</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Session Object Handle</h2><blockquote><pre>typedef struct sqlite3_session sqlite3_session; +</pre></blockquote><p> +An instance of this object is a <a href="../sessionintro.html">session</a> that can be used to +record changes to a database. +</p><p>Constructor: <a href="../session/sqlite3session_create.html">sqlite3session_create()</a></p> +<p>Destructor: <a href="../session/sqlite3session_delete.html">sqlite3session_delete()</a></p> +<div class='columns' style='columns: 17em auto;'> +<ul style='padding-top:0;'> +<li><a href='../session/sqlite3session_attach.html'>sqlite3session_attach</a></li> +<li><a href='../session/sqlite3session_changeset.html'>sqlite3session_changeset</a></li> +<li><a href='../session/sqlite3session_changeset_size.html'>sqlite3session_changeset_size</a></li> +<li><a href='../session/sqlite3session_diff.html'>sqlite3session_diff</a></li> +<li><a href='../session/sqlite3session_enable.html'>sqlite3session_enable</a></li> +<li><a href='../session/sqlite3session_indirect.html'>sqlite3session_indirect</a></li> +<li><a href='../session/sqlite3session_object_config.html'>sqlite3session_object_config</a></li> +<li><a href='../session/sqlite3session_patchset.html'>sqlite3session_patchset</a></li> +<li><a href='../session/sqlite3session_table_filter.html'>sqlite3session_table_filter</a></li> +</ul> +</div> +</p> +<p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_add.html b/www/session/sqlite3changegroup_add.html new file mode 100644 index 0000000..99de188 --- /dev/null +++ b/www/session/sqlite3changegroup_add.html @@ -0,0 +1,200 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Add A Changeset To A Changegroup</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Add A Changeset To A Changegroup</h2><blockquote><pre>int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +</pre></blockquote><p> +Add all changes within the changeset (or patchset) in buffer pData (size +nData bytes) to the changegroup. </p> + +<p>If the buffer contains a patchset, then all prior calls to this function +on the same changegroup object must also have specified patchsets. Or, if +the buffer contains a changeset, so must have the earlier calls to this +function. Otherwise, SQLITE_ERROR is returned and no changes are added +to the changegroup.</p> + +<p>Rows within the changeset and changegroup are identified by the values in +their PRIMARY KEY columns. A change in the changeset is considered to +apply to the same row as a change already present in the changegroup if +the two rows have the same primary key.</p> + +<p>Changes to rows that do not already appear in the changegroup are +simply copied into it. Or, if both the new changeset and the changegroup +contain changes that apply to a single row, the final contents of the +changegroup depends on the type of each change, as follows:</p> + +<p><table border=1 style="margin-left:8ex;margin-right:8ex"> + <tr><th style="white-space:pre">Existing Change </th> + <th style="white-space:pre">New Change </th> + <th>Output Change + <tr><td>INSERT <td>INSERT <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>INSERT <td>UPDATE <td> + The INSERT change remains in the changegroup. The values in the + INSERT change are modified as if the row was inserted by the + existing change and then updated according to the new change. + <tr><td>INSERT <td>DELETE <td> + The existing INSERT is removed from the changegroup. The DELETE is + not added. + <tr><td>UPDATE <td>INSERT <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>UPDATE <td>UPDATE <td> + The existing UPDATE remains within the changegroup. It is amended + so that the accompanying values are as if the row was updated once + by the existing change and then again by the new change. + <tr><td>UPDATE <td>DELETE <td> + The existing UPDATE is replaced by the new DELETE within the + changegroup. + <tr><td>DELETE <td>INSERT <td> + If one or more of the column values in the row inserted by the + new change differ from those in the row deleted by the existing + change, the existing DELETE is replaced by an UPDATE within the + changegroup. Otherwise, if the inserted row is exactly the same + as the deleted row, the existing DELETE is simply discarded. + <tr><td>DELETE <td>UPDATE <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. + <tr><td>DELETE <td>DELETE <td> + The new change is ignored. This case does not occur if the new + changeset was recorded immediately after the changesets already + added to the changegroup. +</table></p> + +<p>If the new changeset contains changes to a table that is already present +in the changegroup, then the number of columns and the position of the +primary key columns for the table must be consistent. If this is not the +case, this function fails with SQLITE_SCHEMA. Except, if the changegroup +object has been configured with a database schema using the +sqlite3changegroup_schema() API, then it is possible to combine changesets +with different numbers of columns for a single table, provided that +they are otherwise compatible.</p> + +<p>If the input changeset appears to be corrupt and the corruption is +detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition +occurs during processing, this function returns SQLITE_NOMEM. </p> + +<p>In all cases, if an error occurs the state of the final contents of the +changegroup is undefined. If no error occurs, SQLITE_OK is returned. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_add_strm.html b/www/session/sqlite3changegroup_add_strm.html new file mode 100644 index 0000000..9ec0eeb --- /dev/null +++ b/www/session/sqlite3changegroup_add_strm.html @@ -0,0 +1,291 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Streaming Versions of API functions.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Streaming Versions of API functions.</h2><blockquote><pre>int sqlite3changeset_apply_strm( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ + void *pIn, /* First arg for xInput */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx /* First argument passed to xConflict */ +); +int sqlite3changeset_apply_v2_strm( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ + void *pIn, /* First arg for xInput */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx, /* First argument passed to xConflict */ + void **ppRebase, int *pnRebase, + int flags +); +int sqlite3changeset_concat_strm( + int (*xInputA)(void *pIn, void *pData, int *pnData), + void *pInA, + int (*xInputB)(void *pIn, void *pData, int *pnData), + void *pInB, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changeset_invert_strm( + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changeset_start_strm( + sqlite3_changeset_iter **pp, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn +); +int sqlite3changeset_start_v2_strm( + sqlite3_changeset_iter **pp, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int flags +); +int sqlite3session_changeset_strm( + sqlite3_session *pSession, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3session_patchset_strm( + sqlite3_session *pSession, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3changegroup_add_strm(sqlite3_changegroup*, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn +); +int sqlite3changegroup_output_strm(sqlite3_changegroup*, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +int sqlite3rebaser_rebase_strm( + sqlite3_rebaser *pRebaser, + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut +); +</pre></blockquote><p> +The six streaming API xxx_strm() functions serve similar purposes to the +corresponding non-streaming API functions:</p> + +<p><table border=1 style="margin-left:8ex;margin-right:8ex"> + <tr><th>Streaming function<th>Non-streaming equivalent</th> + <tr><td>sqlite3changeset_apply_strm<td><a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply</a> + <tr><td>sqlite3changeset_apply_strm_v2<td><a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply_v2</a> + <tr><td>sqlite3changeset_concat_strm<td><a href="../session/sqlite3changeset_concat.html">sqlite3changeset_concat</a> + <tr><td>sqlite3changeset_invert_strm<td><a href="../session/sqlite3changeset_invert.html">sqlite3changeset_invert</a> + <tr><td>sqlite3changeset_start_strm<td><a href="../session/sqlite3changeset_start.html">sqlite3changeset_start</a> + <tr><td>sqlite3session_changeset_strm<td><a href="../session/sqlite3session_changeset.html">sqlite3session_changeset</a> + <tr><td>sqlite3session_patchset_strm<td><a href="../session/sqlite3session_patchset.html">sqlite3session_patchset</a> +</table></p> + +<p>Non-streaming functions that accept changesets (or patchsets) as input +require that the entire changeset be stored in a single buffer in memory. +Similarly, those that return a changeset or patchset do so by returning +a pointer to a single large buffer allocated using sqlite3_malloc(). +Normally this is convenient. However, if an application running in a +low-memory environment is required to handle very large changesets, the +large contiguous memory allocations required can become onerous.</p> + +<p>In order to avoid this problem, instead of a single large buffer, input +is passed to a streaming API functions by way of a callback function that +the sessions module invokes to incrementally request input data as it is +required. In all cases, a pair of API function parameters such as</p> + +<p> <pre> + int nChangeset, + void *pChangeset, + </pre></p> + +<p>Is replaced by:</p> + +<p> <pre> + int (*xInput)(void *pIn, void *pData, int *pnData), + void *pIn, + </pre></p> + +<p>Each time the xInput callback is invoked by the sessions module, the first +argument passed is a copy of the supplied pIn context pointer. The second +argument, pData, points to a buffer (*pnData) bytes in size. Assuming no +error occurs the xInput method should copy up to (*pnData) bytes of data +into the buffer and set (*pnData) to the actual number of bytes copied +before returning SQLITE_OK. If the input is completely exhausted, (*pnData) +should be set to zero to indicate this. Or, if an error occurs, an SQLite +error code should be returned. In all cases, if an xInput callback returns +an error, all processing is abandoned and the streaming API function +returns a copy of the error code to the caller.</p> + +<p>In the case of sqlite3changeset_start_strm(), the xInput callback may be +invoked by the sessions module at any point during the lifetime of the +iterator. If such an xInput callback returns an error, the iterator enters +an error state, whereby all subsequent calls to iterator functions +immediately fail with the same error code as returned by xInput.</p> + +<p>Similarly, streaming API functions that return changesets (or patchsets) +return them in chunks by way of a callback function instead of via a +pointer to a single large buffer. In this case, a pair of parameters such +as:</p> + +<p> <pre> + int *pnChangeset, + void **ppChangeset, + </pre></p> + +<p>Is replaced by:</p> + +<p> <pre> + int (*xOutput)(void *pOut, const void *pData, int nData), + void *pOut + </pre></p> + +<p>The xOutput callback is invoked zero or more times to return data to +the application. The first parameter passed to each call is a copy of the +pOut pointer supplied by the application. The second parameter, pData, +points to a buffer nData bytes in size containing the chunk of output +data being returned. If the xOutput callback successfully processes the +supplied data, it should return SQLITE_OK to indicate success. Otherwise, +it should return some other SQLite error code. In this case processing +is immediately abandoned and the streaming API function returns a copy +of the xOutput error code to the application.</p> + +<p>The sessions module never invokes an xOutput callback with the third +parameter set to a value less than or equal to zero. Other than this, +no guarantees are made as to the size of the chunks of data returned. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_delete.html b/www/session/sqlite3changegroup_delete.html new file mode 100644 index 0000000..67e4386 --- /dev/null +++ b/www/session/sqlite3changegroup_delete.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Delete A Changegroup Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Delete A Changegroup Object</h2><blockquote><pre>void sqlite3changegroup_delete(sqlite3_changegroup*); +</pre></blockquote><p></p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_new.html b/www/session/sqlite3changegroup_new.html new file mode 100644 index 0000000..040a129 --- /dev/null +++ b/www/session/sqlite3changegroup_new.html @@ -0,0 +1,155 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Create A New Changegroup Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Create A New Changegroup Object</h2><blockquote><pre>int sqlite3changegroup_new(sqlite3_changegroup **pp); +</pre></blockquote><p> +An sqlite3_changegroup object is used to combine two or more changesets +(or patchsets) into a single changeset (or patchset). A single changegroup +object may combine changesets or patchsets, but not both. The output is +always in the same format as the input.</p> + +<p>If successful, this function returns SQLITE_OK and populates (*pp) with +a pointer to a new sqlite3_changegroup object before returning. The caller +should eventually free the returned object using a call to +sqlite3changegroup_delete(). If an error occurs, an SQLite error code +(i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.</p> + +<p>The usual usage pattern for an sqlite3_changegroup object is as follows:</p> + +<p><ul> + <li> It is created using a call to sqlite3changegroup_new().</p> + +<p> <li> Zero or more changesets (or patchsets) are added to the object + by calling sqlite3changegroup_add().</p> + +<p> <li> The result of combining all input changesets together is obtained + by the application via a call to sqlite3changegroup_output().</p> + +<p> <li> The object is deleted using a call to sqlite3changegroup_delete(). +</ul></p> + +<p>Any number of calls to add() and output() may be made between the calls to +new() and delete(), and in any order.</p> + +<p>As well as the regular sqlite3changegroup_add() and +sqlite3changegroup_output() functions, also available are the streaming +versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_output.html b/www/session/sqlite3changegroup_output.html new file mode 100644 index 0000000..a097119 --- /dev/null +++ b/www/session/sqlite3changegroup_output.html @@ -0,0 +1,148 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain A Composite Changeset From A Changegroup</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain A Composite Changeset From A Changegroup</h2><blockquote><pre>int sqlite3changegroup_output( + sqlite3_changegroup*, + int *pnData, /* OUT: Size of output buffer in bytes */ + void **ppData /* OUT: Pointer to output buffer */ +); +</pre></blockquote><p> +Obtain a buffer containing a changeset (or patchset) representing the +current contents of the changegroup. If the inputs to the changegroup +were themselves changesets, the output is a changeset. Or, if the +inputs were patchsets, the output is also a patchset.</p> + +<p>As with the output of the sqlite3session_changeset() and +sqlite3session_patchset() functions, all changes related to a single +table are grouped together in the output of this function. Tables appear +in the same order as for the very first changeset added to the changegroup. +If the second or subsequent changesets added to the changegroup contain +changes for tables that do not appear in the first changeset, they are +appended onto the end of the output changeset, again in the order in +which they are first encountered.</p> + +<p>If an error occurs, an SQLite error code is returned and the output +variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK +is returned and the output variables are set to the size of and a +pointer to the output buffer, respectively. In this case it is the +responsibility of the caller to eventually free the buffer using a +call to sqlite3_free(). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changegroup_schema.html b/www/session/sqlite3changegroup_schema.html new file mode 100644 index 0000000..bf8cefa --- /dev/null +++ b/www/session/sqlite3changegroup_schema.html @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Add a Schema to a Changegroup</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Add a Schema to a Changegroup</h2><blockquote><pre>int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); +</pre></blockquote><p> +This method may be used to optionally enforce the rule that the changesets +added to the changegroup handle must match the schema of database zDb +("main", "temp", or the name of an attached database). If +sqlite3changegroup_add() is called to add a changeset that is not compatible +with the configured schema, SQLITE_SCHEMA is returned and the changegroup +object is left in an undefined state.</p> + +<p>A changeset schema is considered compatible with the database schema in +the same way as for sqlite3changeset_apply(). Specifically, for each +table in the changeset, there exists a database table with:</p> + +<p><ul> + <li> The name identified by the changeset, and + <li> at least as many columns as recorded in the changeset, and + <li> the primary key columns in the same position as recorded in + the changeset. +</ul></p> + +<p>The output of the changegroup object always has the same schema as the +database nominated using this function. In cases where changesets passed +to sqlite3changegroup_add() have fewer columns than the corresponding table +in the database schema, these are filled in using the default column +values from the database schema. This makes it possible to combined +changesets that have different numbers of columns for a single table +within a changegroup, provided that they are otherwise compatible. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_apply.html b/www/session/sqlite3changeset_apply.html new file mode 100644 index 0000000..02849ff --- /dev/null +++ b/www/session/sqlite3changeset_apply.html @@ -0,0 +1,309 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Apply A Changeset To A Database</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Apply A Changeset To A Database</h2><blockquote><pre>int sqlite3changeset_apply( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void *pChangeset, /* Changeset blob */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx /* First argument passed to xConflict */ +); +int sqlite3changeset_apply_v2( + sqlite3 *db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void *pChangeset, /* Changeset blob */ + int(*xFilter)( + void *pCtx, /* Copy of sixth arg to _apply() */ + const char *zTab /* Table name */ + ), + int(*xConflict)( + void *pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter *p /* Handle describing change and conflict */ + ), + void *pCtx, /* First argument passed to xConflict */ + void **ppRebase, int *pnRebase, /* OUT: Rebase data */ + int flags /* SESSION_CHANGESETAPPLY_* flags */ +); +</pre></blockquote><p> +Apply a changeset or patchset to a database. These functions attempt to +update the "main" database attached to handle db with the changes found in +the changeset passed via the second and third arguments. </p> + +<p>The fourth argument (xFilter) passed to these functions is the "filter +callback". If it is not NULL, then for each table affected by at least one +change in the changeset, the filter callback is invoked with +the table name as the second argument, and a copy of the context pointer +passed as the sixth argument as the first. If the "filter callback" +returns zero, then no attempt is made to apply any changes to the table. +Otherwise, if the return value is non-zero or the xFilter argument to +is NULL, all changes related to the table are attempted.</p> + +<p>For each table that is not excluded by the filter callback, this function +tests that the target database contains a compatible table. A table is +considered compatible if all of the following are true:</p> + +<p><ul> + <li> The table has the same name as the name recorded in the + changeset, and + <li> The table has at least as many columns as recorded in the + changeset, and + <li> The table has primary key columns in the same position as + recorded in the changeset. +</ul></p> + +<p>If there is no compatible table, it is not an error, but none of the +changes associated with the table are applied. A warning message is issued +via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +one such warning is issued for each table in the changeset.</p> + +<p>For each change for which there is a compatible table, an attempt is made +to modify the table contents according to the UPDATE, INSERT or DELETE +change. If a change cannot be applied cleanly, the conflict handler +function passed as the fifth argument to sqlite3changeset_apply() may be +invoked. A description of exactly when the conflict handler is invoked for +each type of change is below.</p> + +<p>Unlike the xFilter argument, xConflict may not be passed NULL. The results +of passing anything other than a valid function pointer as the xConflict +argument are undefined.</p> + +<p>Each time the conflict handler function is invoked, it must return one +of <a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_OMIT</a>, <a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_ABORT</a> or +<a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_REPLACE</a>. SQLITE_CHANGESET_REPLACE may only be returned +if the second argument passed to the conflict handler is either +SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler +returns an illegal value, any changes already made are rolled back and +the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different +actions are taken by sqlite3changeset_apply() depending on the value +returned by each invocation of the conflict-handler function. Refer to +the documentation for the three +<a href="../session/c_changeset_abort.html">available return values</a> for details.</p> + +<p><dl> +<dt>DELETE Changes<dd> + For each DELETE change, the function checks if the target database + contains a row with the same primary key value (or values) as the + original row values stored in the changeset. If it does, and the values + stored in all non-primary key columns also match the values stored in + the changeset the row is deleted from the target database.</p> + +<p> If a row with matching primary key values is found, but one or more of + the non-primary key fields contains a value different from the original + row value stored in the changeset, the conflict-handler function is + invoked with <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_DATA</a> as the second argument. If the + database table has more columns than are recorded in the changeset, + only the values of those non-primary key fields are compared against + the current database contents - any trailing database table columns + are ignored.</p> + +<p> If no row with matching primary key values is found in the database, + the conflict-handler function is invoked with <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_NOTFOUND</a> + passed as the second argument.</p> + +<p> If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT + (which can only happen if a foreign key constraint is violated), the + conflict-handler function is invoked with <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_CONSTRAINT</a> + passed as the second argument. This includes the case where the DELETE + operation is attempted because an earlier call to the conflict handler + function returned <a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_REPLACE</a>.</p> + +<p><dt>INSERT Changes<dd> + For each INSERT change, an attempt is made to insert the new row into + the database. If the changeset row contains fewer fields than the + database table, the trailing fields are populated with their default + values.</p> + +<p> If the attempt to insert the row fails because the database already + contains a row with the same primary key values, the conflict handler + function is invoked with the second argument set to + <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_CONFLICT</a>.</p> + +<p> If the attempt to insert the row fails because of some other constraint + violation (e.g. NOT NULL or UNIQUE), the conflict handler function is + invoked with the second argument set to <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_CONSTRAINT</a>. + This includes the case where the INSERT operation is re-attempted because + an earlier call to the conflict handler function returned + <a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_REPLACE</a>.</p> + +<p><dt>UPDATE Changes<dd> + For each UPDATE change, the function checks if the target database + contains a row with the same primary key value (or values) as the + original row values stored in the changeset. If it does, and the values + stored in all modified non-primary key columns also match the values + stored in the changeset the row is updated within the target database.</p> + +<p> If a row with matching primary key values is found, but one or more of + the modified non-primary key fields contains a value different from an + original row value stored in the changeset, the conflict-handler function + is invoked with <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_DATA</a> as the second argument. Since + UPDATE changes only contain values for non-primary key fields that are + to be modified, only those fields need to match the original values to + avoid the SQLITE_CHANGESET_DATA conflict-handler callback.</p> + +<p> If no row with matching primary key values is found in the database, + the conflict-handler function is invoked with <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_NOTFOUND</a> + passed as the second argument.</p> + +<p> If the UPDATE operation is attempted, but SQLite returns + SQLITE_CONSTRAINT, the conflict-handler function is invoked with + <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_CONSTRAINT</a> passed as the second argument. + This includes the case where the UPDATE operation is attempted after + an earlier call to the conflict handler function returned + <a href="../session/c_changeset_abort.html">SQLITE_CHANGESET_REPLACE</a>. +</dl></p> + +<p>It is safe to execute SQL statements, including those that write to the +table that the callback related to, from within the xConflict callback. +This can be used to further customize the application's conflict +resolution strategy.</p> + +<p>All changes made by these functions are enclosed in a savepoint transaction. +If any other error (aside from a constraint failure when attempting to +write to the target database) occurs, then the savepoint transaction is +rolled back, restoring the target database to its original state, and an +SQLite error code returned.</p> + +<p>If the output parameters (ppRebase) and (pnRebase) are non-NULL and +the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +may set (*ppRebase) to point to a "rebase" that may be used with the +sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +is set to the size of the buffer in bytes. It is the responsibility of the +caller to eventually free any such buffer using sqlite3_free(). The buffer +is only allocated and populated if one or more conflicts were encountered +while applying the patchset. See comments surrounding the sqlite3_rebaser +APIs for further details.</p> + +<p>The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +may be modified by passing a combination of +<a href="../session/c_changesetapply_fknoaction.html">supported flags</a> as the 9th parameter.</p> + +<p>Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b> +and therefore subject to change. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_concat.html b/www/session/sqlite3changeset_concat.html new file mode 100644 index 0000000..282ab3e --- /dev/null +++ b/www/session/sqlite3changeset_concat.html @@ -0,0 +1,153 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Concatenate Two Changeset Objects</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Concatenate Two Changeset Objects</h2><blockquote><pre>int sqlite3changeset_concat( + int nA, /* Number of bytes in buffer pA */ + void *pA, /* Pointer to buffer containing changeset A */ + int nB, /* Number of bytes in buffer pB */ + void *pB, /* Pointer to buffer containing changeset B */ + int *pnOut, /* OUT: Number of bytes in output changeset */ + void **ppOut /* OUT: Buffer containing output changeset */ +); +</pre></blockquote><p> +This function is used to concatenate two changesets, A and B, into a +single changeset. The result is a changeset equivalent to applying +changeset A followed by changeset B. </p> + +<p>This function combines the two input changesets using an +sqlite3_changegroup object. Calling it produces similar results as the +following code fragment:</p> + +<p><pre> + sqlite3_changegroup *pGrp; + rc = sqlite3_changegroup_new(&pGrp); + if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); + if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB); + if( rc==SQLITE_OK ){ + rc = sqlite3changegroup_output(pGrp, pnOut, ppOut); + }else{ + *ppOut = 0; + *pnOut = 0; + } +</pre></p> + +<p>Refer to the sqlite3_changegroup documentation below for details. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_conflict.html b/www/session/sqlite3changeset_conflict.html new file mode 100644 index 0000000..2098bc0 --- /dev/null +++ b/www/session/sqlite3changeset_conflict.html @@ -0,0 +1,145 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain Conflicting Row Values From A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain Conflicting Row Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_conflict( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: Value from conflicting row */ +); +</pre></blockquote><p> +This function should only be used with iterator objects passed to a +conflict-handler callback by <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a> with either +<a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_DATA</a> or <a href="../session/c_changeset_conflict.html">SQLITE_CHANGESET_CONFLICT</a>. If this function +is called on any other iterator, <a href="../rescode.html#misuse">SQLITE_MISUSE</a> is returned and *ppValue +is set to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="../rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the +"conflicting row" associated with the current conflict-handler callback +and returns SQLITE_OK.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_finalize.html b/www/session/sqlite3changeset_finalize.html new file mode 100644 index 0000000..d353eaf --- /dev/null +++ b/www/session/sqlite3changeset_finalize.html @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Finalize A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Finalize A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); +</pre></blockquote><p> +This function is used to finalize an iterator allocated with +<a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>.</p> + +<p>This function should only be called on iterators created using the +<a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a> function. If an application calls this +function with an iterator passed to a conflict-handler by +<a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, <a href="../rescode.html#misuse">SQLITE_MISUSE</a> is immediately returned and the +call has no effect.</p> + +<p>If an error was encountered within a call to an sqlite3changeset_xxx() +function (for example an <a href="../rescode.html#corrupt">SQLITE_CORRUPT</a> in <a href="../session/sqlite3changeset_next.html">sqlite3changeset_next()</a> or an +<a href="../rescode.html#nomem">SQLITE_NOMEM</a> in <a href="../session/sqlite3changeset_new.html">sqlite3changeset_new()</a>) then an error code corresponding +to that error is returned by this function. Otherwise, SQLITE_OK is +returned. This is to allow the following pattern (pseudo-code):</p> + +<p><pre> + sqlite3changeset_start(); + while( SQLITE_ROW==sqlite3changeset_next() ){ + // Do something with change. + } + rc = sqlite3changeset_finalize(); + if( rc!=SQLITE_OK ){ + // An error has occurred + } +</pre> +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_fk_conflicts.html b/www/session/sqlite3changeset_fk_conflicts.html new file mode 100644 index 0000000..3c31c1b --- /dev/null +++ b/www/session/sqlite3changeset_fk_conflicts.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Determine The Number Of Foreign Key Constraint Violations</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Determine The Number Of Foreign Key Constraint Violations</h2><blockquote><pre>int sqlite3changeset_fk_conflicts( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int *pnOut /* OUT: Number of FK violations */ +); +</pre></blockquote><p> +This function may only be called with an iterator passed to an +SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +it sets the output variable to the total number of known foreign key +violations in the destination database and returns SQLITE_OK.</p> + +<p>In all other cases this function returns SQLITE_MISUSE. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_invert.html b/www/session/sqlite3changeset_invert.html new file mode 100644 index 0000000..d97c44f --- /dev/null +++ b/www/session/sqlite3changeset_invert.html @@ -0,0 +1,151 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Invert A Changeset</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Invert A Changeset</h2><blockquote><pre>int sqlite3changeset_invert( + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); +</pre></blockquote><p> +This function is used to "invert" a changeset object. Applying an inverted +changeset to a database reverses the effects of applying the uninverted +changeset. Specifically:</p> + +<p><ul> + <li> Each DELETE change is changed to an INSERT, and + <li> Each INSERT change is changed to a DELETE, and + <li> For each UPDATE change, the old.* and new.* values are exchanged. +</ul></p> + +<p>This function does not change the order in which changes appear within +the changeset. It merely reverses the sense of each individual change.</p> + +<p>If successful, a pointer to a buffer containing the inverted changeset +is stored in *ppOut, the size of the same buffer is stored in *pnOut, and +SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are +zeroed and an SQLite error code returned.</p> + +<p>It is the responsibility of the caller to eventually call sqlite3_free() +on the *ppOut pointer to free the buffer allocation following a successful +call to this function.</p> + +<p>WARNING/TODO: This function currently assumes that the input is a valid +changeset. If it is not, the results are undefined. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_new.html b/www/session/sqlite3changeset_new.html new file mode 100644 index 0000000..1fb8f10 --- /dev/null +++ b/www/session/sqlite3changeset_new.html @@ -0,0 +1,151 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain new.* Values From A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain new.* Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_new( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, or an iterator +created by <a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="../session/sqlite3changeset_next.html">sqlite3changeset_next()</a> must have returned SQLITE_ROW. +Furthermore, it may only be called if the type of change that the iterator +currently points to is either <a href="../c3ref/c_alter_table.html">SQLITE_UPDATE</a> or <a href="../c3ref/c_alter_table.html">SQLITE_INSERT</a>. Otherwise, +this function returns <a href="../rescode.html#misuse">SQLITE_MISUSE</a> and sets *ppValue to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="../rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the vector of +new row values stored as part of the UPDATE or INSERT change and +returns SQLITE_OK. If the change is an UPDATE and does not include +a new value for the requested column, *ppValue is set to NULL and +SQLITE_OK returned. The name of the function comes from the fact that +this is similar to the "new.*" columns available to update or delete +triggers.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_next.html b/www/session/sqlite3changeset_next.html new file mode 100644 index 0000000..31b9a40 --- /dev/null +++ b/www/session/sqlite3changeset_next.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Advance A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Advance A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_next(sqlite3_changeset_iter *pIter); +</pre></blockquote><p> +This function may only be used with iterators created by the function +<a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>. If it is called on an iterator passed to +a conflict-handler callback by <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, SQLITE_MISUSE +is returned and the call has no effect.</p> + +<p>Immediately after an iterator is created by sqlite3changeset_start(), it +does not point to any change in the changeset. Assuming the changeset +is not empty, the first call to this function advances the iterator to +point to the first change in the changeset. Each subsequent call advances +the iterator to point to the next change in the changeset (if any). If +no error occurs and the iterator points to a valid change after a call +to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +Otherwise, if all changes in the changeset have already been visited, +SQLITE_DONE is returned.</p> + +<p>If an error occurs, an SQLite error code is returned. Possible error +codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or +SQLITE_NOMEM. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_old.html b/www/session/sqlite3changeset_old.html new file mode 100644 index 0000000..2c8f4f7 --- /dev/null +++ b/www/session/sqlite3changeset_old.html @@ -0,0 +1,148 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain old.* Values From A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain old.* Values From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_old( + sqlite3_changeset_iter *pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, or an iterator +created by <a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="../session/sqlite3changeset_next.html">sqlite3changeset_next()</a> must have returned SQLITE_ROW. +Furthermore, it may only be called if the type of change that the iterator +currently points to is either <a href="../c3ref/c_alter_table.html">SQLITE_DELETE</a> or <a href="../c3ref/c_alter_table.html">SQLITE_UPDATE</a>. Otherwise, +this function returns <a href="../rescode.html#misuse">SQLITE_MISUSE</a> and sets *ppValue to NULL.</p> + +<p>Argument iVal must be greater than or equal to 0, and less than the number +of columns in the table affected by the current change. Otherwise, +<a href="../rescode.html#range">SQLITE_RANGE</a> is returned and *ppValue is set to NULL.</p> + +<p>If successful, this function sets *ppValue to point to a protected +sqlite3_value object containing the iVal'th value from the vector of +original row values stored as part of the UPDATE or DELETE change and +returns SQLITE_OK. The name of the function comes from the fact that this +is similar to the "old.*" columns available to update or delete triggers.</p> + +<p>If some other error occurs (e.g. an OOM condition), an SQLite error code +is returned and *ppValue is set to NULL. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_op.html b/www/session/sqlite3changeset_op.html new file mode 100644 index 0000000..14dca9a --- /dev/null +++ b/www/session/sqlite3changeset_op.html @@ -0,0 +1,157 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain The Current Operation From A Changeset Iterator</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain The Current Operation From A Changeset Iterator</h2><blockquote><pre>int sqlite3changeset_op( + sqlite3_changeset_iter *pIter, /* Iterator object */ + const char **pzTab, /* OUT: Pointer to table name */ + int *pnCol, /* OUT: Number of columns in table */ + int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ + int *pbIndirect /* OUT: True for an 'indirect' change */ +); +</pre></blockquote><p> +The pIter argument passed to this function may either be an iterator +passed to a conflict-handler by <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, or an iterator +created by <a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a>. In the latter case, the most recent +call to <a href="../session/sqlite3changeset_next.html">sqlite3changeset_next()</a> must have returned <a href="../rescode.html#row">SQLITE_ROW</a>. If this +is not the case, this function returns <a href="../rescode.html#misuse">SQLITE_MISUSE</a>.</p> + +<p>Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three +outputs are set through these pointers: </p> + +<p>*pOp is set to one of <a href="../c3ref/c_alter_table.html">SQLITE_INSERT</a>, <a href="../c3ref/c_alter_table.html">SQLITE_DELETE</a> or <a href="../c3ref/c_alter_table.html">SQLITE_UPDATE</a>, +depending on the type of change that the iterator currently points to;</p> + +<p>*pnCol is set to the number of columns in the table affected by the change; and</p> + +<p>*pzTab is set to point to a nul-terminated utf-8 encoded string containing +the name of the table affected by the current change. The buffer remains +valid until either sqlite3changeset_next() is called on the iterator +or until the conflict-handler function returns.</p> + +<p>If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change +is an indirect change, or false (0) otherwise. See the documentation for +<a href="../session/sqlite3session_indirect.html">sqlite3session_indirect()</a> for a description of direct and indirect +changes.</p> + +<p>If no error occurs, SQLITE_OK is returned. If an error does occur, an +SQLite error code is returned. The values of the output variables may not +be trusted in this case. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_pk.html b/www/session/sqlite3changeset_pk.html new file mode 100644 index 0000000..e5c936b --- /dev/null +++ b/www/session/sqlite3changeset_pk.html @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Obtain The Primary Key Definition Of A Table</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Obtain The Primary Key Definition Of A Table</h2><blockquote><pre>int sqlite3changeset_pk( + sqlite3_changeset_iter *pIter, /* Iterator object */ + unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ + int *pnCol /* OUT: Number of entries in output array */ +); +</pre></blockquote><p> +For each modified table, a changeset includes the following:</p> + +<p><ul> + <li> The number of columns in the table, and + <li> Which of those columns make up the tables PRIMARY KEY. +</ul></p> + +<p>This function is used to find which columns comprise the PRIMARY KEY of +the table modified by the change that iterator pIter currently points to. +If successful, *pabPK is set to point to an array of nCol entries, where +nCol is the number of columns in the table. Elements of *pabPK are set to +0x01 if the corresponding column is part of the tables primary key, or +0x00 if it is not.</p> + +<p>If argument pnCol is not NULL, then *pnCol is set to the number of columns +in the table.</p> + +<p>If this function is called when the iterator does not point to a valid +entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise, +SQLITE_OK is returned and the output variables populated as described +above. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_start.html b/www/session/sqlite3changeset_start.html new file mode 100644 index 0000000..83b602c --- /dev/null +++ b/www/session/sqlite3changeset_start.html @@ -0,0 +1,170 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Create An Iterator To Traverse A Changeset </title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Create An Iterator To Traverse A Changeset </h2><blockquote><pre>int sqlite3changeset_start( + sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ + int nChangeset, /* Size of changeset blob in bytes */ + void *pChangeset /* Pointer to blob containing changeset */ +); +int sqlite3changeset_start_v2( + sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ + int nChangeset, /* Size of changeset blob in bytes */ + void *pChangeset, /* Pointer to blob containing changeset */ + int flags /* SESSION_CHANGESETSTART_* flags */ +); +</pre></blockquote><p> +Create an iterator used to iterate through the contents of a changeset. +If successful, *pp is set to point to the iterator handle and SQLITE_OK +is returned. Otherwise, if an error occurs, *pp is set to zero and an +SQLite error code is returned.</p> + +<p>The following functions can be used to advance and query a changeset +iterator created by this function:</p> + +<p><ul> + <li> <a href="../session/sqlite3changeset_next.html">sqlite3changeset_next()</a> + <li> <a href="../session/sqlite3changeset_op.html">sqlite3changeset_op()</a> + <li> <a href="../session/sqlite3changeset_new.html">sqlite3changeset_new()</a> + <li> <a href="../session/sqlite3changeset_old.html">sqlite3changeset_old()</a> +</ul></p> + +<p>It is the responsibility of the caller to eventually destroy the iterator +by passing it to <a href="../session/sqlite3changeset_finalize.html">sqlite3changeset_finalize()</a>. The buffer containing the +changeset (pChangeset) must remain valid until after the iterator is +destroyed.</p> + +<p>Assuming the changeset blob was created by one of the +<a href="../session/sqlite3session_changeset.html">sqlite3session_changeset()</a>, <a href="../session/sqlite3changeset_concat.html">sqlite3changeset_concat()</a> or +<a href="../session/sqlite3changeset_invert.html">sqlite3changeset_invert()</a> functions, all changes within the changeset +that apply to a single table are grouped together. This means that when +an application iterates through a changeset using an iterator created by +this function, all changes that relate to a single table are visited +consecutively. There is no chance that the iterator will visit a change +the applies to table X, then one for table Y, and then later on visit +another change for table X.</p> + +<p>The behavior of sqlite3changeset_start_v2() and its streaming equivalent +may be modified by passing a combination of +<a href="../session/c_changesetstart_invert.html">supported flags</a> as the 4th parameter.</p> + +<p>Note that the sqlite3changeset_start_v2() API is still <b>experimental</b> +and therefore subject to change. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3changeset_upgrade.html b/www/session/sqlite3changeset_upgrade.html new file mode 100644 index 0000000..c54d09c --- /dev/null +++ b/www/session/sqlite3changeset_upgrade.html @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Upgrade the Schema of a Changeset/Patchset</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Upgrade the Schema of a Changeset/Patchset</h2><blockquote><pre>int sqlite3changeset_upgrade( + sqlite3 *db, + const char *zDb, + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); +</pre></blockquote><p></p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3rebaser_configure.html b/www/session/sqlite3rebaser_configure.html new file mode 100644 index 0000000..51807af --- /dev/null +++ b/www/session/sqlite3rebaser_configure.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Configure a changeset rebaser object.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Configure a changeset rebaser object.</h2><blockquote><pre>int sqlite3rebaser_configure( + sqlite3_rebaser*, + int nRebase, const void *pRebase +); +</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Configure the changeset rebaser object to rebase changesets according +to the conflict resolutions described by buffer pRebase (size nRebase +bytes), which must have been obtained from a previous call to +sqlite3changeset_apply_v2(). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3rebaser_create.html b/www/session/sqlite3rebaser_create.html new file mode 100644 index 0000000..373dfa2 --- /dev/null +++ b/www/session/sqlite3rebaser_create.html @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Create a changeset rebaser object.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Create a changeset rebaser object.</h2><blockquote><pre>int sqlite3rebaser_create(sqlite3_rebaser **ppNew); +</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Allocate a new changeset rebaser object. If successful, set (*ppNew) to +point to the new object and return SQLITE_OK. Otherwise, if an error +occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) +to NULL. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3rebaser_delete.html b/www/session/sqlite3rebaser_delete.html new file mode 100644 index 0000000..d8bdab4 --- /dev/null +++ b/www/session/sqlite3rebaser_delete.html @@ -0,0 +1,127 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Delete a changeset rebaser object.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Delete a changeset rebaser object.</h2><blockquote><pre>void sqlite3rebaser_delete(sqlite3_rebaser *p); +</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Delete the changeset rebaser object and all associated resources. There +should be one call to this function for each successful invocation +of sqlite3rebaser_create(). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3rebaser_rebase.html b/www/session/sqlite3rebaser_rebase.html new file mode 100644 index 0000000..7209435 --- /dev/null +++ b/www/session/sqlite3rebaser_rebase.html @@ -0,0 +1,137 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Rebase a changeset</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Rebase a changeset</h2><blockquote><pre>int sqlite3rebaser_rebase( + sqlite3_rebaser*, + int nIn, const void *pIn, + int *pnOut, void **ppOut +); +</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p> +Argument pIn must point to a buffer containing a changeset nIn bytes +in size. This function allocates and populates a buffer with a copy +of the changeset rebased according to the configuration of the +rebaser object passed as the first argument. If successful, (*ppOut) +is set to point to the new buffer containing the rebased changeset and +(*pnOut) to its size in bytes and SQLITE_OK returned. It is the +responsibility of the caller to eventually free the new buffer using +sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +are set to zero and an SQLite error code returned. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_attach.html b/www/session/sqlite3session_attach.html new file mode 100644 index 0000000..0670df7 --- /dev/null +++ b/www/session/sqlite3session_attach.html @@ -0,0 +1,180 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Attach A Table To A Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Attach A Table To A Session Object</h2><blockquote><pre>int sqlite3session_attach( + sqlite3_session *pSession, /* Session object */ + const char *zTab /* Table name */ +); +</pre></blockquote><p> +If argument zTab is not NULL, then it is the name of a table to attach +to the session object passed as the first argument. All subsequent changes +made to the table while the session object is enabled will be recorded. See +documentation for <a href="../session/sqlite3session_changeset.html">sqlite3session_changeset()</a> for further details.</p> + +<p>Or, if argument zTab is NULL, then changes are recorded for all tables +in the database. If additional tables are added to the database (by +executing "CREATE TABLE" statements) after this call is made, changes for +the new tables are also recorded.</p> + +<p>Changes can only be recorded for tables that have a PRIMARY KEY explicitly +defined as part of their CREATE TABLE statement. It does not matter if the +PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY +KEY may consist of a single column, or may be a composite key.</p> + +<p>It is not an error if the named table does not exist in the database. Nor +is it an error if the named table does not have a PRIMARY KEY. However, +no changes will be recorded in either of these scenarios.</p> + +<p>Changes are not recorded for individual rows that have NULL values stored +in one or more of their PRIMARY KEY columns.</p> + +<p>SQLITE_OK is returned if the call completes without error. Or, if an error +occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.</p> + +<p><h3>Special sqlite_stat1 Handling</h3></p> + +<p>As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to +some of the rules above. In SQLite, the schema of sqlite_stat1 is: + <pre> + CREATE TABLE sqlite_stat1(tbl,idx,stat) + </pre></p> + +<p>Even though sqlite_stat1 does not have a PRIMARY KEY, changes are +recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes +are recorded for rows for which (idx IS NULL) is true. However, for such +rows a zero-length blob (SQL value X'') is stored in the changeset or +patchset instead of a NULL value. This allows such changesets to be +manipulated by legacy implementations of sqlite3changeset_invert(), +concat() and similar.</p> + +<p>The sqlite3changeset_apply() function automatically converts the +zero-length blob back to a NULL value when updating the sqlite_stat1 +table. However, if the application calls sqlite3changeset_new(), +sqlite3changeset_old() or sqlite3changeset_conflict on a changeset +iterator directly (including on a changeset iterator passed to a +conflict-handler callback) then the X'' value is returned. The application +must translate X'' to NULL itself if required.</p> + +<p>Legacy (older than 3.22.0) versions of the sessions module cannot capture +changes made to the sqlite_stat1 table. Legacy versions of the +sqlite3changeset_apply() function silently ignore any modifications to the +sqlite_stat1 table that are part of a changeset or patchset. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_changeset.html b/www/session/sqlite3session_changeset.html new file mode 100644 index 0000000..df9a39c --- /dev/null +++ b/www/session/sqlite3session_changeset.html @@ -0,0 +1,228 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Generate A Changeset From A Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Generate A Changeset From A Session Object</h2><blockquote><pre>int sqlite3session_changeset( + sqlite3_session *pSession, /* Session object */ + int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ + void **ppChangeset /* OUT: Buffer containing changeset */ +); +</pre></blockquote><p> +Obtain a changeset containing changes to the tables attached to the +session object passed as the first argument. If successful, +set *ppChangeset to point to a buffer containing the changeset +and *pnChangeset to the size of the changeset in bytes before returning +SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to +zero and return an SQLite error code.</p> + +<p>A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes, +each representing a change to a single row of an attached table. An INSERT +change contains the values of each field of a new database row. A DELETE +contains the original values of each field of a deleted database row. An +UPDATE change contains the original values of each field of an updated +database row along with the updated values for each updated non-primary-key +column. It is not possible for an UPDATE change to represent a change that +modifies the values of primary key columns. If such a change is made, it +is represented in a changeset as a DELETE followed by an INSERT.</p> + +<p>Changes are not recorded for rows that have NULL values stored in one or +more of their PRIMARY KEY columns. If such a row is inserted or deleted, +no corresponding change is present in the changesets returned by this +function. If an existing row with one or more NULL values stored in +PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL, +only an INSERT is appears in the changeset. Similarly, if an existing row +with non-NULL PRIMARY KEY values is updated so that one or more of its +PRIMARY KEY columns are set to NULL, the resulting changeset contains a +DELETE change only.</p> + +<p>The contents of a changeset may be traversed using an iterator created +using the <a href="../session/sqlite3changeset_start.html">sqlite3changeset_start()</a> API. A changeset may be applied to +a database with a compatible schema using the <a href="../session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a> +API.</p> + +<p>Within a changeset generated by this function, all changes related to a +single table are grouped together. In other words, when iterating through +a changeset or when applying a changeset to a database, all changes related +to a single table are processed before moving on to the next table. Tables +are sorted in the same order in which they were attached (or auto-attached) +to the sqlite3_session object. The order in which the changes related to +a single table are stored is undefined.</p> + +<p>Following a successful call to this function, it is the responsibility of +the caller to eventually free the buffer that *ppChangeset points to using +<a href="../c3ref/free.html">sqlite3_free()</a>.</p> + +<p><h3>Changeset Generation</h3></p> + +<p>Once a table has been attached to a session object, the session object +records the primary key values of all new rows inserted into the table. +It also records the original primary key and other column values of any +deleted or updated rows. For each unique primary key value, data is only +recorded once - the first time a row with said primary key is inserted, +updated or deleted in the lifetime of the session.</p> + +<p>There is one exception to the previous paragraph: when a row is inserted, +updated or deleted, if one or more of its primary key columns contain a +NULL value, no record of the change is made.</p> + +<p>The session object therefore accumulates two types of records - those +that consist of primary key values only (created when the user inserts +a new record) and those that consist of the primary key values and the +original values of other table columns (created when the users deletes +or updates a record).</p> + +<p>When this function is called, the requested changeset is created using +both the accumulated records and the current contents of the database +file. Specifically:</p> + +<p><ul> + <li> For each record generated by an insert, the database is queried + for a row with a matching primary key. If one is found, an INSERT + change is added to the changeset. If no such row is found, no change + is added to the changeset.</p> + +<p> <li> For each record generated by an update or delete, the database is + queried for a row with a matching primary key. If such a row is + found and one or more of the non-primary key fields have been + modified from their original values, an UPDATE change is added to + the changeset. Or, if no such row is found in the table, a DELETE + change is added to the changeset. If there is a row with a matching + primary key in the database, but all fields contain their original + values, no change is added to the changeset. +</ul></p> + +<p>This means, amongst other things, that if a row is inserted and then later +deleted while a session object is active, neither the insert nor the delete +will be present in the changeset. Or if a row is deleted and then later a +row with the same primary key values inserted while a session object is +active, the resulting changeset will contain an UPDATE change instead of +a DELETE and an INSERT.</p> + +<p>When a session object is disabled (see the <a href="../session/sqlite3session_enable.html">sqlite3session_enable()</a> API), +it does not accumulate records when rows are inserted, updated or deleted. +This may appear to have some counter-intuitive effects if a single row +is written to more than once during a session. For example, if a row +is inserted while a session object is enabled, then later deleted while +the same session object is disabled, no INSERT record will appear in the +changeset, even though the delete took place while the session was disabled. +Or, if one field of a row is updated while a session is disabled, and +another field of the same row is updated while the session is enabled, the +resulting changeset will contain an UPDATE change that updates both fields. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_changeset_size.html b/www/session/sqlite3session_changeset_size.html new file mode 100644 index 0000000..eaf2a83 --- /dev/null +++ b/www/session/sqlite3session_changeset_size.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Return An Upper-limit For The Size Of The Changeset</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Return An Upper-limit For The Size Of The Changeset</h2><blockquote><pre>sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession); +</pre></blockquote><p> +By default, this function always returns 0. For it to return +a useful result, the sqlite3_session object must have been configured +to enable this API using sqlite3session_object_config() with the +SQLITE_SESSION_OBJCONFIG_SIZE verb.</p> + +<p>When enabled, this function returns an upper limit, in bytes, for the size +of the changeset that might be produced if sqlite3session_changeset() were +called. The final changeset size might be equal to or smaller than the +size in bytes returned by this function. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_config.html b/www/session/sqlite3session_config.html new file mode 100644 index 0000000..8b89e89 --- /dev/null +++ b/www/session/sqlite3session_config.html @@ -0,0 +1,153 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Configure global parameters</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Configure global parameters</h2><blockquote><pre>int sqlite3session_config(int op, void *pArg); +</pre></blockquote><p> +The sqlite3session_config() interface is used to make global configuration +changes to the sessions module in order to tune it to the specific needs +of the application.</p> + +<p>The sqlite3session_config() interface is not threadsafe. If it is invoked +while any other thread is inside any other sessions method then the +results are undefined. Furthermore, if it is invoked after any sessions +related objects have been created, the results are also undefined. </p> + +<p>The first argument to the sqlite3session_config() function must be one +of the SQLITE_SESSION_CONFIG_XXX constants defined below. The +interpretation of the (void*) value passed as the second parameter and +the effect of calling this function depends on the value of the first +parameter.</p> + +<p><dl> +<dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd> + By default, the sessions module streaming interfaces attempt to input + and output data in approximately 1 KiB chunks. This operand may be used + to set and query the value of this configuration setting. The pointer + passed as the second argument must point to a value of type (int). + If this value is greater than 0, it is used as the new streaming data + chunk size for both input and output. Before returning, the (int) value + pointed to by pArg is set to the final value of the streaming interface + chunk size. +</dl></p> + +<p>This function returns SQLITE_OK if successful, or an SQLite error code +otherwise. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_create.html b/www/session/sqlite3session_create.html new file mode 100644 index 0000000..4501259 --- /dev/null +++ b/www/session/sqlite3session_create.html @@ -0,0 +1,154 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Create A New Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Create A New Session Object</h2><blockquote><pre>int sqlite3session_create( + sqlite3 *db, /* Database handle */ + const char *zDb, /* Name of db (e.g. "main") */ + sqlite3_session **ppSession /* OUT: New session object */ +); +</pre></blockquote><p> +Create a new session object attached to database handle db. If successful, +a pointer to the new object is written to *ppSession and SQLITE_OK is +returned. If an error occurs, *ppSession is set to NULL and an SQLite +error code (e.g. SQLITE_NOMEM) is returned.</p> + +<p>It is possible to create multiple session objects attached to a single +database handle.</p> + +<p>Session objects created using this function should be deleted using the +<a href="../session/sqlite3session_delete.html">sqlite3session_delete()</a> function before the database handle that they +are attached to is itself closed. If the database handle is closed before +the session object is deleted, then the results of calling any session +module function, including <a href="../session/sqlite3session_delete.html">sqlite3session_delete()</a> on the session object +are undefined.</p> + +<p>Because the session module uses the <a href="../c3ref/preupdate_blobwrite.html">sqlite3_preupdate_hook()</a> API, it +is not possible for an application to register a pre-update hook on a +database handle that has one or more session objects attached. Nor is +it possible to create a session object attached to a database handle for +which a pre-update hook is already defined. The results of attempting +either of these things are undefined.</p> + +<p>The session object will be used to create changesets for tables in +database zDb, where zDb is either "main", or "temp", or the name of an +attached database. It is not an error if database zDb is not attached +to the database when the session object is created. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_delete.html b/www/session/sqlite3session_delete.html new file mode 100644 index 0000000..ddaccbd --- /dev/null +++ b/www/session/sqlite3session_delete.html @@ -0,0 +1,132 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Delete A Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Delete A Session Object</h2><blockquote><pre>void sqlite3session_delete(sqlite3_session *pSession); +</pre></blockquote><p> +Delete a session object previously allocated using +<a href="../session/sqlite3session_create.html">sqlite3session_create()</a>. Once a session object has been deleted, the +results of attempting to use pSession with any other session module +function are undefined.</p> + +<p>Session objects must be deleted before the database handle to which they +are attached is closed. Refer to the documentation for +<a href="../session/sqlite3session_create.html">sqlite3session_create()</a> for details. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_diff.html b/www/session/sqlite3session_diff.html new file mode 100644 index 0000000..39b5e35 --- /dev/null +++ b/www/session/sqlite3session_diff.html @@ -0,0 +1,181 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Load The Difference Between Tables Into A Session</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Load The Difference Between Tables Into A Session</h2><blockquote><pre>int sqlite3session_diff( + sqlite3_session *pSession, + const char *zFromDb, + const char *zTbl, + char **pzErrMsg +); +</pre></blockquote><p> +If it is not already attached to the session object passed as the first +argument, this function attaches table zTbl in the same manner as the +<a href="../session/sqlite3session_attach.html">sqlite3session_attach()</a> function. If zTbl does not exist, or if it +does not have a primary key, this function is a no-op (but does not return +an error).</p> + +<p>Argument zFromDb must be the name of a database ("main", "temp" etc.) +attached to the same database handle as the session object that contains +a table compatible with the table attached to the session by this function. +A table is considered compatible if it:</p> + +<p><ul> + <li> Has the same name, + <li> Has the same set of columns declared in the same order, and + <li> Has the same PRIMARY KEY definition. +</ul></p> + +<p>If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables +are compatible but do not have any PRIMARY KEY columns, it is not an error +but no changes are added to the session object. As with other session +APIs, tables without PRIMARY KEYs are simply ignored.</p> + +<p>This function adds a set of changes to the session object that could be +used to update the table in database zFrom (call this the "from-table") +so that its content is the same as the table attached to the session +object (call this the "to-table"). Specifically:</p> + +<p><ul> + <li> For each row (primary key) that exists in the to-table but not in + the from-table, an INSERT record is added to the session object.</p> + +<p> <li> For each row (primary key) that exists in the to-table but not in + the from-table, a DELETE record is added to the session object.</p> + +<p> <li> For each row (primary key) that exists in both tables, but features + different non-PK values in each, an UPDATE record is added to the + session. +</ul></p> + +<p>To clarify, if this function is called and then a changeset constructed +using <a href="../session/sqlite3session_changeset.html">sqlite3session_changeset()</a>, then after applying that changeset to +database zFrom the contents of the two compatible tables would be +identical.</p> + +<p>It an error if database zFrom does not exist or does not contain the +required compatible table.</p> + +<p>If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite +error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg +may be set to point to a buffer containing an English language error +message. It is the responsibility of the caller to free this buffer using +sqlite3_free(). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_enable.html b/www/session/sqlite3session_enable.html new file mode 100644 index 0000000..df2bcc4 --- /dev/null +++ b/www/session/sqlite3session_enable.html @@ -0,0 +1,137 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Enable Or Disable A Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Enable Or Disable A Session Object</h2><blockquote><pre>int sqlite3session_enable(sqlite3_session *pSession, int bEnable); +</pre></blockquote><p> +Enable or disable the recording of changes by a session object. When +enabled, a session object records changes made to the database. When +disabled - it does not. A newly created session object is enabled. +Refer to the documentation for <a href="../session/sqlite3session_changeset.html">sqlite3session_changeset()</a> for further +details regarding how enabling and disabling a session object affects +the eventual changesets.</p> + +<p>Passing zero to this function disables the session. Passing a value +greater than zero enables it. Passing a value less than zero is a +no-op, and may be used to query the current state of the session.</p> + +<p>The return value indicates the final state of the session object: 0 if +the session is disabled, or 1 if it is enabled. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_indirect.html b/www/session/sqlite3session_indirect.html new file mode 100644 index 0000000..b114bbb --- /dev/null +++ b/www/session/sqlite3session_indirect.html @@ -0,0 +1,147 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Set Or Clear the Indirect Change Flag</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Set Or Clear the Indirect Change Flag</h2><blockquote><pre>int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); +</pre></blockquote><p> +Each change recorded by a session object is marked as either direct or +indirect. A change is marked as indirect if either:</p> + +<p><ul> + <li> The session object "indirect" flag is set when the change is + made, or + <li> The change is made by an SQL trigger or foreign key action + instead of directly as a result of a users SQL statement. +</ul></p> + +<p>If a single row is affected by more than one operation within a session, +then the change is considered indirect if all operations meet the criteria +for an indirect change above, or direct otherwise.</p> + +<p>This function is used to set, clear or query the session object indirect +flag. If the second argument passed to this function is zero, then the +indirect flag is cleared. If it is greater than zero, the indirect flag +is set. Passing a value less than zero does not modify the current value +of the indirect flag, and may be used to query the current state of the +indirect flag for the specified session object.</p> + +<p>The return value indicates the final state of the indirect flag: 0 if +it is clear, or 1 if it is set. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_isempty.html b/www/session/sqlite3session_isempty.html new file mode 100644 index 0000000..56b9bf1 --- /dev/null +++ b/www/session/sqlite3session_isempty.html @@ -0,0 +1,135 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Test if a changeset has recorded any changes.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Test if a changeset has recorded any changes.</h2><blockquote><pre>int sqlite3session_isempty(sqlite3_session *pSession); +</pre></blockquote><p> +Return non-zero if no changes to attached tables have been recorded by +the session object passed as the first argument. Otherwise, if one or +more changes have been recorded, return zero.</p> + +<p>Even if this function returns zero, it is possible that calling +<a href="../session/sqlite3session_changeset.html">sqlite3session_changeset()</a> on the session handle may still return a +changeset that contains no changes. This can happen when a row in +an attached table is modified and then later on the original values +are restored. However, if this function returns non-zero, then it is +guaranteed that a call to sqlite3session_changeset() will return a +changeset containing zero changes. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_memory_used.html b/www/session/sqlite3session_memory_used.html new file mode 100644 index 0000000..bab4a0b --- /dev/null +++ b/www/session/sqlite3session_memory_used.html @@ -0,0 +1,126 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Query for the amount of heap memory used by a session object.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Query for the amount of heap memory used by a session object.</h2><blockquote><pre>sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession); +</pre></blockquote><p> +This API returns the total amount of heap memory in bytes currently +used by the session object passed as the only argument. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_object_config.html b/www/session/sqlite3session_object_config.html new file mode 100644 index 0000000..ecab92c --- /dev/null +++ b/www/session/sqlite3session_object_config.html @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Configure a Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Configure a Session Object</h2><blockquote><pre>int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); +</pre></blockquote><p> +This method is used to configure a session object after it has been +created. At present the only valid values for the second parameter are +<a href="../session/c_session_objconfig_rowid.html">SQLITE_SESSION_OBJCONFIG_SIZE</a> and <a href="../session/c_session_objconfig_rowid.html">SQLITE_SESSION_OBJCONFIG_ROWID</a>.</p> + +<p></p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_patchset.html b/www/session/sqlite3session_patchset.html new file mode 100644 index 0000000..ab0b191 --- /dev/null +++ b/www/session/sqlite3session_patchset.html @@ -0,0 +1,152 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Generate A Patchset From A Session Object</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Generate A Patchset From A Session Object</h2><blockquote><pre>int sqlite3session_patchset( + sqlite3_session *pSession, /* Session object */ + int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ + void **ppPatchset /* OUT: Buffer containing patchset */ +); +</pre></blockquote><p> +The differences between a patchset and a changeset are that:</p> + +<p><ul> + <li> DELETE records consist of the primary key fields only. The + original values of other fields are omitted. + <li> The original values of any modified fields are omitted from + UPDATE records. +</ul></p> + +<p>A patchset blob may be used with up to date versions of all +sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, +attempting to use a patchset blob with old versions of the +sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. </p> + +<p>Because the non-primary key "old.*" fields are omitted, no +SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset +is passed to the sqlite3changeset_apply() API. Other conflict types work +in the same way as for changesets.</p> + +<p>Changes within a patchset are ordered in the same way as for changesets +generated by the sqlite3session_changeset() function (i.e. all changes for +a single table are grouped together, tables appear in the order in which +they were attached to the session object). +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/session/sqlite3session_table_filter.html b/www/session/sqlite3session_table_filter.html new file mode 100644 index 0000000..77e20b3 --- /dev/null +++ b/www/session/sqlite3session_table_filter.html @@ -0,0 +1,136 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="../sqlite.css" rel="stylesheet"> +<title>Set a table filter on a Session Object.</title> +<!-- path=../ --> +</head> +<body> +<div class=nosearch> +<a href="../index.html"> +<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="../index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='../about.html'>About</a> +<li class='desktoponly'><a href="../docs.html">Documentation</a> +<li class='desktoponly'><a href="../download.html">Download</a> +<li class='wideonly'><a href='../copyright.html'>License</a> +<li class='desktoponly'><a href="../support.html">Support</a> +<li class='desktoponly'><a href="../prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='../about.html'>About</a> +<li><a href='../docs.html'>Documentation</a> +<li><a href='../download.html'>Download</a> +<li><a href='../support.html'>Support</a> +<li><a href='../prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="../search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<a href="../session/intro.html"><h2>Session Module C Interface</h2></a><h2>Set a table filter on a Session Object.</h2><blockquote><pre>void sqlite3session_table_filter( + sqlite3_session *pSession, /* Session object */ + int(*xFilter)( + void *pCtx, /* Copy of third arg to _filter_table() */ + const char *zTab /* Table name */ + ), + void *pCtx /* First argument passed to xFilter */ +); +</pre></blockquote><p> +The second argument (xFilter) is the "filter callback". For changes to rows +in tables that are not attached to the Session object, the filter is called +to determine whether changes to the table's rows should be tracked or not. +If xFilter returns 0, changes are not tracked. Note that once a table is +attached, xFilter will not be called again. +</p><p>See also lists of + <a href="../session/objlist.html">Objects</a>, + <a href="../session/constlist.html">Constants</a>, and + <a href="../session/funclist.html">Functions</a>.</p> + diff --git a/www/sessionintro.html b/www/sessionintro.html new file mode 100644 index 0000000..dbd4791 --- /dev/null +++ b/www/sessionintro.html @@ -0,0 +1,651 @@ +<!DOCTYPE html> +<html><head> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<link href="sqlite.css" rel="stylesheet"> +<title>The Session Extension</title> +<!-- path= --> +</head> +<body> +<div class=nosearch> +<a href="index.html"> +<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0"> +</a> +<div><!-- IE hack to prevent disappearing logo --></div> +<div class="tagline desktoponly"> +Small. Fast. Reliable.<br>Choose any three. +</div> +<div class="menu mainmenu"> +<ul> +<li><a href="index.html">Home</a> +<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> +<li class='wideonly'><a href='about.html'>About</a> +<li class='desktoponly'><a href="docs.html">Documentation</a> +<li class='desktoponly'><a href="download.html">Download</a> +<li class='wideonly'><a href='copyright.html'>License</a> +<li class='desktoponly'><a href="support.html">Support</a> +<li class='desktoponly'><a href="prosupport.html">Purchase</a> +<li class='search' id='search_menubutton'> +<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> +</ul> +</div> +<div class="menu submenu" id="submenu"> +<ul> +<li><a href='about.html'>About</a> +<li><a href='docs.html'>Documentation</a> +<li><a href='download.html'>Download</a> +<li><a href='support.html'>Support</a> +<li><a href='prosupport.html'>Purchase</a> +</ul> +</div> +<div class="searchmenu" id="searchmenu"> +<form method="GET" action="search"> +<select name="s" id="searchtype"> +<option value="d">Search Documentation</option> +<option value="c">Search Changelog</option> +</select> +<input type="text" name="q" id="searchbox" value=""> +<input type="submit" value="Go"> +</form> +</div> +</div> +<script> +function toggle_div(nm) { +var w = document.getElementById(nm); +if( w.style.display=="block" ){ +w.style.display = "none"; +}else{ +w.style.display = "block"; +} +} +function toggle_search() { +var w = document.getElementById("searchmenu"); +if( w.style.display=="block" ){ +w.style.display = "none"; +} else { +w.style.display = "block"; +setTimeout(function(){ +document.getElementById("searchbox").focus() +}, 30); +} +} +function div_off(nm){document.getElementById(nm).style.display="none";} +window.onbeforeunload = function(e){div_off("submenu");} +/* Disable the Search feature if we are not operating from CGI, since */ +/* Search is accomplished using CGI and will not work without it. */ +if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ +document.getElementById("search_menubutton").style.display = "none"; +} +/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ +function hideorshow(btn,obj){ +var x = document.getElementById(obj); +var b = document.getElementById(btn); +if( x.style.display!='none' ){ +x.style.display = 'none'; +b.innerHTML='show'; +}else{ +x.style.display = ''; +b.innerHTML='hide'; +} +return false; +} +var antiRobot = 0; +function antiRobotGo(){ +if( antiRobot!=3 ) return; +antiRobot = 7; +var j = document.getElementById("mtimelink"); +if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); +} +function antiRobotDefense(){ +document.body.onmousedown=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousedown=null; +} +document.body.onmousemove=function(){ +antiRobot |= 2; +antiRobotGo(); +document.body.onmousemove=null; +} +setTimeout(function(){ +antiRobot |= 1; +antiRobotGo(); +}, 100) +antiRobotGo(); +} +antiRobotDefense(); +</script> +<div class=fancy> +<div class=nosearch> +<div class="fancy_title"> +The Session Extension +</div> +<div class="fancy_toc"> +<a onclick="toggle_toc()"> +<span class="fancy_toc_mark" id="toc_mk">►</span> +Table Of Contents +</a> +<div id="toc_sub"><div class="fancy-toc1"><a href="#introduction">1. Introduction</a></div> +<div class="fancy-toc2"><a href="#typical_use_case">1.1. Typical Use Case</a></div> +<div class="fancy-toc2"><a href="#obtaining_the_session_extension">1.2. Obtaining the Session Extension</a></div> +<div class="fancy-toc2"><a href="#limitations">1.3. Limitations</a></div> +<div class="fancy-toc1"><a href="#concepts">2. Concepts</a></div> +<div class="fancy-toc2"><a href="#changesets_and_patchsets">2.1. Changesets and Patchsets</a></div> +<div class="fancy-toc2"><a href="#conflicts">2.2. Conflicts</a></div> +<div class="fancy-toc2"><a href="#changeset_construction">2.3. Changeset Construction</a></div> +<div class="fancy-toc1"><a href="#using_the_session_extension">3. Using The Session Extension</a></div> +<div class="fancy-toc2"><a href="#capturing_a_changeset">3.1. Capturing a Changeset</a></div> +<div class="fancy-toc2"><a href="#applying_a_changeset_to_a_database">3.2. Applying a Changeset to a Database</a></div> +<div class="fancy-toc2"><a href="#inspecting_the_contents_of_a_changeset">3.3. Inspecting the Contents of a Changeset</a></div> +<div class="fancy-toc1"><a href="#extended_functionality">4. Extended Functionality</a></div> +</div> +</div> +<script> +function toggle_toc(){ +var sub = document.getElementById("toc_sub") +var mk = document.getElementById("toc_mk") +if( sub.style.display!="block" ){ +sub.style.display = "block"; +mk.innerHTML = "▼"; +} else { +sub.style.display = "none"; +mk.innerHTML = "►"; +} +} +</script> +</div> + + + + + +<h1 id="introduction"><span>1. </span>Introduction</h1> + +<p>The session extension provide a mechanism for conviently recording +changes to some or all of certain tables in an SQLite database, and +packaging those changes into a "changeset" or "patchset" file that can +later be used to apply the same set of changes to another database with +the same schema and compatible starting data. A "changeset" may +also be inverted and used to "undo" a session. + +</p><p>This document is an introduction to the session extension. +The details of the interface are in the separate +<a href="session/intro.html">Session Extension C-language Interface</a> document. + +</p><h2 id="typical_use_case"><span>1.1. </span>Typical Use Case</h2> + +<p>Suppose SQLite is used as the <a href="appfileformat.html">application file format</a> for a +particular design application. Two users, Alice and Bob, each start +with a baseline design that is about a gigabyte in size. They work +all day, in parallel, each making their own customizations and tweaks +to the design. At the end of the day, they would like to merge their +changes together into a single unified design. + +</p><p>The session extension facilitates this by recording all changes to +both Alice's and Bob's databases and writing those changes into +changeset or patchset files. At the end of the day, Alice can send her +changeset to Bob and Bob can "apply" it to his database. The result (assuming +there are no conflicts) is that Bob's database then contains both his +changes and Alice's changes. Likewise, Bob can send a changeset of +his work over to Alice and she can apply his changes to her database. + +</p><p>In other words, the session extension provides a facility for +SQLite database files that is similar to the unix +<a href="https://en.wikipedia.org/wiki/Patch_(Unix)">patch</a> utility program, +or to the "merge" capabilities of version control systems such +as <a href="https://www.fossil-scm.org/">Fossil</a>, <a href="https://git-scm.com">Git</a>, +or <a href="http://www.mercurial-scm.org/">Mercurial</a>. + +</p><h2 id="obtaining_the_session_extension"><span>1.2. </span>Obtaining the Session Extension</h2> + +<p> Since <a href="releaselog/3_13_0.html">version 3.13.0</a> (2016-05-18), +the session extension has been included in the SQLite +<a href="amalgamation.html">amalgamation</a> source distribution. By default, the session extension is +disabled. To enable it, build with the following compiler switches: + +</p><div class="codeblock"><pre>-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK +</pre></div> + +<p> Or, if using the autoconf build system, +pass the --enable-session option to the configure script. + +</p><h2 id="limitations"><span>1.3. </span>Limitations</h2> + +<ul> + +<li><p> Prior to SQLite version 3.17.0, the session extension only worked with + <a href="rowidtable.html">rowid tables</a>, not <a href="withoutrowid.html">WITHOUT ROWID</a> tables. As of 3.17.0, both + rowid and WITHOUT ROWID tables are supported. However, extra steps are + needed to record primary keys for WITHOUT ROWID table changes. + +</p></li><li><p> There is no support for <a href="vtab.html">virtual tables</a>. Changes to virtual tables are + not captured. + +</p></li><li><p> The session extension only works with tables that have a declared + PRIMARY KEY. The PRIMARY KEY of a table may be an INTEGER PRIMARY KEY + (rowid alias) or an external PRIMARY KEY. + +</p></li><li><p> SQLite allows <a href="nulls.html">NULL values</a> to be stored in + PRIMARY KEY columns. However, the session extension ignores all + such rows. No changes affecting rows with one or more NULL values + in PRIMARY KEY columns are recorded by the sessions module. +</p></li></ul> + +<h1 id="concepts"><span>2. </span>Concepts</h1> + +<a name="changeset"></a> + +<h2 id="changesets_and_patchsets"><span>2.1. </span>Changesets and Patchsets</h2> +<p> The sessions module revolves around creating and manipulating +changesets. A changeset is a blob of data that encodes a series of +changes to a database. Each change in a changeset is one of the +following: + +</p><ul> + <li> <p>An <b>INSERT</b>. An INSERT change contains a single row to add to + a database table. The payload of the INSERT change consists of the + values for each field of the new row. + + </p></li><li> <p>A <b>DELETE</b>. A DELETE change represents a row, identified by + its primary key values, to remove from a database table. The payload + of a DELETE change consists of the values for all fields of the + deleted row. + + </p></li><li> <p>An <b>UPDATE</b>. An UPDATE change represents the modification of + one or more non-PRIMARY KEY fields of a single row within a database + table, identified by its PRIMARY KEY fields. The payload for an UPDATE + change consists of: + </p><ul> + <li> The PRIMARY KEY values identifying the modified row, + </li><li> The new values for each modified field of the row, and + </li><li> The original values for each modified field of the row. + </li></ul> + <p> An UPDATE change does not contain any information regarding + non-PRIMARY KEY fields that are not modified by the change. It is not + possible for an UPDATE change to specify modifications to PRIMARY + KEY fields. +</p></li></ul> + +<p> A single changeset may contain changes that apply to more than one +database table. For each table that the changeset includes at least one change +for, it also encodes the following data: + +</p><ul> + <li> The name of the database table, + </li><li> The number of columns the table has, and + </li><li> Which of those columns are PRIMARY KEY columns. +</li></ul> + +<p> Changesets may only be applied to databases that contain tables +matching the above three criteria as stored in the changeset. + +</p><p> A patchset is similar to a changeset. It is slightly more compact than +a changeset, but provides more limited conflict detection and resolution +options (see the next section for details). The differences between a +patchset and a changeset are that: + +</p><ul> + <li><p> For a <b>DELETE</b> change, the payload consists of the PRIMARY KEY + fields only. The original values of other fields are not stored as + part of a patchset. + + </p></li><li><p> For an <b>UPDATE</b> change, the payload consists of the PRIMARY KEY + fields and the new values of modified fields only. The original + values of modified fields are not stored as part of a patchset. +</p></li></ul> + +<h2 id="conflicts"><span>2.2. </span>Conflicts</h2> + +<p> When a changeset or patchset is applied to a database, an attempt is +made to insert a new row for each INSERT change, remove a row for each +DELETE change and modify a row for each UPDATE change. If the target +database is in the same state as the original database that the changeset +was recorded on, this is a simple matter. However, if the contents of the +target database is not in exactly this state, conflicts can occur when +applying the changeset or patchset. + +</p><p>When processing an <b>INSERT</b> change, the following conflicts can +occur: + +</p><ul> + <li> The target database may already contain a row with the same PRIMARY + KEY values as specified by the INSERT change. + + </li><li> Some other database constraint, for example a UNIQUE or CHECK + constraint, may be violated when the new row is inserted. +</li></ul> + +<p>When processing a <b>DELETE</b> change, the following conflicts may be +detected: + +</p><ul> + <li> The target database may contain no row with the specified PRIMARY + KEY values to delete. + + </li><li> The target database may contain a row with the specified PRIMARY + KEY values, but the other fields may contain values that do not + match those stored as part of the changeset. This type of conflict + is not detected when using a patchset. +</li></ul> + +<p>When processing an <b>UPDATE</b> change, the following conflicts may be +detected: + +</p><ul> + <li> The target database may contain no row with the specified PRIMARY + KEY values to modify. + + </li><li> The target database may contain a row with the specified PRIMARY + KEY values, but the current values of the fields that will be modified + by the change may not match the original values stored within the + changeset. This type of conflict is not detected when using a patchset. + + </li><li> Some other database constraint, for example a UNIQUE or CHECK + constraint, may be violated when the row is updated. +</li></ul> + +<p> Depending on the type of conflict, a sessions application has a variety +of configurable options for dealing with conflicts, ranging from omitting the +conflicting change, aborting the entire changeset application or applying +the change despite the conflict. For details, refer to the documentation for +the <a href="session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a> API. + +</p><h2 id="changeset_construction"><span>2.3. </span>Changeset Construction</h2> + +<p> After a session object has been configured, it begins monitoring for +changes to its configured tables. However, it does not record an entire +change each time a row within the database is modified. Instead, it records +just the PRIMARY KEY fields for each inserted row, and just the PRIMARY KEY +and all original row values for any updated or deleted rows. If a row is +modified more than once by a single session, no new information is recorded. + +</p><p> The other information required to create a changeset or patchset is +read from the database file when <a href="session/sqlite3session_changeset.html">sqlite3session_changeset()</a> or +<a href="session/sqlite3session_patchset.html">sqlite3session_patchset()</a> is called. Specifically, + +</p><ul> + <li> <p>For each primary key recorded as a result of an INSERT operation, + the sessions module checks if there is a row with a matching primary + key still in the table. If so, an INSERT change is added to the + changeset. + + </p></li><li> <p>For each primary key recorded as a result of an UPDATE or DELETE + operation, the sessions module also checks for a row with a matching + primary key within the table. If one can be found, but one or more + of the non-PRIMARY KEY fields does not match the original recorded + value, an UPDATE is added to the changeset. Or, if there is no row + at all with the specified primary key, a DELETE is added to the + changeset. If the row does exist but none of the non-PRIMARY KEY + fields have been modified, no change is added to the changeset. +</p></li></ul> + +<p> One implication of the above is that if a change is made and then +unmade within a single session (for example if a row is inserted and then +deleted again), the sessions module does not report any change at all. Or +if a row is updated multiple times within the same session, all updates +are coalesced into a single update within any changeset or patchset blob. + +</p><h1 id="using_the_session_extension"><span>3. </span>Using The Session Extension</h1> + +<p> This section provides examples that demonstrate how to use the sessions + extension. + +</p><h2 id="capturing_a_changeset"><span>3.1. </span>Capturing a Changeset</h2> + +<p> The example code below demonstrates the steps involved in capturing a +changeset while executing SQL commands. In summary: + +</p><ol> + <li> <p>A session object (type sqlite3_session*) is created by making a + call to the <a href="session/sqlite3session_create.html">sqlite3session_create()</a> API function. + + </p><p>A single session object monitors changes made to a single database + (i.e. "main", "temp" or an attached database) via a single + sqlite3* database handle. + + </p></li><li> <p>The session object is configured with a set of tables to monitor + changes on. + + </p><p> By default a session object does not monitor changes on any + database table. Before it does so it must be configured. There + are three ways to configure the set of tables to monitor changes + on: + </p><ul> + <li> By explicitly specifying tables using one call to + <a href="session/sqlite3session_attach.html">sqlite3session_attach()</a> for each table, or + + </li><li> By specifying that all tables in the database should be monitored + for changes using a call to <a href="session/sqlite3session_attach.html">sqlite3session_attach()</a> with a + NULL argument, or + + </li><li> By configuring a callback to be invoked the first time each table + is written to that indicates to the session module whether or + not changes on the table should be monitored. + </li></ul> + <p> The example code below uses the second of the methods enumerated + above - it monitors for changes on all database tables. + + </p></li><li> <p> Changes are made to the database by executing SQL statements. The + session object records these changes. + + </p></li><li> <p> A changeset blob is extracted from the session object using a call + to <a href="session/sqlite3session_changeset.html">sqlite3session_changeset()</a> (or, if using patchsets, a call to + the <a href="session/sqlite3session_patchset.html">sqlite3session_patchset()</a> function). + + </p></li><li> <p> The session object is deleted using a call to the + <a href="session/sqlite3session_delete.html">sqlite3session_delete()</a> API function. + + </p><p> It is not necessary to delete a session object after extracting + a changeset or patchset from it. It can be left attached to the + database handle and will continue monitoring for changes on the + configured tables as before. However, if + <a href="session/sqlite3session_changeset.html">sqlite3session_changeset()</a> or <a href="session/sqlite3session_patchset.html">sqlite3session_patchset()</a> is + called a second time on a session object, the changeset or patchset + will contain <em>all</em> changes that have taken place on the connection + since the session was created. In other words, + a session object is not reset or + zeroed by a call to sqlite3session_changeset() or + sqlite3session_patchset(). +</p></li></ol> + +<div class="codeblock"><pre><i>/* +** Argument zSql points to a buffer containing an SQL script to execute +** against the database handle passed as the first argument. As well as +** executing the SQL script, this function collects a changeset recording +** all changes made to the "main" database file. Assuming no error occurs, +** output variables (*ppChangeset) and (*pnChangeset) are set to point +** to a buffer containing the changeset and the size of the changeset in +** bytes before returning SQLITE_OK. In this case it is the responsibility +** of the caller to eventually free the changeset blob by passing it to +** the sqlite3_free function. +** +** Or, if an error does occur, return an SQLite error code. The final +** value of (*pChangeset) and (*pnChangeset) are undefined in this case. +*/</i> +int sql_exec_changeset( + sqlite3 *db, <i>/* Database handle */</i> + const char *zSql, <i>/* SQL script to execute */</i> + int *pnChangeset, <i>/* OUT: Size of changeset blob in bytes */</i> + void **ppChangeset <i>/* OUT: Pointer to changeset blob */</i> +){ + sqlite3_session *pSession = 0; + int rc; + + <i>/* Create a new session object */</i> + rc = sqlite3session_create(db, "main", &pSession); + + <i>/* Configure the session object to record changes to all tables */</i> + if( rc==SQLITE_OK ) rc = sqlite3session_attach(pSession, NULL); + + <i>/* Execute the SQL script */</i> + if( rc==SQLITE_OK ) rc = sqlite3_exec(db, zSql, 0, 0, 0); + + <i>/* Collect the changeset */</i> + if( rc==SQLITE_OK ){ + rc = sqlite3session_changeset(pSession, pnChangeset, ppChangeset); + } + + <i>/* Delete the session object */</i> + sqlite3session_delete(pSession); + + return rc; +} +</pre></div> + +<h2 id="applying_a_changeset_to_a_database"><span>3.2. </span>Applying a Changeset to a Database</h2> + +<p> Applying a changeset to a database is simpler than capturing a changeset. +Usually, a single call to <a href="session/sqlite3changeset_apply.html">sqlite3changeset_apply()</a>, as depicted in the +example code below, suffices. + +</p><p> In cases where it is complicated, the complications in applying a +changeset lie in conflict resolution. Refer to the API documentation linked +above for details. + + </p><div class="codeblock"><pre><i>/* +** Conflict handler callback used by apply_changeset(). See below. +*/</i> +static int xConflict(void *pCtx, int eConflict, sqlite3_changset_iter *pIter){ + int ret = (int)pCtx; + return ret; +} + +<i>/* +** Apply the changeset contained in blob pChangeset, size nChangeset bytes, +** to the main database of the database handle passed as the first argument. +** Return SQLITE_OK if successful, or an SQLite error code if an error +** occurs. +** +** If parameter bIgnoreConflicts is true, then any conflicting changes +** within the changeset are simply ignored. Or, if bIgnoreConflicts is +** false, then this call fails with an SQLTIE_ABORT error if a changeset +** conflict is encountered. +*/</i> +int apply_changeset( + sqlite3 *db, <i>/* Database handle */</i> + int bIgnoreConflicts, <i>/* True to ignore conflicting changes */</i> + int nChangeset, <i>/* Size of changeset in bytes */</i> + void *pChangeset <i>/* Pointer to changeset blob */</i> +){ + return sqlite3changeset_apply( + db, + nChangeset, pChangeset, + 0, xConflict, + (void*)bIgnoreConflicts + ); +} +</pre></div> + +<h2 id="inspecting_the_contents_of_a_changeset"><span>3.3. </span>Inspecting the Contents of a Changeset</h2> + +<p> The example code below demonstrates the techniques used to iterate +through and extract the data related to all changes in a changeset. To +summarize: + +</p><ol> + <li><p> The <a href="session/sqlite3changeset_start.html">sqlite3changeset_start()</a> API is called to create and + initialize an iterator to iterate through the contents of a + changeset. Initially, the iterator points to no element at all. + + </p></li><li><p> The first call to <a href="session/sqlite3changeset_next.html">sqlite3changeset_next()</a> on the iterator moves + it to point to the first change in the changeset (or to EOF, if + the changeset is completely empty). sqlite3changeset_next() returns + SQLITE_ROW if it moves the iterator to point to a valid entry, + SQLITE_DONE if it moves the iterator to EOF, or an SQLite error + code if an error occurs. + + </p></li><li><p> If the iterator points to a valid entry, the <a href="session/sqlite3changeset_op.html">sqlite3changeset_op()</a> + API may be used to determine the type of change (INSERT, UPDATE or + DELETE) that the iterator points to. Additionally, the same API + can be used to obtain the name of the table the change applies to + and its expected number of columns and primary key columns. + + </p></li><li><p> If the iterator points to a valid INSERT or UPDATE entry, the + <a href="session/sqlite3changeset_new.html">sqlite3changeset_new()</a> API may be used to obtain the new.* values + within the change payload. + + </p></li><li><p> If the iterator points to a valid DELETE or UPDATE entry, the + <a href="session/sqlite3changeset_old.html">sqlite3changeset_old()</a> API may be used to obtain the old.* values + within the change payload. + + </p></li><li><p> An iterator is deleted using a call to the + <a href="session/sqlite3changeset_finalize.html">sqlite3changeset_finalize()</a> API. If an error occured while + iterating, an SQLite error code is returned (even if the same error + code has already been returned by sqlite3changeset_next()). Or, + if no error has occurred, SQLITE_OK is returned. +</p></li></ol> + + <div class="codeblock"><pre><i>/* +** Print the contents of the changeset to stdout. +*/</i> +static int print_changeset(void *pChangeset, int nChangeset){ + int rc; + sqlite3_changeset_iter *pIter = 0; + + <i>/* Create an iterator to iterate through the changeset */</i> + rc = sqlite3changeset_start(&pIter, nChangeset, pChangeset); + if( rc!=SQLITE_OK ) return rc; + + <i>/* This loop runs once for each change in the changeset */</i> + while( SQLITE_ROW==sqlite3changeset_next(pIter) ){ + const char *zTab; <i>/* Table change applies to */</i> + int nCol; <i>/* Number of columns in table zTab */</i> + int op; <i>/* SQLITE_INSERT, UPDATE or DELETE */</i> + sqlite3_value *pVal; + + <i>/* Print the type of operation and the table it is on */</i> + rc = sqlite3changeset_op(pIter, &zTab, &nCol, &op, 0); + if( rc!=SQLITE_OK ) goto exit_print_changeset; + printf("%s on table %s\n", + op==SQLITE_INSERT?"INSERT" : op==SQLITE_UPDATE?"UPDATE" : "DELETE", + zTab + ); + + <i>/* If this is an UPDATE or DELETE, print the old.* values */</i> + if( op==SQLITE_UPDATE || op==SQLITE_DELETE ){ + printf("Old values:"); + for(i=0; i<nCol; i++){ + rc = sqlite3changeset_old(pIter, i, &pVal); + if( rc!=SQLITE_OK ) goto exit_print_changeset; + printf(" %s", pVal ? sqlite3_value_text(pVal) : "-"); + } + printf("\n"); + } + + <i>/* If this is an UPDATE or INSERT, print the new.* values */</i> + if( op==SQLITE_UPDATE || op==SQLITE_INSERT ){ + printf("New values:"); + for(i=0; i<nCol; i++){ + rc = sqlite3changeset_new(pIter, i, &pVal); + if( rc!=SQLITE_OK ) goto exit_print_changeset; + printf(" %s", pVal ? sqlite3_value_text(pVal) : "-"); + } + printf("\n"); + } + } + + <i>/* Clean up the changeset and return an error code (or SQLITE_OK) */</i> + exit_print_changeset: + rc2 = sqlite3changeset_finalize(pIter); + if( rc==SQLITE_OK ) rc = rc2; + return rc; +} +</pre></div> + +<h1 id="extended_functionality"><span>4. </span>Extended Functionality</h1> + +<p> Most applications will only use the session module functionality described +in the previous section. However, the following additional functionality is +available for the use and manipulation of changeset and patchset blobs: + +</p><ul> + <li> <p>Two or more changeset/patchsets may be combined using the + <a href="session/sqlite3changeset_concat.html">sqlite3changeset_concat()</a> or <a href="session/changegroup.html">sqlite3_changegroup</a> interfaces. + + </p></li><li> <p>A changeset may be "inverted" using the <a href="session/sqlite3changeset_invert.html">sqlite3changeset_invert()</a> + API function. An inverted changeset undoes the changes made by the + original. If changeset C<sup>+</sup> is the inverse of changeset C, then + applying C and then C<sup>+</sup> to a database should leave + the database unchanged. +</p></li></ul><p align="center"><small><i>This page last modified on <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink" data-href="https://sqlite.org/docsrc/finfo/pages/sessionintro.in?m=682990e565">2023-01-07 01:13:01</a> UTC </small></i></p> + |