/* ** This callback is invoked once for each index when reading the ** sqlite_stat1 table. ** ** argv[0] = name of the table ** argv[1] = name of the index (might be NULL) ** argv[2] = results of analysis - on integer for each column ** ** Entries for which argv[1]==NULL simply record the number of rows in ** the table. */ static int analysisLoader(object pData, sqlite3_int64 argc, object Oargv, object NotUsed) { string[] argv = (string[])Oargv; analysisInfo pInfo = (analysisInfo)pData; Index pIndex; Table pTable; int i, c, n; int v; string z; Debug.Assert(argc == 3); UNUSED_PARAMETER2(NotUsed, argc); if (argv == null || argv[0] == null || argv[2] == null) { return(0); } pTable = sqlite3FindTable(pInfo.db, argv[0], pInfo.zDatabase); if (pTable == null) { return(0); } if (!String.IsNullOrEmpty(argv[1])) { pIndex = sqlite3FindIndex(pInfo.db, argv[1], pInfo.zDatabase); } else { pIndex = null; } n = pIndex != null ? pIndex.nColumn : 0; z = argv[2]; int zIndex = 0; for (i = 0; z != null && i <= n; i++) { v = 0; while (zIndex < z.Length && (c = z[zIndex]) >= '0' && c <= '9') { v = v * 10 + c - '0'; zIndex++; } if (i == 0) { pTable.nRowEst = (uint)v; } if (pIndex == null) { break; } pIndex.aiRowEst[i] = v; if (zIndex < z.Length && z[zIndex] == ' ') { zIndex++; } } return(0); }
/* ** This callback is invoked once for each index when reading the ** sqlite_stat1 table. ** ** argv[0] = name of the index ** argv[1] = results of analysis - on integer for each column */ static int analysisLoader(object pData, sqlite3_int64 argc, object Oargv, object NotUsed) { string[] argv = (string[])Oargv; analysisInfo pInfo = (analysisInfo)pData; Index pIndex; int i, c; int v; string z; Debug.Assert(argc == 2); UNUSED_PARAMETER2(NotUsed, argc); if (argv == null || argv[0] == null || argv[1] == null) { return(0); } pIndex = sqlite3FindIndex(pInfo.db, argv[0], pInfo.zDatabase); if (pIndex == null) { return(0); } z = argv[1]; int zIndex = 0; for (i = 0; z != null && i <= pIndex.nColumn; i++) { v = 0; while (zIndex < z.Length && (c = z[zIndex]) >= '0' && c <= '9') { v = v * 10 + c - '0'; zIndex++; } pIndex.aiRowEst[i] = v; if (zIndex < z.Length && z[zIndex] == ' ') { zIndex++; } } return(0); }