MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / set_table_name

Function set_table_name

modules/dasSQLITE/sqlite/shell.c:17884–17907  ·  view source on GitHub ↗

** Set the destination table field of the ShellState structure to ** the name of the table given. Escape any quote characters in the ** table name. */

Source from the content-addressed store, hash-verified

17882** table name.
17883*/
17884static void set_table_name(ShellState *p, const char *zName){
17885 int i, n;
17886 char cQuote;
17887 char *z;
17888
17889 if( p->zDestTable ){
17890 free(p->zDestTable);
17891 p->zDestTable = 0;
17892 }
17893 if( zName==0 ) return;
17894 cQuote = quoteChar(zName);
17895 n = strlen30(zName);
17896 if( cQuote ) n += n+2;
17897 z = p->zDestTable = malloc( n+1 );
17898 shell_check_oom(z);
17899 n = 0;
17900 if( cQuote ) z[n++] = cQuote;
17901 for(i=0; zName[i]; i++){
17902 z[n++] = zName[i];
17903 if( zName[i]==cQuote ) z[n++] = cQuote;
17904 }
17905 if( cQuote ) z[n++] = cQuote;
17906 z[n] = 0;
17907}
17908
17909/*
17910** Maybe construct two lines of text that point out the position of a

Callers 2

do_meta_commandFunction · 0.85
wmainFunction · 0.85

Calls 4

quoteCharFunction · 0.85
strlen30Function · 0.85
shell_check_oomFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected