Re: [sqlite] Syntax Errors with various strings? & ...Ampersand

2006-07-05 Thread Gussimulator

Enclosing the strings with quotation marks did the job.
Thanks a lot.



- Original Message - 
From: "C.Peachment" <[EMAIL PROTECTED]>

To: <sqlite-users@sqlite.org>
Sent: Wednesday, July 05, 2006 6:39 AM
Subject: Re: [sqlite] Syntax Errors with various strings? & ...Ampersand



The solution I have adopted to both of these issues is to:

1. ensure all strings are enclosed by matching quotation marks, and

2. use the question mark substitution form of prepared statement
with subsequent bind of parameters. This can only be done from a
programming language and not the command line interface.


On Wed, 05 Jul 2006 10:44:31 +0200, Roger wrote:


I have a company name as follows:



Chemistry & chemicals



I have plenty of those in my database which come with ampersands, now
when i do a query i get nothing.



How best can i write the query using a string with an ampersand as part
of it.



I am developing in a PHP/SQlite environment.



On Wed, 5 Jul 2006 06:07:46 -0300, Gussimulator wrote:

Hi, When I have strings with "-", "!",  "\" or similar characters I get a 
syntax error.. Now, I thought this would happen with a few of this chars 
so I
made 2 routines in my program, one that converts each of this chars into a 
flag string, which then, by the other routine can be reverted to the
original characters to obtain the string in its original form, so I can 
later work with it by my side.


Now, I've found myself with syntax errors even on strings that didnt had 
any strange characters, So.. I'm wondering, what can I do to prevent this?
Does SQLite provide a "format" routine or is there anything I can do to 
prevent the syntax errors... like this ones? (since my data wont get into 
the

db if theres an error, of course, thats why Im concerned).

I'm really worried about this, hence I subscribed on the list (first 
message!).  I hope someone can help me out on this one, thanks.


And, Indeed.. I'm quite a newbie on SQL but, I never thought I'd find 
myself with this type of problem.











Re: [sqlite] Syntax Errors with various strings? & ...Ampersand

2006-07-05 Thread C.Peachment
The solution I have adopted to both of these issues is to:

1. ensure all strings are enclosed by matching quotation marks, and

2. use the question mark substitution form of prepared statement
with subsequent bind of parameters. This can only be done from a
programming language and not the command line interface.


On Wed, 05 Jul 2006 10:44:31 +0200, Roger wrote:

>I have a company name as follows:

>Chemistry & chemicals

>I have plenty of those in my database which come with ampersands, now
>when i do a query i get nothing.

>How best can i write the query using a string with an ampersand as part
>of it.

>I am developing in a PHP/SQlite environment.


On Wed, 5 Jul 2006 06:07:46 -0300, Gussimulator wrote:

>Hi, When I have strings with "-", "!",  "\" or similar characters I get a 
>syntax error.. Now, I thought this would happen with a few of this chars so I 
made 2 routines in my program, one that converts each of this chars into a flag 
string, which then, by the other routine can be reverted to the 
original characters to obtain the string in its original form, so I can later 
work with it by my side.

>Now, I've found myself with syntax errors even on strings that didnt had any 
>strange characters, So.. I'm wondering, what can I do to prevent this? 
Does SQLite provide a "format" routine or is there anything I can do to prevent 
the syntax errors... like this ones? (since my data wont get into the 
db if theres an error, of course, thats why Im concerned).

>I'm really worried about this, hence I subscribed on the list (first 
>message!).  I hope someone can help me out on this one, thanks.

>And, Indeed.. I'm quite a newbie on SQL but, I never thought I'd find myself 
>with this type of problem.