OLD | NEW |
1 /* | 1 /* |
2 ** 2001 September 15 | 2 ** 2001 September 15 |
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 ** Return a pointer to a page from the database. | 303 ** Return a pointer to a page from the database. |
304 */ | 304 */ |
305 static int page_get( | 305 static int page_get( |
306 void *NotUsed, | 306 void *NotUsed, |
307 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 307 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
308 int argc, /* Number of arguments */ | 308 int argc, /* Number of arguments */ |
309 const char **argv /* Text of each argument */ | 309 const char **argv /* Text of each argument */ |
310 ){ | 310 ){ |
311 Pager *pPager; | 311 Pager *pPager; |
312 char zBuf[100]; | 312 char zBuf[100]; |
313 DbPage *pPage; | 313 DbPage *pPage = 0; |
314 int pgno; | 314 int pgno; |
315 int rc; | 315 int rc; |
316 if( argc!=3 ){ | 316 if( argc!=3 ){ |
317 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], | 317 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], |
318 " ID PGNO\"", 0); | 318 " ID PGNO\"", 0); |
319 return TCL_ERROR; | 319 return TCL_ERROR; |
320 } | 320 } |
321 pPager = sqlite3TestTextToPtr(argv[1]); | 321 pPager = sqlite3TestTextToPtr(argv[1]); |
322 if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR; | 322 if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR; |
323 rc = sqlite3PagerSharedLock(pPager); | 323 rc = sqlite3PagerSharedLock(pPager); |
324 if( rc==SQLITE_OK ){ | 324 if( rc==SQLITE_OK ){ |
325 rc = sqlite3PagerGet(pPager, pgno, &pPage); | 325 rc = sqlite3PagerGet(pPager, pgno, &pPage, 0); |
326 } | 326 } |
327 if( rc!=SQLITE_OK ){ | 327 if( rc!=SQLITE_OK ){ |
328 Tcl_AppendResult(interp, sqlite3ErrName(rc), 0); | 328 Tcl_AppendResult(interp, sqlite3ErrName(rc), 0); |
329 return TCL_ERROR; | 329 return TCL_ERROR; |
330 } | 330 } |
331 sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPage); | 331 sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPage); |
332 Tcl_AppendResult(interp, zBuf, 0); | 332 Tcl_AppendResult(interp, zBuf, 0); |
333 return TCL_OK; | 333 return TCL_OK; |
334 } | 334 } |
335 | 335 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 Tcl_LinkVar(interp, "sqlite_diskfull_pending", | 739 Tcl_LinkVar(interp, "sqlite_diskfull_pending", |
740 (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); | 740 (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); |
741 Tcl_LinkVar(interp, "sqlite_diskfull", | 741 Tcl_LinkVar(interp, "sqlite_diskfull", |
742 (char*)&sqlite3_diskfull, TCL_LINK_INT); | 742 (char*)&sqlite3_diskfull, TCL_LINK_INT); |
743 #ifndef SQLITE_OMIT_WSD | 743 #ifndef SQLITE_OMIT_WSD |
744 Tcl_LinkVar(interp, "sqlite_pending_byte", | 744 Tcl_LinkVar(interp, "sqlite_pending_byte", |
745 (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY); | 745 (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY); |
746 #endif | 746 #endif |
747 return TCL_OK; | 747 return TCL_OK; |
748 } | 748 } |
OLD | NEW |