Re: [sqlite] Problems with character '

2006-02-28 Thread Jay Sprenkle
On 2/28/06, Teg <[EMAIL PROTECTED]> wrote:
> Hello Niels,
>
> That problem goes away if you switch to using the
>
> sqlite3_prepare
>
> sqlite3_bind_...()
>
> Syntax for insertions. Then all escaping becomes unnecessary. Using
> this syntax has removed an entire escaping layer I'd implemented.

It also prevents SQL injection attacks :)


Re: [sqlite] Problems with character '

2006-02-28 Thread Teg
Hello Niels,

That problem goes away if you switch to using the

sqlite3_prepare

sqlite3_bind_...()

Syntax for insertions. Then all escaping becomes unnecessary. Using
this syntax has removed an entire escaping layer I'd implemented.

C


Tuesday, February 28, 2006, 5:25:48 AM, you wrote:

NB> Hi Guys

NB> I'm having some problems dealing with the character '. Sqlite thinks
NB> fair enough that it should terminate the string, which I would like it
NB> to avoid. Are there any solutions to my problems.

NB> Thanks, Niels



-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]



Re: [sqlite] Problems with character '

2006-02-28 Thread Thierry Nauze


Le 28 févr. 06 à 14:25, Niels Boldt a écrit :


Hi Guys

I'm having some problems dealing with the character '. Sqlite thinks
fair enough that it should terminate the string, which I would like it
to avoid. Are there any solutions to my problems.

Thanks, Niels


Replace the   '  (one ' ) with  ''   (two ')

Regards,

--
Thierry NauzeSaint-Denis de la Réunion
Who don't speak English;o)





RE: [sqlite] Problems with character '

2006-02-28 Thread Brandon, Nicholas (UK)

Hi Niels,

You've just found the first problem with using TEXT columns. What you need to 
do is put another ' in front of it i.e. ''. Depending on the language you are 
using, you may find it includes a function that "escapes" special characters 
like '. For example, PHP supply "sqlite_escape_string".

The alternative is to store the data as binary. To do this, I believe you need 
to do the prepare/bind/exec statements.

Hope that some help.

Regards
Nick

-Original Message-
From: Niels Boldt [mailto:[EMAIL PROTECTED]
Sent: 28 February 2006 10:26
To: sqlite-users@sqlite.org
Subject: [sqlite] Problems with character '


   *** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.

 Keep this in mind if you answer this message.


Hi Guys

I'm having some problems dealing with the character '. Sqlite thinks
fair enough that it should terminate the string, which I would like it
to avoid. Are there any solutions to my problems.

Thanks, Niels



This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.




Re: [sqlite] Problems with character '

2006-02-28 Thread Philipp Knüsel
> Hi Guys
> 
> I'm having some problems dealing with the character '. Sqlite thinks
> fair enough that it should terminate the string, which I would like it
> to avoid. Are there any solutions to my problems.
> 
> Thanks, Niels

Hello Niels

try:

sqlite> CREATE TABLE t (id INTEGER, bez TEXT);
sqlite> INSERT INTO t (id, bez) values (1,"'");
sqlite> INSERT INTO t (id, bez) values (2,);
sqlite> SELECT * FROM t;
1|'
2|'

Does this already solve your problem, or do you need
something in another context?

Philipp




[sqlite] Problems with character '

2006-02-28 Thread Niels Boldt
Hi Guys

I'm having some problems dealing with the character '. Sqlite thinks
fair enough that it should terminate the string, which I would like it
to avoid. Are there any solutions to my problems.

Thanks, Niels