MCPcopy Create free account
hub / github.com/audacity/audacity / runOneSqlLine

Function runOneSqlLine

lib-src/sqlite/shell.c:20607–20638  ·  view source on GitHub ↗

** Run a single line of SQL. Return the number of errors. */

Source from the content-addressed store, hash-verified

20605** Run a single line of SQL. Return the number of errors.
20606*/
20607static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){
20608 int rc;
20609 char *zErrMsg = 0;
20610
20611 open_db(p, 0);
20612 if( ShellHasFlag(p,SHFLG_Backslash) ) resolve_backslashes(zSql);
20613 if( p->flgProgress & SHELL_PROGRESS_RESET ) p->nProgress = 0;
20614 BEGIN_TIMER;
20615 rc = shell_exec(p, zSql, &zErrMsg);
20616 END_TIMER;
20617 if( rc || zErrMsg ){
20618 char zPrefix[100];
20619 if( in!=0 || !stdin_is_interactive ){
20620 sqlite3_snprintf(sizeof(zPrefix), zPrefix,
20621 "Error: near line %d:", startline);
20622 }else{
20623 sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:");
20624 }
20625 if( zErrMsg!=0 ){
20626 utf8_printf(stderr, "%s %s\n", zPrefix, zErrMsg);
20627 sqlite3_free(zErrMsg);
20628 zErrMsg = 0;
20629 }else{
20630 utf8_printf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db));
20631 }
20632 return 1;
20633 }else if( ShellHasFlag(p, SHFLG_CountChanges) ){
20634 raw_printf(p->out, "changes: %3d total_changes: %d\n",
20635 sqlite3_changes(p->db), sqlite3_total_changes(p->db));
20636 }
20637 return 0;
20638}
20639
20640
20641/*

Callers 1

process_inputFunction · 0.85

Calls 4

open_dbFunction · 0.85
resolve_backslashesFunction · 0.85
shell_execFunction · 0.85
utf8_printfFunction · 0.85

Tested by

no test coverage detected