Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case OP_CustomResultRow:
- {
- .
- .
- .
- copied from op_resultrow
- .
- .
- .
- .
- custom_pResultSet = (Mem*) malloc(sizeof (Mem) * (custom_numElements));
- for(i = 0;i < custom_numElements;i++)
- {
- sqlite3VdbeMemInit(&custom_pResultSet[i], p->db, MEM_Null);
- }
- custom_pResultSet[0].z = zColumnSelector;
- custom_pResultSet[0].flags = MEM_Str;
- custom_pResultSet[0].n = strlen(zColumnSelector);
- custom_pResultSet[0].zMalloc = zColumnSelector;
- custom_pResultSet[0].enc = SQLITE_UTF8;
- k = 1;
- for (i = 0, j = 0; i < p->custom_iNumTables; i++)
- {
- if (p->custom_pAllRows[i] == 1)
- {
- l = 0;
- while (l < p->custom_piColumnCount[i])
- {
- custom_pResultSet[k++] = aMem[pOp->p1 + j]; // copy every column into the result set
- l++;
- j++;
- }
- }
- else
- {
- j += p->custom_piPriKey[i];
- custom_pResultSet[k++] = aMem[pOp->p1 + j]; // copy only primary key into the result set
- j += p->custom_piColumnCount[i];
- j -= p->custom_piPriKey[i];
- }
- }
- pMem = p->pResultSet = custom_pResultSet;
- for (i = 0; i < custom_numElements ; i++)
- {
- char zBuf[200];
- assert(memIsValid(&pMem[i]));
- Deephemeralize(&pMem[i]);
- assert((pMem[i].flags & MEM_Ephem) == 0
- || (pMem[i].flags & (MEM_Str | MEM_Blob)) == 0);
- sqlite3VdbeMemNulTerminate(&pMem[i]);
- REGISTER_TRACE(pOp->p1 + i, &pMem[i]);
- }
- if (db->mallocFailed) goto no_mem;
- p->pc = pc + 1;
- rc = SQLITE_ROW;
- goto vdbe_return;
- }
Advertisement
Add Comment
Please, Sign In to add comment