Skip to content

Commit

Permalink
change error check to avoid newer sqlite3_strglob for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
antonycourtney committed Dec 12, 2018
1 parent f59234b commit ec7e4ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ int metascan(std::vector<ColType> &colTypes, ImportCtx &ctx, int nCol) {
return 0;
}

const char *NO_TABLE_ERR_PREFIX = "no such table:";
const size_t NO_TABLE_ERR_LEN = strlen(NO_TABLE_ERR_PREFIX);

ImportResult *sqlite_import(
sqlite3 *db,
const char *zFile, // CSV file to import
Expand Down Expand Up @@ -353,7 +356,7 @@ ImportResult *sqlite_import(
nByte = strlen30(zSql);
std::vector<std::string> colNames;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
if (!(rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0)) {
if (rc && strncmp(sqlite3_errmsg(db), NO_TABLE_ERR_PREFIX, NO_TABLE_ERR_LEN)) {
ssErr << "Error: " << rc << ": " << sqlite3_errmsg(db);
errMsg = ssErr.str();
sqlite3_free(zSql);
Expand Down

0 comments on commit ec7e4ee

Please sign in to comment.