Subject Re: character string problem
From Charlie <tm@tc.com>
Date Sat, 16 Mar 2019 14:06:36 -0400
Newsgroups dbase.getting-started

Hi Akshat... Thanks for the information.  This will help a lot.

BTW I really like coding in PHP!!!

Akshat Kapoor Wrote:

> On 16/03/2019 04:17, Charlie wrote:
> > OK so as it turns out my problem is bigger than I thought.  Every time I had an 18 inch passenger car or whatever I used double quotes.  So now I have a number of double quotes in the fields title and au_desc.  Is there a way to replace all " with in or would I be better off using a different enclosure for columns?  I know you can use different delimiters, but not sure if you can change the " to ^ or | for instance??
>
> Some special characters like quotes do pose a problem in sql.
> In php you can escape the sql using inbuilt function. In dbase you will
> probably need the following to escape each and every character field
> before export
>
> function escape_str
> parameter esc_str
> local ret_str
> ret_str = esc_str
> if ['] $ esc_str or ["] $ esc_str or [\] $ esc_str or [$] $ esc_str
>     for n = len(ret_str) to 1 step -1
>       if substr(ret_str,n,1)$['\$"]
>         ret_str = stuff(ret_str,n,0,'\')
>       endif
>     next
> endif
> return ret_str
>
> This will replace 18" car with 18\" car so that mysql does not create a
> problem.
>
>
> It will depend upon how frequently you will require the transfer. If
> more than once then opt in for generation of .sql files.
>
> .sql files will require a bit of coding and file objects but once
> generated they will be trouble free.
>
> A sample line from a sql file
>
> INSERT INTO `head` VALUES ('SALES',1),('EXPENSES (DIRECT)',2),('EXPENSES
> (INDIRECT)',3),('PURCHASE',4),('CASH',5),('BANK',6),('CAPITAL',7),('PROFIT
> & LOSS',8),('FIXED ASSETS',9),('UNSECURED LOANS',10),('STOCK IN
> HAND',11),('SUNDRY DEBTORS (CUSTOMER)',12),('SUNDRY CREDITOR
> (SUPPLIER',13),('SUSPENSE (TEMPRORY)',14);
>
> This single line will insert 14 rows in table head.
>
> Coding may be aa bit cumbersome but once generated they will be trouble
> free and can be imported in all versions of mysql.
>
>
> Regards
> Akshat