Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-12 Thread Black, Michael (IS)
That's the nice thing about standards...there are so many to choose from...:-( Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems ___ sqlite-users mailing l

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-12 Thread Simon Slavin
On 12 Jun 2012, at 9:52am, rick wrote: > Well, I'm not entirely a casual user, but I don't know the SQL-92 standard > or it's successors. I'm an engineer, and sqlite for me is a tool. Above > query was used a long time in a MySQL DB, where it works as (I) expected. SQL (note that I'm talking ab

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-12 Thread rick
On 11/06/2012 21:48, Larry Brasfield wrote: > On June 11, rick wrote: >> Something I noticed today: >> >> sqlite> select * FROM words WHERE word = "id"; >> >> >> sqlite> select * FROM words WHERE word = 'id'; >> 13556|id >> >> sqlite> .schema >> CREATE TABLE words ( >> id integer primary key, >>

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-11 Thread Pavel Ivanov
> You have overstated the requirements upon SQL identifiers.  Quoting via > surrounding double-quote is only necessary if the identifier would not meet > the definition of a "regular identifier", loosely understood to be a letter > followed by letter, digit or underscore characters. Also quoting i

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-11 Thread Larry Brasfield
On June 11, rick wrote: Yes, it can be explained: says: 'keyword' A keyword in single quotes is a string literal. "keyword" A keyword in double-quotes is an identifier So, "id" is interpreted as a column name, not as the string literal 'id', unless t

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-11 Thread Larry Brasfield
On June 11, rick wrote: Something I noticed today: sqlite> select * FROM words WHERE word = "id"; sqlite> select * FROM words WHERE word = 'id'; 13556|id sqlite> .schema CREATE TABLE words ( id integer primary key, word varchar(64) ); Yes, it can be explained:

[sqlite] Quoting "id" versus 'id' in query

2012-06-11 Thread rick
Something I noticed today: sqlite> select * FROM words WHERE word = "id"; sqlite> select * FROM words WHERE word = 'id'; 13556|id sqlite> .schema CREATE TABLE words ( id integer primary key, word varchar(64) ); Yes, it can be explained: says:

Re: [sqlite] Quoting strings for SQLite

2010-04-20 Thread Dan Bishop
Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 04/18/2010 11:03 PM, Dan Bishop wrote: > >> I've written a quoting routine too, in C++. I just truncated strings at >> the first NUL character because I didn't think that SQLite supported them. >> > > SQLite suppo

Re: [sqlite] Quoting strings for SQLite

2010-04-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/18/2010 11:03 PM, Dan Bishop wrote: > I've written a quoting routine too, in C++. I just truncated strings at > the first NUL character because I didn't think that SQLite supported them. SQLite supports some weird things. In addition to suppo

Re: [sqlite] Quoting strings for SQLite

2010-04-18 Thread Dan Bishop
Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 04/17/2010 07:12 PM, Dan Bishop wrote: > >> Newlines, backslashes, and double quotes can be included literally. The >> only other character you need to worry about is NUL. >> > > Funnily enough I'm busy writing my

Re: [sqlite] Quoting strings for SQLite

2010-04-18 Thread Simon Slavin
So I'm summarising for the net. To render a string into quotable form (1) Replace each apostrophe in it with two apostrophes. (2) Surround it with single apostrophes. That's all there is to worry about apart from 0x00 characters, which don't worry me for other reasons. Do those two things and

Re: [sqlite] Quoting strings for SQLite

2010-04-17 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/17/2010 07:12 PM, Dan Bishop wrote: > Newlines, backslashes, and double quotes can be included literally. The > only other character you need to worry about is NUL. Funnily enough I'm busy writing my own quoting routine right now (the source ar

Re: [sqlite] Quoting strings for SQLite

2010-04-17 Thread Dan Bishop
Simon Slavin wrote: > I am using a particular program which needs to be able to mess with an > already-established database. It has to issue UPDATE and INSERT commands > using one string for the entire command: no opportunity for binding. So it > has to assemble commands by concatenation. In

Re: [sqlite] Quoting strings for SQLite

2010-04-17 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/17/2010 01:26 PM, Simon Slavin wrote: > Is there a simple, low-cost way I can use the QUOTE() function, http://www.sqlite.org/c3ref/mprintf.html Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with

[sqlite] Quoting strings for SQLite

2010-04-17 Thread Simon Slavin
I am using a particular program which needs to be able to mess with an already-established database. It has to issue UPDATE and INSERT commands using one string for the entire command: no opportunity for binding. So it has to assemble commands by concatenation. In order to do this properly I

Re: [sqlite] Quoting identifiers (was: Updatable views)

2008-02-11 Thread BareFeet
Puneet said: > Keep SQLite simple, and keep it compliant with whatever the single > ANSI SQL standard may be there out there. Yes, I agree, but only because it seems that SQLite's allowance for double quotes for literals (which I have said introduces ambiguity and prevents proper error mess

[sqlite] Quoting identifiers (was: Updatable views)

2008-02-11 Thread BareFeet
Hi Dennis, >> I use the square brackets for identifiers because I find that >> using double quotes doesn't catch errors. If I say select "column >> name that does not exist" I get a string back. But if I use square >> brackets SQLite >> gives me an error that the column doesn't exist, which

Re: [sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread Kees Nuyt
On Sat, 09 Feb 2008 17:16:57 +0100, you wrote: >On Sat, 9 Feb 2008 23:51:03 +1100, you wrote: [..] >>create table MyTable( MyField ); >>alter table MyTable rename to MyNewTable; >>select SQL from SQLite_Master; >> >>which gives: >> >>CREATE TABLE 'MyNewTable'( MyField ) >> >>SQLite should instea

Re: [sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread Kees Nuyt
On Sat, 9 Feb 2008 23:51:03 +1100, you wrote: >Following up: >> This also says that SQLite will accept a single quoted literal as an >> identifier in certain situations. I'm not aware of any other >> database that used single quotes that way, but I'm sure there was >> one somewhere along the

[sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread BareFeet
Following up: > This also says that SQLite will accept a single quoted literal as an > identifier in certain situations. I'm not aware of any other > database that used single quotes that way, but I'm sure there was > one somewhere along the line. It is a pain that SQLite accepts single quot

Re: [sqlite] quoting

2005-08-01 Thread Edwin Knoppert
I wrote a byte to hex converter which is very fast. I'm very pleased with the poss. of using the X'' notation. Saves all kinds of (future?) problems. - Original Message - From: "Cory Nelson" <[EMAIL PROTECTED]> To: Sent: Sunday, July 31, 2005 7:58 P

Re: [sqlite] quoting

2005-07-31 Thread Kurt Welgehausen
> How do I quote a null byte? There is no way to quote a null byte in SQL. If you're trying to pass a string with a literal null byte in it to a perl function, it may be that underlying C code is failing because it expects a null-terminated string; in that case, substituting "\000" for the null b

Re: [sqlite] quoting

2005-07-31 Thread Jakob Hirsch
Cory Nelson wrote: > strings should be surrounded by single quotes, so only single quotes > and null bytes need to be quoted. How do I quote a null byte? I found nothing regarding this and the Perl Module's quote function leaves null bytes unchanged (the query fails then). > but, it would be fa

Re: [sqlite] quoting

2005-07-31 Thread Cory Nelson
strings should be surrounded by single quotes, so only single quotes and null bytes need to be quoted. but, it would be faster to use binding and not have to deal with quoting. On 7/31/05, Jakob Hirsch <[EMAIL PROTECTED]> wrote: > Hi, > > SQLite happens to be a nice piece of software, so it is a

[sqlite] quoting

2005-07-31 Thread Jakob Hirsch
Hi, SQLite happens to be a nice piece of software, so it is about to be integrated into the Exim MTA. Exim provides a quoting function for every database it supports, so will be for SQLite. Is it correct that the only character that needs to be encoded is the single quote (')? While testing I saw

Re: [sqlite] quoting strings issue

2005-06-09 Thread Puneet Kishor
On Jun 9, 2005, at 2:30 PM, D. Richard Hipp wrote: On Thu, 2005-06-09 at 14:29 -0500, Puneet Kishor wrote: Thanks to those who responded. However, this thread is going away from what I really asked... not how to quote a string, but to confirm whether or not SQLite had any idiosyncrasies relate

Re: [sqlite] quoting strings issue

2005-06-09 Thread Jay Sprenkle
> Thanks to those who responded. However, this thread is going away from > what I really asked... not how to quote a string, but to confirm > whether or not SQLite had any idiosyncrasies related to string-quoting > other than the normal "escape single-quotes within the string." You're doing it the

Re: [sqlite] quoting strings issue

2005-06-09 Thread D. Richard Hipp
On Thu, 2005-06-09 at 14:29 -0500, Puneet Kishor wrote: > Thanks to those who responded. However, this thread is going away from > what I really asked... not how to quote a string, but to confirm > whether or not SQLite had any idiosyncrasies related to string-quoting > other than the normal "es

Re: [sqlite] quoting strings issue

2005-06-09 Thread Puneet Kishor
Thanks to those who responded. However, this thread is going away from what I really asked... not how to quote a string, but to confirm whether or not SQLite had any idiosyncrasies related to string-quoting other than the normal "escape single-quotes within the string." Btw, I am using $dbh->q

Re: [sqlite] quoting strings issue

2005-06-09 Thread Clark Christensen
--- Dennis Cote <[EMAIL PROTECTED]> wrote: > Clark Christensen wrote: > > >IOW, something like. > > > >$sql = "update t1 set a = ?"; > >$string = $dbh->quote( qq(some long string; has many > >'single quotes') ); > >$sth = $dbh->prepare($sql); > >$rc = $sth->execute($string); > > > >will probabl

Re: [sqlite] quoting strings issue

2005-06-09 Thread Dennis Cote
Clark Christensen wrote: IOW, something like. $sql = "update t1 set a = ?"; $string = $dbh->quote( qq(some long string; has many 'single quotes') ); $sth = $dbh->prepare($sql); $rc = $sth->execute($string); will probably eliminate both the prepare() error, and an UPDATE error later. -Clark

Re: [sqlite] quoting strings issue

2005-06-09 Thread Clark Christensen
--- Puneet Kishor <[EMAIL PROTECTED]> wrote: > While I await some insight into my previously posted > "database locking" > problem, I have a question regarding quoting text. > > Does SQLite have any issues with anything other than > single-quotes? For > example, with colon, or semi-colon? >

[sqlite] quoting strings issue

2005-06-09 Thread Puneet Kishor
While I await some insight into my previously posted "database locking" problem, I have a question regarding quoting text. Does SQLite have any issues with anything other than single-quotes? For example, with colon, or semi-colon? For example, I find occasional complaints if I try to update/i