Lines Matching refs:pGCC
1778 GroupConcatCtx *pGCC; in groupConcatStep() local
1783 pGCC = (GroupConcatCtx*)sqlite3_aggregate_context(context, sizeof(*pGCC)); in groupConcatStep()
1784 if( pGCC ){ in groupConcatStep()
1786 int firstTerm = pGCC->str.mxAlloc==0; in groupConcatStep()
1787 pGCC->str.mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH]; in groupConcatStep()
1790 sqlite3_str_appendchar(&pGCC->str, 1, ','); in groupConcatStep()
1794 pGCC->nFirstSepLength = 1; in groupConcatStep()
1801 sqlite3_str_append(&pGCC->str, zSep, nSep); in groupConcatStep()
1807 if( nSep != pGCC->nFirstSepLength || pGCC->pnSepLengths != 0 ){ in groupConcatStep()
1808 int *pnsl = pGCC->pnSepLengths; in groupConcatStep()
1811 pnsl = (int*)sqlite3_malloc64((pGCC->nAccum+1) * sizeof(int)); in groupConcatStep()
1813 int i = 0, nA = pGCC->nAccum-1; in groupConcatStep()
1814 while( i<nA ) pnsl[i++] = pGCC->nFirstSepLength; in groupConcatStep()
1817 pnsl = (int*)sqlite3_realloc64(pnsl, pGCC->nAccum * sizeof(int)); in groupConcatStep()
1820 if( ALWAYS(pGCC->nAccum>0) ){ in groupConcatStep()
1821 pnsl[pGCC->nAccum-1] = nSep; in groupConcatStep()
1823 pGCC->pnSepLengths = pnsl; in groupConcatStep()
1825 sqlite3StrAccumSetError(&pGCC->str, SQLITE_NOMEM); in groupConcatStep()
1832 pGCC->nFirstSepLength = sqlite3_value_bytes(argv[1]); in groupConcatStep()
1834 pGCC->nAccum += 1; in groupConcatStep()
1838 if( zVal ) sqlite3_str_append(&pGCC->str, zVal, nVal); in groupConcatStep()
1848 GroupConcatCtx *pGCC; in groupConcatInverse() local
1852 pGCC = (GroupConcatCtx*)sqlite3_aggregate_context(context, sizeof(*pGCC)); in groupConcatInverse()
1855 if( ALWAYS(pGCC) ){ in groupConcatInverse()
1861 pGCC->nAccum -= 1; in groupConcatInverse()
1862 if( pGCC->pnSepLengths!=0 ){ in groupConcatInverse()
1863 assert(pGCC->nAccum >= 0); in groupConcatInverse()
1864 if( pGCC->nAccum>0 ){ in groupConcatInverse()
1865 nVS += *pGCC->pnSepLengths; in groupConcatInverse()
1866 memmove(pGCC->pnSepLengths, pGCC->pnSepLengths+1, in groupConcatInverse()
1867 (pGCC->nAccum-1)*sizeof(int)); in groupConcatInverse()
1871 nVS += pGCC->nFirstSepLength; in groupConcatInverse()
1873 if( nVS>=(int)pGCC->str.nChar ){ in groupConcatInverse()
1874 pGCC->str.nChar = 0; in groupConcatInverse()
1876 pGCC->str.nChar -= nVS; in groupConcatInverse()
1877 memmove(pGCC->str.zText, &pGCC->str.zText[nVS], pGCC->str.nChar); in groupConcatInverse()
1879 if( pGCC->str.nChar==0 ){ in groupConcatInverse()
1880 pGCC->str.mxAlloc = 0; in groupConcatInverse()
1881 sqlite3_free(pGCC->pnSepLengths); in groupConcatInverse()
1882 pGCC->pnSepLengths = 0; in groupConcatInverse()
1890 GroupConcatCtx *pGCC in groupConcatFinalize() local
1892 if( pGCC ){ in groupConcatFinalize()
1893 sqlite3ResultStrAccum(context, &pGCC->str); in groupConcatFinalize()
1895 sqlite3_free(pGCC->pnSepLengths); in groupConcatFinalize()
1901 GroupConcatCtx *pGCC in groupConcatValue() local
1903 if( pGCC ){ in groupConcatValue()
1904 StrAccum *pAccum = &pGCC->str; in groupConcatValue()