Documentation Source Text

Check-in [3dded2adf9]
Login

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

Overview
Comment:Added preliminary documentation for the SAVEPOINT methods in virtual tables.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3dded2adf9d37c9e1c30e2c266f4e122e82360f0
User & Date: drh 2011-05-24 00:52:41.517
Context
2011-05-25
14:51
A tweak to the 8+3 filename documentation. Update to the change log. (check-in: 6f298c3ff3 user: drh tags: trunk)
2011-05-24
00:52
Added preliminary documentation for the SAVEPOINT methods in virtual tables. (check-in: 3dded2adf9 user: drh tags: trunk)
00:44
Restrict website search text to omit non-alphanumeric characters. (check-in: 2528553d5a user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/vtab.in.
211
212
213
214
215
216
217





218
219
220
221
222
223
224
    int (*xSync)(sqlite3_vtab *pVTab);
    int (*xCommit)(sqlite3_vtab *pVTab);
    int (*xRollback)(sqlite3_vtab *pVTab);
    int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
                       void **ppArg);
    int (*Rename)(sqlite3_vtab *pVtab, const char *zNew);





  };
</pre></blockquote>

<p>The module structure defines all of the methods for each virtual 
table object. The module structure also contains the iVersion field which
defines the particular edition of the module table structure. Currently, 
iVersion is always 1, but in future releases of SQLite the module structure 







>
>
>
>
>







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    int (*xSync)(sqlite3_vtab *pVTab);
    int (*xCommit)(sqlite3_vtab *pVTab);
    int (*xRollback)(sqlite3_vtab *pVTab);
    int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
                       void **ppArg);
    int (*Rename)(sqlite3_vtab *pVtab, const char *zNew);
    /* The methods above are in version 1 of the sqlite_module object. Those 
    ** below are for version 2 and greater. */
    int (*xSavepoint)(sqlite3_vtab *pVTab, int);
    int (*xRelease)(sqlite3_vtab *pVTab, int);
    int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
  };
</pre></blockquote>

<p>The module structure defines all of the methods for each virtual 
table object. The module structure also contains the iVersion field which
defines the particular edition of the module table structure. Currently, 
iVersion is always 1, but in future releases of SQLite the module structure 
1081
1082
1083
1084
1085
1086
1087





































<p>This method provides notification that the virtual table implementation
that the virtual table will be given a new name. 
If this method returns [SQLITE_OK] then SQLite renames the table.
If this method returns an [error code] then the renaming is prevented.

<p>The xRename method is required for every virtual table implementation.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128

<p>This method provides notification that the virtual table implementation
that the virtual table will be given a new name. 
If this method returns [SQLITE_OK] then SQLite renames the table.
If this method returns an [error code] then the renaming is prevented.

<p>The xRename method is required for every virtual table implementation.

<tcl>############################################################# xSavepoint
hd_fragment xsavepoint {sqlite3_module.xSavepoint} {xSavepoint}\
  xRelease xRollbackTo</tcl>
<h3>2.20 The xSavepoint, xRelease, and xRollbackTo Methods</h3>

<blockquote><pre>
  int (*xSavepoint)(sqlite3_vtab *pVtab, int);
  int (*xRelease)(sqlite3_vtab *pVtab, int);
  int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
</pre></blockquote>

<p>
These methods provide the virtual table implementation an opportunity to
implement nested transactions.  They are always optional and will only be
called in SQLite [version 3.7.7] and later.
</p>

<p>
^When xSavepoint(X,N) is invoked, that is a signal to the virtual table X
that it should save its current state as savepoint N.  
^A subsequent call
to xRollbackTo(X,R) means that the state of the virtual table should return
to what it was when xSavepoint(X,R) was last called.  
^The call
to xRollbackTo(X,R) will invalidate all savepoints with N>R; none of the
invalided savepoints will be rolled back or released without first
being reinitialized by a call to xSavepoint().  
^A call to xRelease(X,M) invalidates all savepoints where N>=M.
</p>

<p>
^None of the xSavepoint(), xRelease(), or xRollbackTo() methods will ever
be called except in between calls to xBegin() and 
either xCommit() or xRollback().
</p>