** Output the given string as a quoted string using SQL quoting conventions. ** ** See also: output_quoted_escaped_string() */
| 16847 | ** See also: output_quoted_escaped_string() |
| 16848 | */ |
| 16849 | static 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. |
no test coverage detected