| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/vdbetrace.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | static int findNextHostParameter(const char *zSql, int *pnToken){ | - | ||||||||||||||||||||||||
| 2 | int tokenType; | - | ||||||||||||||||||||||||
| 3 | int nTotal = 0; | - | ||||||||||||||||||||||||
| 4 | int n; | - | ||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | *pnToken = 0; | - | ||||||||||||||||||||||||
| 7 | while( zSql[0]
| 14-342 | ||||||||||||||||||||||||
| 8 | n = sqlite3GetToken((u8*)zSql, &tokenType); | - | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | ((void) (0)) | - | ||||||||||||||||||||||||
| 11 | ; | - | ||||||||||||||||||||||||
| 12 | if( tokenType==144
| 28-314 | ||||||||||||||||||||||||
| 13 | *pnToken = n; | - | ||||||||||||||||||||||||
| 14 | break; executed 28 times by 1 test: break;Executed by:
| 28 | ||||||||||||||||||||||||
| 15 | } | - | ||||||||||||||||||||||||
| 16 | nTotal += n; | - | ||||||||||||||||||||||||
| 17 | zSql += n; | - | ||||||||||||||||||||||||
| 18 | } executed 314 times by 1 test: end of blockExecuted by:
| 314 | ||||||||||||||||||||||||
| 19 | return executed 42 times by 1 test: nTotal;return nTotal;Executed by:
executed 42 times by 1 test: return nTotal;Executed by:
| 42 | ||||||||||||||||||||||||
| 20 | } | - | ||||||||||||||||||||||||
| 21 | char *sqlite3VdbeExpandSql( | - | ||||||||||||||||||||||||
| 22 | Vdbe *p, | - | ||||||||||||||||||||||||
| 23 | const char *zRawSql | - | ||||||||||||||||||||||||
| 24 | ){ | - | ||||||||||||||||||||||||
| 25 | sqlite3 *db; | - | ||||||||||||||||||||||||
| 26 | int idx = 0; | - | ||||||||||||||||||||||||
| 27 | int nextIndex = 1; | - | ||||||||||||||||||||||||
| 28 | int n; | - | ||||||||||||||||||||||||
| 29 | int nToken; | - | ||||||||||||||||||||||||
| 30 | int i; | - | ||||||||||||||||||||||||
| 31 | Mem *pVar; | - | ||||||||||||||||||||||||
| 32 | StrAccum out; | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | Mem utf8; | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | char zBase[100]; | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | db = p->db; | - | ||||||||||||||||||||||||
| 39 | sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), | - | ||||||||||||||||||||||||
| 40 | db->aLimit[0]); | - | ||||||||||||||||||||||||
| 41 | if( db->nVdbeExec>1
| 41-102 | ||||||||||||||||||||||||
| 42 | while( *
| 41-62 | ||||||||||||||||||||||||
| 43 | const char *zStart = zRawSql; | - | ||||||||||||||||||||||||
| 44 | while( *(
executed 3297 times by 1 test: ;Executed by:
| 21-3338 | ||||||||||||||||||||||||
| 45 | sqlite3_str_append(&out, "-- ", 3); | - | ||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | ((void) (0)) | - | ||||||||||||||||||||||||
| 48 | ; | - | ||||||||||||||||||||||||
| 49 | sqlite3_str_append(&out, zStart, (int)(zRawSql-zStart)); | - | ||||||||||||||||||||||||
| 50 | } executed 62 times by 1 test: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||
| 51 | } executed 41 times by 1 test: else if( p->nVar==0end of blockExecuted by:
| 16-86 | ||||||||||||||||||||||||
| 52 | sqlite3_str_append(&out, zRawSql, sqlite3Strlen30(zRawSql)); | - | ||||||||||||||||||||||||
| 53 | } executed 86 times by 1 test: else{end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 54 | while( zRawSql[0]
| 2-42 | ||||||||||||||||||||||||
| 55 | n = findNextHostParameter(zRawSql, &nToken); | - | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | ((void) (0)) | - | ||||||||||||||||||||||||
| 58 | ; | - | ||||||||||||||||||||||||
| 59 | sqlite3_str_append(&out, zRawSql, n); | - | ||||||||||||||||||||||||
| 60 | zRawSql += n; | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | ((void) (0)) | - | ||||||||||||||||||||||||
| 63 | ; | - | ||||||||||||||||||||||||
| 64 | if( nToken==0
executed 14 times by 1 test: break;Executed by:
| 14-28 | ||||||||||||||||||||||||
| 65 | if( zRawSql[0]=='?'
| 13-15 | ||||||||||||||||||||||||
| 66 | if( nToken>1
| 4-9 | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | ((void) (0)) | - | ||||||||||||||||||||||||
| 69 | ; | - | ||||||||||||||||||||||||
| 70 | sqlite3GetInt32(&zRawSql[1], &idx); | - | ||||||||||||||||||||||||
| 71 | } executed 4 times by 1 test: else{end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 72 | idx = nextIndex; | - | ||||||||||||||||||||||||
| 73 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 74 | }else{ | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | ((void) (0)) | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | ; | - | ||||||||||||||||||||||||
| 79 | ; | - | ||||||||||||||||||||||||
| 80 | ; | - | ||||||||||||||||||||||||
| 81 | ; | - | ||||||||||||||||||||||||
| 82 | ; | - | ||||||||||||||||||||||||
| 83 | idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken); | - | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | ((void) (0)) | - | ||||||||||||||||||||||||
| 86 | ; | - | ||||||||||||||||||||||||
| 87 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||
| 88 | zRawSql += nToken; | - | ||||||||||||||||||||||||
| 89 | nextIndex = idx + 1; | - | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | ((void) (0)) | - | ||||||||||||||||||||||||
| 92 | ; | - | ||||||||||||||||||||||||
| 93 | pVar = &p->aVar[idx-1]; | - | ||||||||||||||||||||||||
| 94 | if( pVar->flags & 0x0001
| 3-25 | ||||||||||||||||||||||||
| 95 | sqlite3_str_append(&out, "NULL", 4); | - | ||||||||||||||||||||||||
| 96 | } executed 3 times by 1 test: else if( pVar->flags & 0x0004end of blockExecuted by:
| 3-16 | ||||||||||||||||||||||||
| 97 | sqlite3_str_appendf(&out, "%lld", pVar->u.i); | - | ||||||||||||||||||||||||
| 98 | } executed 9 times by 1 test: else if( pVar->flags & 0x0008end of blockExecuted by:
| 2-14 | ||||||||||||||||||||||||
| 99 | sqlite3_str_appendf(&out, "%!.15g", pVar->u.r); | - | ||||||||||||||||||||||||
| 100 | } executed 2 times by 1 test: else if( pVar->flags & 0x0002end of blockExecuted by:
| 2-11 | ||||||||||||||||||||||||
| 101 | int nOut; | - | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | u8 enc = ((db)->enc); | - | ||||||||||||||||||||||||
| 104 | if( enc!=1
| 5-6 | ||||||||||||||||||||||||
| 105 | memset(&utf8, 0, sizeof(utf8)); | - | ||||||||||||||||||||||||
| 106 | utf8.db = db; | - | ||||||||||||||||||||||||
| 107 | sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, ((sqlite3_destructor_type)0)); | - | ||||||||||||||||||||||||
| 108 | if( 7==sqlite3VdbeChangeEncoding(&utf8, 1)
| 0-6 | ||||||||||||||||||||||||
| 109 | out.accError = 7; | - | ||||||||||||||||||||||||
| 110 | out.nAlloc = 0; | - | ||||||||||||||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 112 | pVar = &utf8; | - | ||||||||||||||||||||||||
| 113 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | nOut = pVar->n; | - | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | sqlite3_str_appendf(&out, "'%.*q'", nOut, pVar->z); | - | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | if( enc!=1
executed 6 times by 1 test: sqlite3VdbeMemRelease(&utf8);Executed by:
| 5-6 | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | } executed 11 times by 1 test: else if( pVar->flags & 0x4000end of blockExecuted by:
| 0-11 | ||||||||||||||||||||||||
| 132 | sqlite3_str_appendf(&out, "zeroblob(%d)", pVar->u.nZero); | - | ||||||||||||||||||||||||
| 133 | } never executed: else{end of block | 0 | ||||||||||||||||||||||||
| 134 | int nOut; | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | ((void) (0)) | - | ||||||||||||||||||||||||
| 137 | ; | - | ||||||||||||||||||||||||
| 138 | sqlite3_str_append(&out, "x'", 2); | - | ||||||||||||||||||||||||
| 139 | nOut = pVar->n; | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | for(i=0; i<nOut
| 3-11 | ||||||||||||||||||||||||
| 144 | sqlite3_str_appendf(&out, "%02x", pVar->z[i]&0xff); | - | ||||||||||||||||||||||||
| 145 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 146 | sqlite3_str_append(&out, "'", 1); | - | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 153 | } | - | ||||||||||||||||||||||||
| 154 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 155 | if( out.accError
never executed: sqlite3_str_reset(&out); | 0-143 | ||||||||||||||||||||||||
| 156 | return executed 143 times by 1 test: sqlite3StrAccumFinish(&out);return sqlite3StrAccumFinish(&out);Executed by:
executed 143 times by 1 test: return sqlite3StrAccumFinish(&out);Executed by:
| 143 | ||||||||||||||||||||||||
| 157 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |