| Index: third_party/sqlite_google/src/btree.c |
| =================================================================== |
| --- third_party/sqlite_google/src/btree.c (revision 1753) |
| +++ third_party/sqlite_google/src/btree.c (working copy) |
| @@ -29,6 +29,12 @@ |
| */ |
| static const char zPoisonHeader[] = "SQLite poison 3"; |
| +/* |
| +** The user cookie position in the database meta information |
| +** (see prepare.c#215), incremented by one, because first position is actually |
| +** the number of free pages in Btree (see vdbe.c#2521) |
| +*/ |
| +static const int kUserCookie = 6; |
| /* |
| ** Set this global variable to 1 to enable tracing using the TRACE |
| @@ -6422,3 +6428,32 @@ |
| } |
| #endif |
| + |
| +int sqlite3_get_user_version(sqlite3 *sqlite, int *user_version) { |
|
Scott.Hess
2008/06/04 17:48:56
Did you copy 'sqlite3 *sqlite' from somewhere? If
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> Did yo
|
| + Btree *bt; |
| + |
| + if( sqlite == NULL ) return SQLITE_ERROR; |
|
Scott.Hess
2008/06/04 17:48:56
SQLite style is 'sqlite==NULL' rather than 'sqlite
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> SQLite
|
| + if( sqlite->nDb<1 ) return SQLITE_ERROR; |
| + |
| + /* Grab main database. */ |
| + bt = sqlite->aDb[0].pBt; |
| + /* Because sqlite3BtreeGetMeta sets a table read lock, it is safe to use |
| + ** without explicit read transaction. Besides, it is very unlikely we will |
| + ** ever call this outside of a transaction. |
| + */ |
|
Scott.Hess
2008/06/04 17:48:56
Suggest dropping the caveat about unlikely things.
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> Sugges
|
| + return sqlite3BtreeGetMeta(bt, kUserCookie, (u32 *)user_version); |
|
Scott.Hess
2008/06/04 17:48:56
Why the cast? Alternate phrasing: Why isn't user_
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> Why th
|
| +} |
| + |
| +int sqlite3_set_user_version(sqlite3 *sqlite, int user_version) { |
|
Scott.Hess
2008/06/04 17:48:56
Comparable comments to above on sqlite/db and user
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> Compar
|
| + Btree *bt; |
| + |
| + if( sqlite == NULL ) return SQLITE_ERROR; |
|
Scott.Hess
2008/06/04 17:48:56
No spaces around ==.
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> No spa
|
| + if( sqlite->nDb<1 ) return SQLITE_ERROR; |
| + |
| + bt = sqlite->aDb[0].pBt; |
| + |
| + /* If called outside of a transaction, report misuse. */ |
| + if( bt->inTrans != TRANS_WRITE ) return SQLITE_MISUSE; |
|
Scott.Hess
2008/06/04 17:48:56
No spaces around !=.
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> No spa
|
| + |
| + return sqlite3BtreeUpdateMeta(bt, kUserCookie, (u32)user_version); |
|
Scott.Hess
2008/06/04 17:48:56
Comparable comment as above around cast.
Dimitri
2008/06/11 01:31:57
On 2008/06/04 17:48:56, Scott.Hess wrote:
> Compar
|
| +} |