Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1339) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
19b100ec0d088b2cca147c967a80d184 |
User & Date: | danielk1977 2004-05-10 10:37:18.975 |
Original User & Date: | danielk1977 2004-05-10 10:37:19.000 |
Context
2004-05-10
| ||
10:37 | Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1340) (check-in: ac46bd686d user: danielk1977 tags: trunk) | |
10:37 | Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1339) (check-in: 19b100ec0d user: danielk1977 tags: trunk) | |
10:34 | Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1338) (check-in: 2242423e31 user: danielk1977 tags: trunk) | |
Changes
Changes to src/vdbeInt.h.
︙ | ︙ | |||
220 221 222 223 224 225 226 | int csChange; /* Current statement change count (from db->csChange) */ }; /* ** An instance of the virtual machine. This structure contains the complete ** state of the virtual machine. ** | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | int csChange; /* Current statement change count (from db->csChange) */ }; /* ** An instance of the virtual machine. This structure contains the complete ** state of the virtual machine. ** ** The "sqlite_vm" structure pointer that is returned by sqlite3_compile() ** is really a pointer to an instance of this structure. */ struct Vdbe { sqlite *db; /* The whole database */ Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */ FILE *trace; /* Write an execution trace here, if not NULL */ int nOp; /* Number of instructions in the program */ |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* ** When debugging the code generator in a symbolic debugger, one can | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* ** When debugging the code generator in a symbolic debugger, one can ** set the sqlite3_vdbe_addop_trace to 1 and all opcodes will be printed ** as they are added to the instruction stream. */ #ifndef NDEBUG int sqlite3_vdbe_addop_trace = 0; #endif /* ** Create a new virtual database engine. */ Vdbe *sqlite3VdbeCreate(sqlite *db){ |
︙ | ︙ | |||
96 97 98 99 100 101 102 | if( p2<0 && (-1-p2)<p->nLabel && p->aLabel[-1-p2]>=0 ){ p2 = p->aLabel[-1-p2]; } pOp->p2 = p2; pOp->p3 = 0; pOp->p3type = P3_NOTUSED; #ifndef NDEBUG | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | if( p2<0 && (-1-p2)<p->nLabel && p->aLabel[-1-p2]>=0 ){ p2 = p->aLabel[-1-p2]; } pOp->p2 = p2; pOp->p3 = 0; pOp->p3type = P3_NOTUSED; #ifndef NDEBUG if( sqlite3_vdbe_addop_trace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]); #endif return i; } /* ** Add an opcode that includes the p3 value. */ |
︙ | ︙ | |||
222 223 224 225 226 227 228 | VdbeOp *pOut = &p->aOp[i+addr]; pOut->opcode = pIn->opcode; pOut->p1 = pIn->p1; pOut->p2 = p2<0 ? addr + ADDR(p2) : p2; pOut->p3 = pIn->p3; pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED; #ifndef NDEBUG | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | VdbeOp *pOut = &p->aOp[i+addr]; pOut->opcode = pIn->opcode; pOut->p1 = pIn->p1; pOut->p2 = p2<0 ? addr + ADDR(p2) : p2; pOut->p3 = pIn->p3; pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED; #ifndef NDEBUG if( sqlite3_vdbe_addop_trace ){ sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]); } #endif } p->nOp += nOp; } return addr; |
︙ | ︙ | |||
387 388 389 390 391 392 393 | return &p->aOp[addr]; } /* ** The following group or routines are employed by installable functions ** to return their results. ** | | | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | return &p->aOp[addr]; } /* ** The following group or routines are employed by installable functions ** to return their results. ** ** The sqlite3_set_result_string() routine can be used to return a string ** value or to return a NULL. To return a NULL, pass in NULL for zResult. ** A copy is made of the string before this routine returns so it is safe ** to pass in an ephemeral string. ** ** sqlite3_set_result_error() works like sqlite3_set_result_string() except ** that it signals a fatal error. The string argument, if any, is the ** error message. If the argument is NULL a generic substitute error message ** is used. ** ** The sqlite3_set_result_int() and sqlite3_set_result_double() set the return ** value of the user function to an integer or a double. ** ** These routines are defined here in vdbe.c because they depend on knowing ** the internals of the sqlite_func structure which is only defined in ** this source file. */ char *sqlite3_set_result_string(sqlite_func *p, const char *zResult, int n){ assert( !p->isStep ); if( p->s.flags & MEM_Dyn ){ sqliteFree(p->s.z); } if( zResult==0 ){ p->s.flags = MEM_Null; n = 0; |
︙ | ︙ | |||
433 434 435 436 437 438 439 | } p->s.flags = MEM_Str | MEM_Dyn; } p->s.n = n+1; } return p->s.z; } | | | | | | | | | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | } p->s.flags = MEM_Str | MEM_Dyn; } p->s.n = n+1; } return p->s.z; } void sqlite3_set_result_int(sqlite_func *p, int iResult){ assert( !p->isStep ); if( p->s.flags & MEM_Dyn ){ sqliteFree(p->s.z); } p->s.i = iResult; p->s.flags = MEM_Int; } void sqlite3_set_result_double(sqlite_func *p, double rResult){ assert( !p->isStep ); if( p->s.flags & MEM_Dyn ){ sqliteFree(p->s.z); } p->s.r = rResult; p->s.flags = MEM_Real; } void sqlite3_set_result_error(sqlite_func *p, const char *zMsg, int n){ assert( !p->isStep ); sqlite3_set_result_string(p, zMsg, n); p->isError = 1; } /* ** Extract the user data from a sqlite_func structure and return a ** pointer to it. */ void *sqlite3_user_data(sqlite_func *p){ assert( p && p->pFunc ); return p->pFunc->pUserData; } /* ** Allocate or return the aggregate context for a user function. A new ** context is allocated on the first call. Subsequent calls return the ** same context that was returned on prior calls. ** ** This routine is defined here in vdbe.c because it depends on knowing ** the internals of the sqlite_func structure which is only defined in ** this source file. */ void *sqlite3_aggregate_context(sqlite_func *p, int nByte){ assert( p && p->pFunc && p->pFunc->xStep ); if( p->pAgg==0 ){ if( nByte<=NBFS ){ p->pAgg = (void*)p->s.z; memset(p->pAgg, 0, nByte); }else{ p->pAgg = sqliteMalloc( nByte ); } } return p->pAgg; } /* ** Return the number of times the Step function of a aggregate has been ** called. ** ** This routine is defined here in vdbe.c because it depends on knowing ** the internals of the sqlite_func structure which is only defined in ** this source file. */ int sqlite3_aggregate_count(sqlite_func *p){ assert( p && p->pFunc && p->pFunc->xStep ); return p->cnt; } #if !defined(NDEBUG) || defined(VDBE_PROFILE) /* ** Print a single opcode. This routine is used for debugging only. |
︙ | ︙ | |||
555 556 557 558 559 560 561 | db->flags &= ~SQLITE_Interrupt; if( db->magic!=SQLITE_MAGIC_BUSY ){ p->rc = SQLITE_MISUSE; }else{ p->rc = SQLITE_INTERRUPT; } rc = SQLITE_ERROR; | | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | db->flags &= ~SQLITE_Interrupt; if( db->magic!=SQLITE_MAGIC_BUSY ){ p->rc = SQLITE_MISUSE; }else{ p->rc = SQLITE_INTERRUPT; } rc = SQLITE_ERROR; sqlite3SetString(&p->zErrMsg, sqlite3_error_string(p->rc), (char*)0); }else{ sprintf(p->zArgv[0],"%d",i); sprintf(p->zArgv[2],"%d", p->aOp[i].p1); sprintf(p->zArgv[3],"%d", p->aOp[i].p2); if( p->aOp[i].p3type==P3_POINTER ){ sprintf(p->aStack[4].zShort, "ptr(%#x)", (int)p->aOp[i].p3); p->zArgv[4] = p->aStack[4].zShort; |
︙ | ︙ | |||
832 833 834 835 836 837 838 | ** again. */ int sqlite3VdbeReset(Vdbe *p, char **pzErrMsg){ sqlite *db = p->db; int i; if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){ | | | | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | ** again. */ int sqlite3VdbeReset(Vdbe *p, char **pzErrMsg){ sqlite *db = p->db; int i; if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){ sqlite3SetString(pzErrMsg, sqlite3_error_string(SQLITE_MISUSE), (char*)0); return SQLITE_MISUSE; } if( p->zErrMsg ){ if( pzErrMsg && *pzErrMsg==0 ){ *pzErrMsg = p->zErrMsg; }else{ sqliteFree(p->zErrMsg); } p->zErrMsg = 0; }else if( p->rc ){ sqlite3SetString(pzErrMsg, sqlite3_error_string(p->rc), (char*)0); } Cleanup(p); if( p->rc!=SQLITE_OK ){ switch( p->errorAction ){ case OE_Abort: { if( !p->undoTransOnError ){ for(i=0; i<db->nDb; i++){ |
︙ | ︙ | |||
882 883 884 885 886 887 888 | } for(i=0; i<db->nDb; i++){ if( db->aDb[i].pBt && db->aDb[i].inTrans==2 ){ sqlite3BtreeCommitStmt(db->aDb[i].pBt); db->aDb[i].inTrans = 1; } } | | | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | } for(i=0; i<db->nDb; i++){ if( db->aDb[i].pBt && db->aDb[i].inTrans==2 ){ sqlite3BtreeCommitStmt(db->aDb[i].pBt); db->aDb[i].inTrans = 1; } } assert( p->pTos<&p->aStack[p->pc] || sqlite3_malloc_failed==1 ); #ifdef VDBE_PROFILE { FILE *out = fopen("vdbe_profile.out", "a"); if( out ){ int i; fprintf(out, "---- "); for(i=0; i<p->nOp; i++){ |
︙ | ︙ | |||
918 919 920 921 922 923 924 | ** the result code. Write any error message text into *pzErrMsg. */ int sqlite3VdbeFinalize(Vdbe *p, char **pzErrMsg){ int rc; sqlite *db; if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){ | | | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | ** the result code. Write any error message text into *pzErrMsg. */ int sqlite3VdbeFinalize(Vdbe *p, char **pzErrMsg){ int rc; sqlite *db; if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){ sqlite3SetString(pzErrMsg, sqlite3_error_string(SQLITE_MISUSE), (char*)0); return SQLITE_MISUSE; } db = p->db; rc = sqlite3VdbeReset(p, pzErrMsg); sqlite3VdbeDelete(p); if( db->want_to_close && db->pVdbe==0 ){ sqlite3_close(db); } if( rc==SQLITE_SCHEMA ){ sqlite3ResetInternalSchema(db, 0); } return rc; } /* ** Set the values of all variables. Variable $1 in the original SQL will ** be the string azValue[0]. $2 will have the value azValue[1]. And ** so forth. If a value is out of range (for example $3 when nValue==2) ** then its value will be NULL. ** ** This routine overrides any prior call. */ int sqlite3_bind(sqlite_vm *pVm, int i, const char *zVal, int len, int copy){ Vdbe *p = (Vdbe*)pVm; if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){ return SQLITE_MISUSE; } if( i<1 || i>p->nVar ){ return SQLITE_RANGE; } |
︙ | ︙ | |||
1043 1044 1045 1046 1047 1048 1049 | ** If a MoveTo operation is pending on the given cursor, then do that ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ int res; | | | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | ** If a MoveTo operation is pending on the given cursor, then do that ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ int res; extern int sqlite3_search_count; sqlite3BtreeMoveto(p->pCursor, (char*)&p->movetoTarget, sizeof(int), &res); p->lastRecno = keyToInt(p->movetoTarget); p->recnoIsValid = res==0; if( res<0 ){ sqlite3BtreeNext(p->pCursor, &res); } sqlite3_search_count++; p->deferredMoveto = 0; } return SQLITE_OK; } /* ** FIX ME |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** ** $Id: where.c,v 1.91 2004/05/10 10:37:19 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
385 386 387 388 389 390 391 | return 0; } /* Allocate and initialize the WhereInfo structure that will become the ** return value. */ pWInfo = sqliteMalloc( sizeof(WhereInfo) + pTabList->nSrc*sizeof(WhereLevel)); | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | return 0; } /* Allocate and initialize the WhereInfo structure that will become the ** return value. */ pWInfo = sqliteMalloc( sizeof(WhereInfo) + pTabList->nSrc*sizeof(WhereLevel)); if( sqlite3_malloc_failed ){ sqliteFree(pWInfo); return 0; } pWInfo->pParse = pParse; pWInfo->pTabList = pTabList; pWInfo->peakNTab = pWInfo->savedNTab = pParse->nTab; pWInfo->iBreak = sqlite3VdbeMakeLabel(v); |
︙ | ︙ |