Lines Matching defs:pCur

5912   series_cursor *pCur;
5914 pCur = sqlite3_malloc( sizeof(*pCur) );
5915 if( pCur==0 ) return SQLITE_NOMEM;
5916 memset(pCur, 0, sizeof(*pCur));
5917 *ppCursor = &pCur->base;
5934 series_cursor *pCur = (series_cursor*)cur;
5935 progressSequence( & pCur->ss );
5948 series_cursor *pCur = (series_cursor*)cur;
5951 case SERIES_COLUMN_START: x = pCur->ss.iBase; break;
5952 case SERIES_COLUMN_STOP: x = pCur->ss.iTerm; break;
5953 case SERIES_COLUMN_STEP: x = pCur->ss.iStep; break;
5954 default: x = pCur->ss.iValueNow; break;
5969 series_cursor *pCur = (series_cursor*)cur;
5970 sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
5980 series_cursor *pCur = (series_cursor*)cur;
5981 return !pCur->ss.isNotEOF;
6019 series_cursor *pCur = (series_cursor *)pVtabCursor;
6023 pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
6025 pCur->ss.iBase = 0;
6028 pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
6030 pCur->ss.iTerm = 0xffffffff;
6033 pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
6034 if( pCur->ss.iStep==0 ){
6035 pCur->ss.iStep = 1;
6036 }else if( pCur->ss.iStep<0 ){
6040 pCur->ss.iStep = 1;
6048 pCur->ss.iBase += pCur->ss.iStep*iOffset;
6052 iTerm = pCur->ss.iBase + (iLimit - 1)*pCur->ss.iStep;
6053 if( pCur->ss.iStep<0 ){
6054 if( iTerm>pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
6056 if( iTerm<pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
6064 pCur->ss.iBase = 1;
6065 pCur->ss.iTerm = 0;
6066 pCur->ss.iStep = 1;
6071 pCur->ss.isReversing = pCur->ss.iStep > 0;
6073 pCur->ss.isReversing = pCur->ss.iStep < 0;
6075 setupSequence( &pCur->ss );
7790 fsdir_cursor *pCur;
7792 pCur = sqlite3_malloc( sizeof(*pCur) );
7793 if( pCur==0 ) return SQLITE_NOMEM;
7794 memset(pCur, 0, sizeof(*pCur));
7795 pCur->iLvl = -1;
7796 *ppCursor = &pCur->base;
7804 static void fsdirResetCursor(fsdir_cursor *pCur){
7806 for(i=0; i<=pCur->iLvl; i++){
7807 FsdirLevel *pLvl = &pCur->aLvl[i];
7811 sqlite3_free(pCur->zPath);
7812 sqlite3_free(pCur->aLvl);
7813 pCur->aLvl = 0;
7814 pCur->zPath = 0;
7815 pCur->zBase = 0;
7816 pCur->nBase = 0;
7817 pCur->nLvl = 0;
7818 pCur->iLvl = -1;
7819 pCur->iRowid = 1;
7826 fsdir_cursor *pCur = (fsdir_cursor*)cur;
7828 fsdirResetCursor(pCur);
7829 sqlite3_free(pCur);
7835 ** pCur to the results of vprintf(zFmt, ...).
7837 static void fsdirSetErrmsg(fsdir_cursor *pCur, const char *zFmt, ...){
7840 pCur->base.pVtab->zErrMsg = sqlite3_vmprintf(zFmt, ap);
7849 fsdir_cursor *pCur = (fsdir_cursor*)cur;
7850 mode_t m = pCur->sStat.st_mode;
7852 pCur->iRowid++;
7855 int iNew = pCur->iLvl + 1;
7857 if( iNew>=pCur->nLvl ){
7860 FsdirLevel *aNew = (FsdirLevel*)sqlite3_realloc64(pCur->aLvl, nByte);
7862 memset(&aNew[pCur->nLvl], 0, sizeof(FsdirLevel)*(nNew-pCur->nLvl));
7863 pCur->aLvl = aNew;
7864 pCur->nLvl = nNew;
7866 pCur->iLvl = iNew;
7867 pLvl = &pCur->aLvl[iNew];
7869 pLvl->zDir = pCur->zPath;
7870 pCur->zPath = 0;
7873 fsdirSetErrmsg(pCur, "cannot read directory: %s", pCur->zPath);
7878 while( pCur->iLvl>=0 ){
7879 FsdirLevel *pLvl = &pCur->aLvl[pCur->iLvl];
7886 sqlite3_free(pCur->zPath);
7887 pCur->zPath = sqlite3_mprintf("%s/%s", pLvl->zDir, pEntry->d_name);
7888 if( pCur->zPath==0 ) return SQLITE_NOMEM;
7889 if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
7890 fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
7899 pCur->iLvl--;
7903 sqlite3_free(pCur->zPath);
7904 pCur->zPath = 0;
7917 fsdir_cursor *pCur = (fsdir_cursor*)cur;
7920 sqlite3_result_text(ctx, &pCur->zPath[pCur->nBase], -1, SQLITE_TRANSIENT);
7925 sqlite3_result_int64(ctx, pCur->sStat.st_mode);
7929 sqlite3_result_int64(ctx, pCur->sStat.st_mtime);
7933 mode_t m = pCur->sStat.st_mode;
7944 n = readlink(pCur->zPath, aBuf, nBuf);
7959 readFileContents(ctx, pCur->zPath);
7978 fsdir_cursor *pCur = (fsdir_cursor*)cur;
7979 *pRowid = pCur->iRowid;
7988 fsdir_cursor *pCur = (fsdir_cursor*)cur;
7989 return (pCur->zPath==0);
8004 fsdir_cursor *pCur = (fsdir_cursor*)cur;
8006 fsdirResetCursor(pCur);
8009 fsdirSetErrmsg(pCur, "table function fsdir requires an argument");
8016 fsdirSetErrmsg(pCur, "table function fsdir requires a non-NULL argument");
8020 pCur->zBase = (const char*)sqlite3_value_text(argv[1]);
8022 if( pCur->zBase ){
8023 pCur->nBase = (int)strlen(pCur->zBase)+1;
8024 pCur->zPath = sqlite3_mprintf("%s/%s", pCur->zBase, zDir);
8026 pCur->zPath = sqlite3_mprintf("%s", zDir);
8029 if( pCur->zPath==0 ){
8032 if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
8033 fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
8345 completion_cursor *pCur;
8346 pCur = sqlite3_malloc( sizeof(*pCur) );
8347 if( pCur==0 ) return SQLITE_NOMEM;
8348 memset(pCur, 0, sizeof(*pCur));
8349 pCur->db = ((completion_vtab*)p)->db;
8350 *ppCursor = &pCur->base;
8357 static void completionCursorReset(completion_cursor *pCur){
8358 sqlite3_free(pCur->zPrefix); pCur->zPrefix = 0; pCur->nPrefix = 0;
8359 sqlite3_free(pCur->zLine); pCur->zLine = 0; pCur->nLine = 0;
8360 sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
8361 pCur->j = 0;
8388 completion_cursor *pCur = (completion_cursor*)cur;
8390 int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
8391 pCur->iRowid++;
8392 while( pCur->ePhase!=COMPLETION_EOF ){
8393 switch( pCur->ePhase ){
8395 if( pCur->j >= sqlite3_keyword_count() ){
8396 pCur->zCurrentRow = 0;
8397 pCur->ePhase = COMPLETION_DATABASES;
8399 sqlite3_keyword_name(pCur->j++, &pCur->zCurrentRow, &pCur->szRow);
8405 if( pCur->pStmt==0 ){
8406 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1,
8407 &pCur->pStmt, 0);
8414 if( pCur->pStmt==0 ){
8418 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
8430 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
8438 if( pCur->pStmt==0 ){
8442 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
8456 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
8466 if( pCur->zCurrentRow==0 ) continue;
8468 if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
8470 pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
8471 pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
8474 sqlite3_finalize(pCur->pStmt);
8475 pCur->pStmt = 0;
8476 pCur->ePhase = eNextPhase;
8480 if( pCur->nPrefix==0 ) break;
8481 if( pCur->nPrefix<=pCur->szRow
8482 && sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0
8500 completion_cursor *pCur = (completion_cursor*)cur;
8503 sqlite3_result_text(ctx, pCur->zCurrentRow, pCur->szRow,SQLITE_TRANSIENT);
8507 sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
8511 sqlite3_result_text(ctx, pCur->zLine, -1, SQLITE_TRANSIENT);
8515 sqlite3_result_int(ctx, pCur->ePhase);
8527 completion_cursor *pCur = (completion_cursor*)cur;
8528 *pRowid = pCur->iRowid;
8537 completion_cursor *pCur = (completion_cursor*)cur;
8538 return pCur->ePhase >= COMPLETION_EOF;
8552 completion_cursor *pCur = (completion_cursor *)pVtabCursor;
8556 completionCursorReset(pCur);
8558 pCur->nPrefix = sqlite3_value_bytes(argv[iArg]);
8559 if( pCur->nPrefix>0 ){
8560 pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
8561 if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
8566 pCur->nLine = sqlite3_value_bytes(argv[iArg]);
8567 if( pCur->nLine>0 ){
8568 pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
8569 if( pCur->zLine==0 ) return SQLITE_NOMEM;
8572 if( pCur->zLine!=0 && pCur->zPrefix==0 ){
8573 int i = pCur->nLine;
8574 while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
8577 pCur->nPrefix = pCur->nLine - i;
8578 if( pCur->nPrefix>0 ){
8579 pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
8580 if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
8583 pCur->iRowid = 0;
8584 pCur->ePhase = COMPLETION_FIRST_PHASE;