MvGulik Posted February 25, 2011 Posted February 25, 2011 (edited) [sqlite, column 'name' is not unique. ?][-]Not really ... never mind.Baffled by the following situation.- first query/result is the table that is used.- Second query/result is generating the error.$sQuery = "SELECT * FROM session_old;" {St} [0,0] --- --- 0 (array dump), , GetTable2d:[5][5]. --- |--| 0| 1| 2| 3| 4| [0] |St| name | date | x | y | crc | [1] |St| tile_-1_-1.png | 20101115120514 | -1 | -1 | 1327511654 | [2] |St| tile_-1_0.png | 20101115120514 | -1 | 0 | 2065193479 | [3] |St| tile_0_-1.png | 20101115120514 | 0 | -1 | 3311147018 | [4] |St| tile_0_0.png | 20101115120513 | 0 | 0 | 2328083747 | --- --- 0 [0,0]$sQuery = "UPDATE session_old SET name = "tile_0_0.png" WHERE _rowid_ = 1" {St} [0,0] ! SQLite.au3 Error --> Function: _SQLite_Exec --> Query: UPDATE session_old SET name = "tile_0_0.png" WHERE _rowid_ = 1; --> Error: column name is not unique"column name is not unique" ???It only has one column with the name "name" ... and its also set to UNIQUE acourding to the table def.- CREATE TABLE "session_old" (name TEXT UNIQUE NOT NULL, date NUMERIC NOT NULL, x INTEGER, y INTEGER, crc INTEGER)I'm not seeing it ... Edited February 25, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
saywell Posted February 25, 2011 Posted February 25, 2011 Try: $sQuery = "UPDATE session_old SET name = 'tile_0_0.png' WHERE _rowid_ = 1" {St} [0,0] I try to use " for autoit and ' for sqlite. William
MvGulik Posted February 25, 2011 Author Posted February 25, 2011 Try: $sQuery = "UPDATE session_old SET name = 'tile_0_0.png' WHERE _rowid_ = 1" {St} [0,0]Fingers crossed ... nope, same error. I try to use " for autoit and ' for sqlite.[Checking SQLite docs ...]If you want to use a keyword as a name, you need to quote it. There are three ways of quoting keywords in SQLite: 'keyword' A keyword in single quotes is a string literal. "keyword" A keyword in double-quotes is an identifier. ...... maybe. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
MvGulik Posted February 25, 2011 Author Posted February 25, 2011 Arrggg ... New field data("tile_0_0.png") for column "name(UNIQUE)" is not UNIQUE.Think its solved. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
jchd Posted February 25, 2011 Posted February 25, 2011 (edited) Quote below is by Roger Binns from the SQLite mailing list:And just to blow your mind a little further, SQLite happily allows zero length table and columns names. This works.:CREATE TABLE ""("" ""); INSERT INTO "" VALUES(3); SELECT ""+"" FROM "";But IMVHO, playing this kind of game is like bare feet on razor edges. Pick your choice Edited February 25, 2011 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now