Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: third_party/sqlite/sqlite-src-3100200/src/vdbetrace.c

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2009 November 25 2 ** 2009 November 25
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 int idx = 0; /* Index of a host parameter */ 77 int idx = 0; /* Index of a host parameter */
78 int nextIndex = 1; /* Index of next ? host parameter */ 78 int nextIndex = 1; /* Index of next ? host parameter */
79 int n; /* Length of a token prefix */ 79 int n; /* Length of a token prefix */
80 int nToken; /* Length of the parameter token */ 80 int nToken; /* Length of the parameter token */
81 int i; /* Loop counter */ 81 int i; /* Loop counter */
82 Mem *pVar; /* Value of a host parameter */ 82 Mem *pVar; /* Value of a host parameter */
83 StrAccum out; /* Accumulate the output here */ 83 StrAccum out; /* Accumulate the output here */
84 char zBase[100]; /* Initial working space */ 84 char zBase[100]; /* Initial working space */
85 85
86 db = p->db; 86 db = p->db;
87 sqlite3StrAccumInit(&out, zBase, sizeof(zBase), 87 sqlite3StrAccumInit(&out, db, zBase, sizeof(zBase),
88 db->aLimit[SQLITE_LIMIT_LENGTH]); 88 db->aLimit[SQLITE_LIMIT_LENGTH]);
89 out.db = db;
90 if( db->nVdbeExec>1 ){ 89 if( db->nVdbeExec>1 ){
91 while( *zRawSql ){ 90 while( *zRawSql ){
92 const char *zStart = zRawSql; 91 const char *zStart = zRawSql;
93 while( *(zRawSql++)!='\n' && *zRawSql ); 92 while( *(zRawSql++)!='\n' && *zRawSql );
94 sqlite3StrAccumAppend(&out, "-- ", 3); 93 sqlite3StrAccumAppend(&out, "-- ", 3);
95 assert( (zRawSql - zStart) > 0 ); 94 assert( (zRawSql - zStart) > 0 );
96 sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart)); 95 sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));
97 } 96 }
97 }else if( p->nVar==0 ){
98 sqlite3StrAccumAppend(&out, zRawSql, sqlite3Strlen30(zRawSql));
98 }else{ 99 }else{
99 while( zRawSql[0] ){ 100 while( zRawSql[0] ){
100 n = findNextHostParameter(zRawSql, &nToken); 101 n = findNextHostParameter(zRawSql, &nToken);
101 assert( n>0 ); 102 assert( n>0 );
102 sqlite3StrAccumAppend(&out, zRawSql, n); 103 sqlite3StrAccumAppend(&out, zRawSql, n);
103 zRawSql += n; 104 zRawSql += n;
104 assert( zRawSql[0] || nToken==0 ); 105 assert( zRawSql[0] || nToken==0 );
105 if( nToken==0 ) break; 106 if( nToken==0 ) break;
106 if( zRawSql[0]=='?' ){ 107 if( zRawSql[0]=='?' ){
107 if( nToken>1 ){ 108 if( nToken>1 ){
108 assert( sqlite3Isdigit(zRawSql[1]) ); 109 assert( sqlite3Isdigit(zRawSql[1]) );
109 sqlite3GetInt32(&zRawSql[1], &idx); 110 sqlite3GetInt32(&zRawSql[1], &idx);
110 }else{ 111 }else{
111 idx = nextIndex; 112 idx = nextIndex;
112 } 113 }
113 }else{ 114 }else{
114 assert( zRawSql[0]==':' || zRawSql[0]=='$' || zRawSql[0]=='@' ); 115 assert( zRawSql[0]==':' || zRawSql[0]=='$' ||
116 zRawSql[0]=='@' || zRawSql[0]=='#' );
115 testcase( zRawSql[0]==':' ); 117 testcase( zRawSql[0]==':' );
116 testcase( zRawSql[0]=='$' ); 118 testcase( zRawSql[0]=='$' );
117 testcase( zRawSql[0]=='@' ); 119 testcase( zRawSql[0]=='@' );
120 testcase( zRawSql[0]=='#' );
118 idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken); 121 idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);
119 assert( idx>0 ); 122 assert( idx>0 );
120 } 123 }
121 zRawSql += nToken; 124 zRawSql += nToken;
122 nextIndex = idx + 1; 125 nextIndex = idx + 1;
123 assert( idx>0 && idx<=p->nVar ); 126 assert( idx>0 && idx<=p->nVar );
124 pVar = &p->aVar[idx-1]; 127 pVar = &p->aVar[idx-1];
125 if( pVar->flags & MEM_Null ){ 128 if( pVar->flags & MEM_Null ){
126 sqlite3StrAccumAppend(&out, "NULL", 4); 129 sqlite3StrAccumAppend(&out, "NULL", 4);
127 }else if( pVar->flags & MEM_Int ){ 130 }else if( pVar->flags & MEM_Int ){
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); 179 sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut);
177 } 180 }
178 #endif 181 #endif
179 } 182 }
180 } 183 }
181 } 184 }
182 return sqlite3StrAccumFinish(&out); 185 return sqlite3StrAccumFinish(&out);
183 } 186 }
184 187
185 #endif /* #ifndef SQLITE_OMIT_TRACE */ 188 #endif /* #ifndef SQLITE_OMIT_TRACE */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/src/vdbesort.c ('k') | third_party/sqlite/sqlite-src-3100200/src/vtab.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698