Fossil

Diff
Login

Differences From Artifact [140123caf2]:

To Artifact [bef2bfc5b4]:


12816
12817
12818
12819
12820
12821
12822
12823

12824
12825
12826

12827
12828
12829
12830
12831
12832
12833

12834
12835
12836
12837
12838
12839
12840
12816
12817
12818
12819
12820
12821
12822

12823

12824

12825


12826
12827
12828
12829

12830
12831
12832
12833
12834
12835
12836
12837







-
+
-

-
+
-
-




-
+







** is only issued if bSep is true.
*/
static void output_csv(ShellState *p, const char *z, int bSep){
  FILE *out = p->out;
  if( z==0 ){
    utf8_printf(out,"%s",p->nullValue);
  }else{
    int i;
    unsigned i;
    int nSep = strlen30(p->colSeparator);
    for(i=0; z[i]; i++){
      if( needCsvQuote[((unsigned char*)z)[i]]
      if( needCsvQuote[((unsigned char*)z)[i]] ){
         || (z[i]==p->colSeparator[0] &&
             (nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
        i = 0;
        break;
      }
    }
    if( i==0 ){
    if( i==0 || strstr(z, p->colSeparator)!=0 ){
      char *zQuoted = sqlite3_mprintf("\"%w\"", z);
      utf8_printf(out, "%s", zQuoted);
      sqlite3_free(zQuoted);
    }else{
      utf8_printf(out, "%s", z);
    }
  }