Re: [sqlite] INSERT OR REPLACE

2012-03-12 Thread Alek Paunov
On 12.03.2012 16:02, Christian Smith wrote: I've had a similar problem in the past, and solved it by using a pre-insert trigger to do the desired update. Thus, the insert/update from above becomes just an insert (or ignore), with an implied update in the trigger, which appears to be sematically

Re: [sqlite] where wrong

2012-03-12 Thread Simon Slavin
On 13 Mar 2012, at 2:42am, YAN HONG YE wrote: > C:\sqlite\lib>sqlite3 foods.db ".separator ',' " ".import dzhhkmysql.txt dzh" > sqlite3: Error: too many options: ".import dzhhkmysql.txt dzh" > Use -help for a list of options. You cannot just type lots of commands on the

[sqlite] where wrong

2012-03-12 Thread YAN HONG YE
C:\sqlite\lib>sqlite3 foods.db ".separator ',' " ".import dzhhkmysql.txt dzh" sqlite3: Error: too many options: ".import dzhhkmysql.txt dzh" Use -help for a list of options. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] import a text to sqlite

2012-03-12 Thread Simon Slavin
On 13 Mar 2012, at 2:28am, YAN HONG YE wrote: > here my code,where is wrong? > char mma[250]; > strcpy(mma,"sqlite3 foods.db \" .separator ',' \" \".import dzhhkmysql.txt > dzh\""); > system(mma); > ___ Instead of using system(), write that text to a file.

[sqlite] import a text to sqlite

2012-03-12 Thread YAN HONG YE
here my code,where is wrong? char mma[250]; strcpy(mma,"sqlite3 foods.db \" .separator ',' \" \".import dzhhkmysql.txt dzh\""); system(mma); ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Alex Queiroz
Hello, On Mon, Mar 12, 2012 at 11:52 PM, Simon Slavin wrote: > > On 12 Mar 2012, at 10:11pm, Alex Queiroz wrote: > >> - If I try to reindex the table, it fails; >> - If I drop the index and try to add it again, it fails. > > For both the above ... > >

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Simon Slavin
On 12 Mar 2012, at 10:11pm, Alex Queiroz wrote: > - If I try to reindex the table, it fails; > - If I drop the index and try to add it again, it fails. For both the above ... What command are you issuing, and what result are you getting from SQLite when it fails ? (i.e.

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Alex Queiroz
Hello, On Mon, Mar 12, 2012 at 11:34 PM, Petite Abeille wrote: > > > Hmmm… really? That would be most peculiar... > Indeed. I have now run this: sqlite> PRAGMA integrity_check; rowid 192697 missing from index userIdentityByUcgID rowid 192701 missing from index

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Jean-Christophe Deschamps
CREATE UNIQUE INDEX IF NOT EXISTS 'userIdentityByUcgID'ON 'user_identity' (shortName ASC, ucgID ASC); As a general rule you should reserve single quotes to string litterals. Either leave schema names alone (no whitespace, not keyword) or use [my pretty table], "my favorite table", `my

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Petite Abeille
On Mar 12, 2012, at 11:11 PM, Alex Queiroz wrote: > The problem is that a customer has a database where (shortName, ucgID) > have duplicates. Hmmm… really? That would be most peculiar... In any case, what does the following statement returns? select shortName, ucgID, count( * ) from

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Alex Queiroz
Hallo, On Mon, Mar 12, 2012 at 11:16 PM, Petite Abeille wrote: > > On Mar 12, 2012, at 11:11 PM, Alex Queiroz wrote: > >>       id                      INTEGER PRIMARY KEY, >> CREATE UNIQUE INDEX IF NOT EXISTS 'userIdentityByID'       ON >> 'user_identity' (id ASC); >

Re: [sqlite] Unique indexes apparently not working

2012-03-12 Thread Petite Abeille
On Mar 12, 2012, at 11:11 PM, Alex Queiroz wrote: > id INTEGER PRIMARY KEY, > CREATE UNIQUE INDEX IF NOT EXISTS 'userIdentityByID' ON 'user_identity' > (id ASC); Not directly related to your problem, but… these two clauses are redundant… a primary key is

[sqlite] Unique indexes apparently not working

2012-03-12 Thread Alex Queiroz
Hello, I have a problem with a customer database that is very strange. This is part of the DB's schema: - BEGIN - CREATE TABLE IF NOT EXISTS user_identity ( id INTEGER PRIMARY KEY, shortName TEXT, domainName TEXT,

Re: [sqlite] SELECT that returns the name of the fields

2012-03-12 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/03/12 14:42, Alessio Forconi wrote: > I am a novice with SQLite and I wonder if there is a select that > returns the names of the fields in the table? You most likely want pragma table_info:

[sqlite] SELECT that returns the name of the fields

2012-03-12 Thread Alessio Forconi
Hi all, I am a novice with SQLite and I wonder if there is a select that returns the names of the fields in the table? Thanks and sorry for my bad English -- Alessio Forconi ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Sqlite FTS retrieve inverted index

2012-03-12 Thread Mario Annau
Hi Alexey, tha Am 12. März 2012 22:14 schrieb Alexey Pechnikov : > See > http://www.sqlite.org/draft/fts3.html#fts4aux > > have already tried the fts4aux table. however, I would also need the number of occurrences of each term in each document. Therefore, like in the

Re: [sqlite] Sqlite FTS retrieve inverted index

2012-03-12 Thread Alexey Pechnikov
See http://www.sqlite.org/draft/fts3.html#fts4aux 2012/3/13 Mario Annau : > Hello, > > unfortunately I have already posted this question on > stackoverflow, > hope that this mailing list is

[sqlite] Sqlite FTS retrieve inverted index

2012-03-12 Thread Mario Annau
Hello, unfortunately I have already posted this question on stackoverflow, hope that this mailing list is right address. After I have implemented a full text search function in my application using Sqlite and

Re: [sqlite] Unique qualifier

2012-03-12 Thread Bryce Lembke
OK. I moved to 3.7.10 and it works fine now. I was using the 3.6.17 that was included with EJSCRIPT. I am wondering if there is an issue with that one, but I am good for now. Thanks. Bryce From: Bryce Lembke Sent: Monday, March 12, 2012 1:38 PM To: 'sqlite-users@sqlite.org' Subject:

Re: [sqlite] Unique qualifier

2012-03-12 Thread Bryce Lembke
Yes. It is odd. I am using the cmd prompt using WindowsXP. I have also tried it on a separate Windows7 machine with the same results. My shell is just doing Start->run then I type "cmd". I am going to try with a different version of sqlite. Bryce Re: [sqlite] Unique qualifier Simon

Re: [sqlite] INSERT OR REPLACE

2012-03-12 Thread Nico Williams
On Mon, Mar 12, 2012 at 9:02 AM, Christian Smith wrote: > On Fri, Mar 09, 2012 at 09:49:22AM +1100, BareFeetWare wrote: >> I suggest only using "insert or replace" if you genuinely want to delete and >> replace with a new row. This is generally not hat you want

Re: [sqlite] PRAGMA user_version of attached database

2012-03-12 Thread Marc L. Allen
> Thanks. Sorry I missed that. And, yeah.. it's right there at the top. With a pretty diagram, too. I know. For some reason, I thought it would be specified with ATTACH itself. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] PRAGMA user_version of attached database

2012-03-12 Thread Marc L. Allen
Thanks. Sorry I missed that. Marc > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Peter Aronson > Sent: Monday, March 12, 2012 1:43 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] PRAGMA

Re: [sqlite] PRAGMA user_version of attached database

2012-03-12 Thread Peter Aronson
"A pragma may have an optional database name before the pragma name. The database name is the name of an ATTACH-ed database or it can be "main" or "temp" for the main and the TEMP databases. If the optional database name is omitted, "main" is assumed. In some pragmas, the database name is

[sqlite] PRAGMA user_version of attached database

2012-03-12 Thread Marc L. Allen
When multiple databases are attached to the main, is there a way to get the user_version of any of the attached DBs? Thanks, Marc -- ** * * * * Marc L. Allen

Re: [sqlite] TEXT PRIMARY KEY

2012-03-12 Thread Kit
2012/3/12 Christoph P.U. Kukulies : > Wouldn't the second and the third run result in being the records just > replaced (since they have the > same data in all columns and I don't have any uniqueness defined). > > But instead I have three identical entries from each run. >

Re: [sqlite] Unique qualifier

2012-03-12 Thread Simon Davies
On 12 March 2012 15:49, Bryce Lembke wrote: > I cannot seem to get the UNIQUE constraint to work in sqlite. > > The following is the trace from my command line. > > Note that if I remove the UNIQUE constraint, it works fine. > > C:\>sqlite myDB.db > > SQLite version 3.6.17 > >

Re: [sqlite] TEXT PRIMARY KEY

2012-03-12 Thread Christoph P.U. Kukulies
Here's again the schema: CREATE TABLE instance ( path TEXT, basename TEXT, size INT, md5sum TEXT, creation_date TEXT, last_write_time TEXT, FOREIGN KEY (md5sum) REFERENCES resource (md5sum) ); CREATE TABLE

[sqlite] Unique qualifier

2012-03-12 Thread Bryce Lembke
I cannot seem to get the UNIQUE constraint to work in sqlite. The following is the trace from my command line. Note that if I remove the UNIQUE constraint, it works fine. C:\>sqlite myDB.db SQLite version 3.6.17 Enter ".help" for instructions Enter SQL statements terminated with a ";"

Re: [sqlite] INSERT OR REPLACE

2012-03-12 Thread Christian Smith
On Fri, Mar 09, 2012 at 09:49:22AM +1100, BareFeetWare wrote: > I suggest only using "insert or replace" if you genuinely want to delete and > replace with a new row. This is generally not hat you want if there are any > foreign keys. > > Only use "insert or ignore" if you are inserting exactly

Re: [sqlite] A possible bug probably partially fixed before

2012-03-12 Thread Max Vlasov
On Fri, Mar 9, 2012 at 12:04 PM, Max Vlasov wrote: > So looks on the way from 3.6.10 to 3.7.10 something was really fixed > related to this issue, but seems like not everything. > > Don't know whether this is serious or a problem at all, but I spent some time with such

Re: [sqlite] Possible typo when acquiring a "pending" lock.

2012-03-12 Thread Simon Slavin
On 12 Mar 2012, at 12:30pm, Richard Hipp wrote: > The code in question is part of the OS/2 driver, which is contributed > code. Nobody on the core SQLite team has the capability of compiling or > testing SQLite on OS/2. > > If any OS/2 users see this, can you please look into

Re: [sqlite] Possible typo when acquiring a "pending" lock.

2012-03-12 Thread Richard Hipp
On Mon, Mar 12, 2012 at 1:23 AM, James Russell Moore < j.russell.mo...@gmail.com> wrote: > Hello, I just saw what could be a possible typo when acquiring a pending > lock. > > In the current version of the amalgamation (3.7.10) line 23200 there is the > following code: > The code in question is

[sqlite] Fw: Installing SQLite into SD Card of Android Mobile

2012-03-12 Thread Deepak Pradhan
Hi Following is the Email Query I have made & i am on urgent need basis for getting a solution for the same. Original Query : zOn Fri, Mar 9, 2012 at 2:30 AM, Deepak Pradhan wrote: Hi I am Deepak Pardhan from India & I am Android Developer working for

Re: [sqlite] TEXT PRIMARY KEY

2012-03-12 Thread Kit
2012/3/12, Christoph P.U. Kukulies : >> INSERT OR IGNORE INTO resource ... >> INSERT OR REPLACE INTO instance ... > > Thanks a lot. What is the idea behind the INSERT OR REPLACE in your > solution? > Christoph If you edit a test for some version of your software, md5sum is

Re: [sqlite] TEXT PRIMARY KEY

2012-03-12 Thread Christoph P.U. Kukulies
Am 10.03.2012 09:06, schrieb Kit: 2012/3/9 Christoph P.U. Kukulies: CREATE TABLE instance ( path TEXT, basename TEXT, size INT, md5sum TEXT, creation_date TEXT, last_write_time TEXT, FOREIGN KEY (md5sum)

[sqlite] Risk of setting SQLITE_DISABLE_DIRSYNC ?

2012-03-12 Thread Diego Santa Cruz
Hi there, We are integrating SQLite into our software and I would like to understand what the impact of enabling SQLITE_DISABLE_DIRSYNC is, in particular when running on ext3 and ext4 filesystems (with journal=ordered mode). I searched the mail archives and could not find a response, the

[sqlite] Bug? Subtract Two Sum-Values

2012-03-12 Thread Markus Gehringer
Hi again and sorry when  this Posting notreally required. Few days ago i posted following problem, a testcase was required and I attached a testcase in my answer. Now i'm not sure if the testcase reciving the MaillingList, so i send the testcase again. Should be the testcase already arrived

Re: [sqlite] import txt file to sqlite

2012-03-12 Thread Simon Davies
On 12 March 2012 08:35, YAN HONG YE wrote: > I wanna import a text file to sqlite db, this follow code is right? >        char *zErrMsg = 0; >        sqlite3 *db; > >        rc=sqlite3_open("foods.db",); >        sqlite3_exec(db, "CREATE TABLE contact (fliename varchar(128)

[sqlite] import txt file to sqlite

2012-03-12 Thread YAN HONG YE
I wanna import a text file to sqlite db, this follow code is right? char *zErrMsg = 0; sqlite3 *db; rc=sqlite3_open("foods.db",); sqlite3_exec(db, "CREATE TABLE contact (fliename varchar(128) UNIQUE, fzip blob, ntest int, ntest1 int);", 0, 0, );