[yunqa.de] Re: DISQLITE cant UPDATE to TEXT to "password"

  • From: "spamyard" <spamyard@xxxxxx>
  • To: <yunqa@xxxxxxxxxxxxx>
  • Date: Mon, 4 Aug 2008 20:02:25 +0300

Thanks,

 

It was my poor knowledge of SQL standards.

I was sure it is bug or at least breaking common sense logics 

(assign column name to a column name, still is for me but … )

things clear for now again - thanks ;

 

Arvi

----- Original Message ----- 
Subject: [yunqa.de] Re: DISQLITE cant UPDATE to TEXT to "password" 
Date: Mon, 04 Aug 2008 17:38:19 +0200 
From: Delphi Inspiration <delphi@xxxxxxxx> 

spamyard wrote: 

>Following bug cant Update data to string “password” 
> 
>CREATE TABLE "IODevices" ("ID" INTEGER PRIMARY KEY, 
> "Name" TEXT, "Type" INTEGER, 
> "OptionsInt" INTEGER, "OptionsStr" TEXT, 
> "UserName" TEXT,"Password" TEXT, 
> "HostAddr" TEXT, "SendTo" TEXT, "SentFrom" TEXT, 
> "RetryDelay1" INTEGER, "RetryDelay2" INTEGER); 

The behavior you describe below is not a bug. 

You are mixing up literal strings and column names. If you want to use a
keyword as a name, you need to quote it. There are three ways of quoting
keywords in DISQLite:

'keyword' (single quote, aka apostrophe) 

A keyword in single quotes is interpreted as a literal string if it occurs
in a context where a string literal is allowed, otherwise it is understood
as an identifier.

"keyword" (double quotes, aka quotation mark) 

A keyword in double-quotes is interpreted as an identifier if it matches a
known identifier. Otherwise it is interpreted as a string literal.

[keyword] (opening and closing square brackets) 

A keyword enclosed in square brackets is always understood as an identifier.
This is not standard SQL. This quoting mechanism is used by MS Access and
SQL Server and is included in DISQLite for compatibility.

>UPDATE IODevices SET "Name" = "password" WHERE ID = 4; 
>this sets „Name” to „passwor” 

Assigns the value of the "password" column to the "name" column. 

>UPDATE IODevices SET "Name" = "passwors" WHERE ID = 4; 
>this sets „Name” to „passwors” 

Sets the value of the name column to the 'passwords' string. This is done
because there is not "passwors" column it is treated as a literal string.

>UPDATE IODevices SET "Name" = ‘password’ WHERE ID = 4; 
>this sets „Name” to „password” 

Never use curved quotes (as you did in the above example) in DISQLite3,
always use straight quotes like here: 'password' (Unicode Code Point Hex#
0027, decimal# 39). This is the proper way of quoting literal strings in
SQL, and DISQLite3 follows the standard in this regard.

Ralf 

_______________________________________________ 
Delphi Inspiration mailing list 
yunqa@xxxxxxxxxxxxx 
//www.freelists.org/list/yunqa 





Other related posts: