1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Fix an obscure problem associated with quoting of CSV output in the CLI.

FossilOrigin-Name: 38a9b660214c06aa6650c6bb11a429a8c74c09f1e0e5c18d691e36de4af7af71
This commit is contained in:
drh
2021-11-18 13:25:31 +00:00
parent 488b55856e
commit e41d30ffdd
3 changed files with 13 additions and 11 deletions

View File

@@ -1764,10 +1764,12 @@ static void output_csv(ShellState *p, const char *z, int bSep){
}else{
int i;
int nSep = strlen30(p->colSeparator);
for(i=0; z[i]; i++){
int n = strlen30(z);
for(i=0; i<n; i++){
if( needCsvQuote[((unsigned char*)z)[i]]
|| (z[i]==p->colSeparator[0] &&
(nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
|| (z[i]==p->colSeparator[0] &&
(nSep==1 || (i+nSep<n && memcmp(z+i, p->colSeparator, nSep)==0)))
){
i = 0;
break;
}