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

Function output_quoted_string

modules/dasSQLITE/sqlite/shell.c:16849–16877  ·  view source on GitHub ↗

** Output the given string as a quoted string using SQL quoting conventions. ** ** See also: output_quoted_escaped_string() */

Source from the content-addressed store, hash-verified

16847** See also: output_quoted_escaped_string()
16848*/
16849static void output_quoted_string(FILE *out, const char *z){
16850 int i;
16851 char c;
16852 setBinaryMode(out, 1);
16853 for(i=0; (c = z[i])!=0 && c!='\''; i++){}
16854 if( c==0 ){
16855 utf8_printf(out,"'%s'",z);
16856 }else{
16857 raw_printf(out, "'");
16858 while( *z ){
16859 for(i=0; (c = z[i])!=0 && c!='\''; i++){}
16860 if( c=='\'' ) i++;
16861 if( i ){
16862 utf8_printf(out, "%.*s", i, z);
16863 z += i;
16864 }
16865 if( c=='\'' ){
16866 raw_printf(out, "'");
16867 continue;
16868 }
16869 if( c==0 ){
16870 break;
16871 }
16872 z++;
16873 }
16874 raw_printf(out, "'");
16875 }
16876 setTextMode(out, 1);
16877}
16878
16879/*
16880** Output the given string as a quoted string using SQL quoting conventions.

Callers 1

shell_callbackFunction · 0.85

Calls 3

setBinaryModeFunction · 0.85
utf8_printfFunction · 0.85
setTextModeFunction · 0.85

Tested by

no test coverage detected