** Set the destination table field of the ShellState structure to ** the name of the table given. Escape any quote characters in the ** table name. */
| 17882 | ** table name. |
| 17883 | */ |
| 17884 | static 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 |
no test coverage detected