Subject Re: character string problem
From Charlie <tm@tc.com>
Date Sun, 17 Mar 2019 15:59:03 -0400
Newsgroups dbase.getting-started

Hi Mervyn... I do see the new file escaping.  I saw only one double (\"\").  But there are two problems probably unexpected by you.  The first is preventing me from doing much with this.

The result is supposed to be indexed on part_no.  I don\'t know if you can append from another file by index?  Or am I wrong?  That can probably get worked around.

The other problem is that tmaster.dbf even though it is dealt with at the beginning of the file is a problem.  Before I can run the program again I have to maually delete tmaster.dbf every time I run it.

BTW you might have sent an old file in one of your posts as the escape code was  not in the one I originally looked at.

Well, thanks again!!!

Mervyn Bick Wrote:

> On 2019-03-17 3:54 PM, Charlie wrote:
> > Hi Mervyn.. It is possible that I have some single quotes but probably not as many.  Although sometimes they describe  passenger cars by feet (\') also.  I was wondering if you could use ^ or |  to enclose.  I think I have seen them before.  Although I believe they replaced the comma.  Isn\'t the comma the delimiter and ( \") the enclosure?  I\'m confused.  If you use copy to file with ^ it changes the comma.
>
> The dBASE command COPY TO ... DELIMITED produces a comma separated file.
>   If you want anything other than a comma to separate the field values
> (for example TAB or | ) you would have to write your own code to produce
> the file.  It isn\'t particularly difficult but this has been addressed
> in usvout.prg in the dUFLP anyway so you wouldn\'t actually have to
> reinvent the wheel if you ever need this. :-)
>
> A delimiter is used to wrap text values.  The default delimiter used
> with COPY TO ... DELIMITED is a double quote.  The delimiter can,
> however be changed by specifying it in the command e.g  COPY TO ...
> DELIMITED WITH \' or COPY TO ... DELIMITED WITH ^   These commands
> willchange the delimiters but not the separators.
>
> Although dBASE can change the delimiter to any printable character not
> many other programs can handle anything except a single quote or a
> double quote as a delimiter.  SQL normally requires a single quote but
> some SQL servers such as MySQL and Firebird will accept double quotes.
> As far as I know there is no way to use any other character as a
> delimiter in SQL.
>
> If you use double quotes as delimiters then any double quote in a text
> literal must be escaped.  If you use single quotes as delimiters than
> any single quote in a text literal must be escaped.
>
> Using double quotes as the delimiters and escaping any double quotes in
> the text means you can ignore any single quotes used as apostrophes or
> as a symbol for feet in the text.
>
>
>
> >
> > I believe the program you attached is not complete.  It seems to end abruptly.
>
> If you look at the code you will see it creates tmaster.csv (or rather
> it is supposed to :-) ) and then stops.  You could perhaps add
> msgbox(\'Done\') at the end if you want a less abrupt ending.
>
> The proof of the pudding ......   Did the little program produce a
> version of tmaster.csv?  If it did, did it \"escape\" double quotes in
> part_no and au_desc by adding a \\ in front of them?  Could you upload
> tmaster.csv to MySQL?
>
>
> Mervyn.
>
>