more about quotes

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jun 19 20:33:27 CDT 2003


on 6/19/03 19:58, Tim Davis at timdavis at amug.org wrote:

> Hi Ruslan,
> 
>>> 1. What is the difference between using single quotes and double
>>> quotes
>>> marks to surround literal strings in SQL statements?
>> 
>> String and date time constants must be in single quotes.
>> By standard you cannot use double quotes.
> 
>   I've been using what seems to work in my projects, but also trying
> to understand it. So I'm confused by your last statement. In a large
> project of mine I use single quote in all Select (32) and Delete (3)
> statements, but I have only double quotes work in Insert (7) and Update
> (6) statements. Why would the Insert and Update work with double quotes
> and apparently not with single quotes? Though I have to say that at
> very rare times (.01%) the Insert and Update don't succeed, don't know
> why. Should I be using single quote always in SQL (string, date/time)
> values including Insert and Update, and if its not working something
> else is wrong with my syntax?

Hmm, you sure?
I think INSERT and UPDATE also should accept single quotes.
May be algorithm do accept and double quotes also, but this is not standard.

Look by standard must be used single quotes for strings.
In new parser we follow by this rule.

In standard double quotes are used to wrap INDENTIFIERS with space.
We use right now [] for this. So now we use tbl.[fld with space]
By standard this should be tbl."fld with space"


Next, some DBMS, e.g. MySQL allow for string constants to be wrapped by
single quotes and by double quotes. May be in 2.0 we also will make this,
may be not. Will see.

>   In the mean time, before you get the next beta out, could you give
> me an idea of how to escape strings properly?

If you want self escape it you need write function that get string and
return other string., You iterate input string and you escape symbols that
needed

         )(?'.+*


So you get 

        Peter's tee

And return 

        Peter\'s tee



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list