| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 ** 2004 April 6 | 2 ** 2004 April 6 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 6411 matching lines...) Show 10 above Show 10 below | |
| 6422 return sqlite3BtreeCommit(p); | 6422 return sqlite3BtreeCommit(p); |
| 6423 | 6423 |
| 6424 err: | 6424 err: |
| 6425 /* TODO(shess): What about errors, here? */ | 6425 /* TODO(shess): What about errors, here? */ |
| 6426 sqlite3BtreeRollback(p); | 6426 sqlite3BtreeRollback(p); |
| 6427 return rc; | 6427 return rc; |
| 6428 } | 6428 } |
| 6429 | 6429 |
| 6430 #endif | 6430 #endif |
| 6431 | 6431 |
| 6432 int sqlite3_get_user_version(sqlite3 *sqlite, int *user_version) { | 6432 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
| |
| 6433 Btree *bt; | 6433 Btree *bt; |
| 6434 | 6434 |
| 6435 if( sqlite == NULL ) return SQLITE_ERROR; | 6435 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
| |
| 6436 if( sqlite->nDb<1 ) return SQLITE_ERROR; | 6436 if( sqlite->nDb<1 ) return SQLITE_ERROR; |
| 6437 | 6437 |
| 6438 /* Grab main database. */ | 6438 /* grab actual (not temporary tables) database */ |
|
Scott.Hess
2008/05/22 23:44:28
Comments should mostly be composed of sentences.
Dimitri
2008/06/04 03:02:16
On 2008/05/22 23:44:28, Scott.Hess wrote:
> Commen
| |
| 6439 bt = sqlite->aDb[0].pBt; | 6439 bt = sqlite->aDb[0].pBt; |
| 6440 /* Because sqlite3BtreeGetMeta sets a table read lock, it is safe to use | 6440 /* because sqlite3BtreeGetMeta sets a table read lock, it is safe to use |
| 6441 ** without explicit read transaction. Besides, it is very unlikely we will | 6441 ** without explicit read transaction. Besides, it is very unlikely we will |
| 6442 ** ever call this outside of a transaction. | 6442 ** ever call this outside of a transaction. |
| 6443 */ | 6443 */ |
|
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
| |
| 6444 return sqlite3BtreeGetMeta(bt, kUserCookie, (u32 *)user_version); | 6444 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
| |
| 6445 } | 6445 } |
| 6446 | 6446 |
| 6447 int sqlite3_set_user_version(sqlite3 *sqlite, int user_version) { | 6447 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
| |
| 6448 Btree *bt; | 6448 Btree *bt; |
| 6449 int rc; | |
| 6449 | 6450 |
| 6450 if( sqlite == NULL ) return SQLITE_ERROR; | 6451 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
| |
| 6451 if( sqlite->nDb<1 ) return SQLITE_ERROR; | 6452 if( sqlite->nDb<1 ) return SQLITE_ERROR; |
| 6452 | 6453 |
| 6453 bt = sqlite->aDb[0].pBt; | 6454 bt = sqlite->aDb[0].pBt; |
| 6454 | 6455 if( bt->inTrans!= TRANS_WRITE ) { |
|
Scott.Hess
2008/05/22 23:44:28
Shouldn't this be ==? No space after = sign in an
Dimitri
2008/06/04 03:02:16
On 2008/05/22 23:44:28, Scott.Hess wrote:
> Should
| |
| 6455 /* If called outside of a transaction, report misuse. */ | 6456 return sqlite3BtreeUpdateMeta(bt, kUserCookie, (u32)user_version); |
| 6456 if( bt->inTrans != TRANS_WRITE ) return SQLITE_MISUSE; | 6457 }else{ |
|
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
| |
| 6457 | 6458 /* transacion isn't already in progress, have to enclose in |
| 6458 return sqlite3BtreeUpdateMeta(bt, kUserCookie, (u32)user_version); | 6459 ** a write-transaction |
|
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
| |
| 6459 } | 6460 */ |
|
Scott.Hess
2008/05/22 23:44:28
sp on first occurrence of transaction. Revise com
| |
| 6461 rc = sqlite3BtreeBeginTrans(bt, 1); | |
| 6462 if( rc!=SQLITE_OK ) return rc; | |
| 6463 rc = sqlite3BtreeUpdateMeta(bt, kUserCookie, (u32)user_version); | |
| 6464 if( rc==SQLITE_OK ) return sqlite3BtreeCommit(bt); | |
| 6465 sqlite3BtreeRollback(bt); | |
| 6466 return rc; | |
|
Scott.Hess
2008/05/22 23:44:28
For Database2, is it even possible to get to this
Dimitri
2008/06/04 03:02:16
On 2008/05/22 23:44:28, Scott.Hess wrote:
> For Da
| |
| 6467 } | |
| 6468 } | |
|
Scott.Hess
2008/05/22 23:44:28
Sorry to be a pain, I'm trying to recall why we're
Dimitri
2008/06/04 03:02:16
On 2008/05/22 23:44:28, Scott.Hess wrote:
> Sorry
| |
| LEFT | RIGHT |