Re: [sqlite] Best Match Query

2007-08-06 Thread Simon Davies
Hi Ragha, C:\Joinerysoft\JMS\TestArea>sqlite3 tst.db SQLite version 3.4.0 Enter ".help" for instructions sqlite> sqlite> create table tst( c1 integer, c2 test ); sqlite> insert into tst values( 1, '44' ); sqlite> insert into tst values( 2, '442' ); sqlite> insert into tst values( 3, '4454' ); sql

Re: [sqlite] Delete all other distinct rows

2007-08-08 Thread Simon Davies
Andre, C:\Joinerysoft\JMS\dev\trunk>sqlite3 tst.db SQLite version 3.4.0 Enter ".help" for instructions sqlite> create table tmp( id integer, name text ); sqlite> insert into tmp values( 1, 'some name' ); sqlite> insert into tmp values( 2, 'some name' ); sqlite> insert into tmp values( 3, 'some nam

Re: [sqlite] Dump with where clause

2007-08-17 Thread Simon Davies
Updating Igor's suggestion, just remove 'temp' from the line create temp table image_temp as select * from file_folder_data; For me .dump then works as expected. Rgds, Simon On 17/08/07, Andre du Plessis <[EMAIL PROTECTED]> wrote: > Hi Dennis this seems like a good idea, but there is a problem: >

Re: [sqlite] Increasing performance of joins with a group by clause?

2007-08-19 Thread Simon Davies
Hi John, > Folks are dumb where I come from; can someone please explain how this > could be correct? I don't know where you come from, so I can't help you. :-) sorry, Simon - To unsubscribe, send email to [EMAIL PROTECT

Re: [sqlite] Sparse matrix

2007-08-22 Thread Simon Davies
Hi Tom, Its a pretty gruesome bit of sql... C:\Joinerysoft\JMS\dev\trunk> sqlite3 tst.db SQLite version 3.4.0 Enter ".help" for instructions sqlite> create table List( Code text ); sqlite> insert into List values( 'a' ); sqlite> insert into List values( 'a' ); sqlite> insert into List values( 'a

Re: [sqlite] Sparse matrix

2007-08-22 Thread Simon Davies
Hi Tom, Here's a less gruesome version - no cases. I've given no thought to performance comparisons. C:\Joinerysoft\JMS\dev\trunk> sqlite3 tst.db SQLite version 3.4.0 Enter ".help" for instructions sqlite> insert into List values( 'a' ); sqlite> insert into List values( 'a' ); sqlite> insert int

Re: [sqlite] Newby Question

2007-08-28 Thread Simon Davies
Hi Graham, The trigger needs a where clause, as in the following: sqlite> sqlite> create table temp( id integer primary key, ...> interested integer, ...> val1 text, ...> val2 text, ...>

Re: [sqlite] BestMatch and SqliteStatment Clash

2007-08-29 Thread Simon Davies
On 29/08/2007, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: > > select * from test where '982' like t || '%' order by t desc limit 1; > > This works but will not work for earlier data(9854002656).So seems to be bug. > > regards > ragha '9854002656%' is not a match for '982', so seems not to be a

Re: [sqlite] BestMatch and SqliteStatment Clash

2007-08-29 Thread Simon Davies
> This email and its attachments contain confidential information from HUAWEI, > which is intended only for the person or entity whose address is listed > above. Any use of the information contained herein in any way (including, but > not limited to, total or partial disclosure, reproduction, or dissemination) > by persons other than the inten

Re: [sqlite] Re: BestMatch and SqliteStatment Clash

2007-08-29 Thread Simon Davies
ragha, you want something to give you a 'best match'. The 'like' operator in the way you are using it does not do that, but it IS working as it should. I am not sure how to make it any clearer. Rgds, Simon On 29/08/2007, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: > > Hi, > > Pls see my last

Re: [sqlite] How to generate Unique ID?

2007-08-30 Thread Simon Davies
Hi Phani, What is the point of generating a unique integer separate from the (unique) integer primary key? If you use the primary key as your unique identifier, sqlite will take care of locating unused (deleted) ids when the maximum value is reached (according to the documentation; I have not tri

Re: [sqlite] How to generate Unique ID?

2007-08-30 Thread Simon Davies
On 30/08/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote: > Hi Simon, >The problem is I have rowid which is the PRIMARY Key, and > another column puid which should be unique. Now when I do vacuum rowid > changes, but puid doesn't change and I don't want puid to change. Now it > is possible

Re: [sqlite] How to generate Unique ID?

2007-08-30 Thread Simon Davies
On 30/08/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote: > Simon, > > > Without knowing your design, it looks like you wish to be able to > > determine type from the id. This is creating a problem. Can you not > > store the type separately from the id? > > Why is this creating a problem? > No it'

Re: [sqlite] How to generate Unique ID?

2007-08-30 Thread Simon Davies
On 30/08/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote: > Simon, >Yeah you can term the problem like that. Can't I use the > function which is assigning a unique id for INTEGER PRIMARY KEY column > inside sql? If yes, how to use it? > > Regards, > Phani > Phani, With the whole of the s

Re: [sqlite] Regenerating ROWID...?

2007-08-31 Thread Simon Davies
On 31/08/2007, Babu, Lokesh <[EMAIL PROTECTED]> wrote: > I was trying the following piece of code (see below), > > The requirement here is very simple, I want the t_id field or ROWID > field to be regenerated sequentially even after delete has been > performed. > Hi Lokesh, You can achieve this

Re: [sqlite] best way to match a date but not a time?

2007-09-02 Thread Simon Davies
On 02/09/07, C M <[EMAIL PROTECTED]> wrote: > Hi, I'm very new to SQLite, and I'm using it with Python. > > I want to have queries that will match dates but not care about times. . . . Hi, If your dates are stored in julian day (real) format, then the fractional part will indicate the time of day

Re: [sqlite] Re: select round(98926650.50001, 1) ?

2007-09-05 Thread Simon Davies
Hi All, Here's my 2p... on XP and VC++ (for my sins!) The round function works. sqlite_column_double() returns 98926650.5 The '01' on the end is introduced by calling sqlite_column_text (in shell.c). This results in reaching the line sqlite3_snprintf(NBFS, z, "%!.15g", pMem->r); in sq

Re: [sqlite] Re: select round(98926650.50001, 1) ?

2007-09-05 Thread Simon Davies
rather than C++ (it probably was doing that anyway), but again with the same result. Rgds, Simon On 05/09/07, Nuno Lucas <[EMAIL PROTECTED]> wrote: > On 9/5/07, Simon Davies <[EMAIL PROTECTED]> wrote: > [...] > > in sqlite3VdbeMemStringify. > > This resolves down to call

Re: [sqlite] INSERT after creating an INDEX

2007-09-13 Thread Simon Davies
Hi Frank, On 3.4.2 built from amalgamation on XP using Visual Studio I can follow your scenario without problems. I used command line shell and tcl shell. More detail will help (version etc). Rgds, Simon On 13/09/2007, Frank Fiedler <[EMAIL PROTECTED]> wrote: > Hello everybody, > > I have a pro

[sqlite] 'Misuse of aggregate' reported in subquery which works as a query

2007-09-18 Thread Simon Davies
Hi All, Is this expected behaviour (pre-compiled windows binary)? SQLite version 3.4.2 Enter ".help" for instructions create table monthNames( shortName TEXT, longName TEXT ); insert into monthNames values( 'Jan', 'January' ); insert into monthNames values( 'Feb', 'February' ); insert into monthN

Re: [sqlite] select COUNT (DISTINCT column1, column2) from table?

2007-09-25 Thread Simon Davies
On 25/09/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote: . . > Assume you have a following data: > > matchNo, year, month > > 34 2007 9 > > 27 2006 5 > > 26 2006 5 > > Now distinct year, month will return > > 2007, 9 > > 2006, 5 > > Is there a way by which I ca

Re: [sqlite] select COUNT (DISTINCT column1, column2) from table?

2007-09-25 Thread Simon Davies
On 25/09/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote: > Hi Simon, . . > Here I > need to find the number of distinct combinations of year, month not the > count for a particular year, month. > > Regards, > Phani > SQLite version 3.4.2 Enter ".help" for instructions sqlite> sqlite> create tabl

Re: [sqlite] Merge two rows/records

2007-10-08 Thread Simon Davies
On 08/10/2007, Daan van der Sanden <[EMAIL PROTECTED]> wrote: > Hi, > > Is it possible to merge two rows with SQLite? Say I have the following table": > CREATE TABLE foo(a integer, b integer, c integer, d integer); > CREATE INDEX idx ON foo(a,b); > > With the following data: > > INSERT INTO foo VAL

Re: [sqlite] Re: Merge two rows/records

2007-10-08 Thread Simon Davies
Hi Daan, You could try this: sqlite> CREATE TABLE foo(a integer, b integer, c integer, d integer, ...> unique (a, b) on conflict ignore); sqlite> CREATE TRIGGER fooUnique before insert on foo ...> when exists (select a from foo where a=new.a and b=new.b) .

Re: [sqlite] Reading error outside the while

2007-10-09 Thread Simon Davies
On 09/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I got an error when I try to read some data outside the while{}, inside the > while{} it's ok, an idea ? > test.db have just one "table1" and a "field1" with values "one", "two", > "three". . . . >const unsigned char *my

Re: [sqlite] Re[sqlite] garding converting .db files in SQLite2.1 to SQLite3 version

2007-10-23 Thread Simon Davies
On 23/10/2007, Vijaya Lakshmi <[EMAIL PROTECTED]> wrote: . > sqlite.org and used the command line > > sqlite>sqlite old.db .dump | sqlite 3 new.db > but after this nothing happens it just shows as below... > > Type the command at the operating system prompt, not whilst sqlite is already runnin

Re: [sqlite] Combining .output and .read in a batch file

2009-05-07 Thread Simon Davies
2009/5/7 Leo Freitag : > Hallo, > > I try to get run the following in a batch file > > Open database "test.db" > Set output to "o.txt" > Read sql-statement form "r.sql" > > === r.sql - Start === > select * from table1; > === r.sql - End === > > Thinks like the following didn't work: > sqlite3 test.

Re: [sqlite] Newbie trying to list resultSet with C

2009-05-08 Thread Simon Davies
2009/5/8 Nuno Magalhães : > Greetings. > > I've managed to compile the example, after installing the amalgamation > and using -lsqlite3 in gcc, otherwise it'll complain about undefined > references. > > I can't figure out how to read a simple result set. I know i shoud use > sqlite3_exec and/or sql

Re: [sqlite] Newbie trying to list resultSet with C

2009-05-08 Thread Simon Davies
2009/5/8 Simon Davies : > 2009/5/8 Nuno Magalhães : >> Greetings. >> >> I've managed to compile the example, after installing the amalgamation >> and using -lsqlite3 in gcc, otherwise it'll complain about undefined >> references. >> >> I can

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Simon Davies
2009/5/9 Sam Carleton : > This is my first BEFORE INSERT trigger in SQLite and I am getting an error: > > SQL error: near "new": syntax error > > My goal is that on an insert only the insertedby value is provide. > The trigger will set that to the updatedby, insertedon and updatedon > fields.  I se

Re: [sqlite] Select on foreign key NULL

2009-05-26 Thread Simon Davies
2009/5/26 Leo Freitag : > Hallo, > > I got some problems with a select on a foreign key with value null. > I want to filter all male singers. > > CREATE TABLE 'tblsinger' ('id' INTEGER PRIMARY KEY, 'name' TEXT, > 'fkvoice' INTEGER, 'sex' TEXT); > INSERT INTO "tblsinger" VALUES(1,'Anna Netrebko',1,

Re: [sqlite] sqlite programmed in C++

2009-06-02 Thread Simon Davies
2009/6/2 Sylvain Pointeau : > Hello, > I would like to know if someone already though about to introduce C++ in > SQLite? > I just think about a minimal subset of C++ that will not make any > performance penalty > (like C with classes) Prob good idea to look through these: http://www.sqlite.org/cv

Re: [sqlite] How does SQLite handle newlines in values?

2009-06-13 Thread Simon Davies
2009/6/13 Florian v. Savigny : > > > I'm very sorry if this is a very stupid question. Intuitively, I would > assume that of course, any TEXT or BLOB field may contain > newlines. I'm, however, puzzled about two things (it all refers to the > commandline interface): > > - while I can insert values

Re: [sqlite] Sqlite-3.5.9: getting sqlite_autoindex error

2009-06-17 Thread Simon Davies
2009/6/17 hiral : > Any suggestion on this !!! Your database has been corrupted. http://www.sqlite.org/lockingv3.html#how_to_corrupt Rgds, Simon > > On Tue, Jun 16, 2009 at 4:34 PM, h o wrote: > >> Hi, >> >> I am using sqlite-3.5.9 and observing a 'disk image malformed' error >> nfs, on doing '

Re: [sqlite] Sqlite-3.5.9: getting sqlite_autoindex error

2009-06-18 Thread Simon Davies
2009/6/17 hiral : > Hi Simon, > >  I looked into it but couldn't find the exact reason for my bug. > >  If you have any idea please let me know. Sorry, other than the link, I can not help. > >  Also I would appreciate, if you can let me know what does this error mean > in terms of btree/pager mod

Re: [sqlite] Sqlite-3.5.9: getting sqlite_autoindex error

2009-06-18 Thread Simon Davies
2009/6/18 hiral : > Hi Simon, > > Thank you for your quick reply. > > I am sorry for more general questions. > > As I mentioned I was getting corrupted db error with sqlite-3.5.9, but when > I tried with sqlite-3.6.4 it is no more corrupting the db. > -- so was it a bug with sqlite-3.5.9 ? and got

Re: [sqlite] Sqlite-3.5.9: getting sqlite_autoindex error

2009-06-19 Thread Simon Davies
2009/6/19 hiral : > Hi Simon / John, > > Thank you for replies. > >> You are able to repeatably corrupt the db under SQLite 3.5.9? It would >> be worthwhile publishing a script that can do that. >  > "was getting error often" or "did get error ONCE"?? > I am running application which uses the db ov

Re: [sqlite] Value returned by sqlite3_column_bytes for strings

2009-07-03 Thread Simon Davies
2009/7/3 chandan : > Hi all, >    Consider the following scenario, >    1. A table contains a column of type "text". >    2. The value of this column for the first row is say "linux". > > If we execute the SQL statement: "select name from some_tbl where id = ?" > using sqlite3_step() API, then what

Re: [sqlite] Column headers of result

2009-07-04 Thread Simon Davies
2009/7/5 BareFeet : >>> > Hi Simon, > >>> How can I get just the column headers without all the result rows? >> >> Turn headers on, then perform a search which gives no results. > > Unfortunately, the sqlite3 command line tool does not show the headers > when there are no result rows. In any case,

Re: [sqlite] Query by Day

2009-07-06 Thread Simon Davies
2009/7/6 Rick Ratchford : > Greetings! > Hi Rick, > I'm having trouble with what I thought would be a simple SQL query. > >    SQLString = "SELECT strftime('%d', Date) as Day, IsSwingTop1 as Tops, > IsSwingBtm1 as Btms " & _ >                "FROM TmpTable WHERE Day = 11" > > I'm trying to create

Re: [sqlite] SQLITE is not working in pthread

2009-07-10 Thread Simon Davies
2009/7/10 Pramoda M. A : > > Hi, > >  We r using Fedora Linux 10. Our application is, when any device is inserted, > we will detect that create thread using pthread_create API. Which will find > all MP3 files in the device and extract the metadata present in the mp3 files > and fill a structre a

Re: [sqlite] How to create a table that has a field that can hold a 64-bit interger

2009-07-15 Thread Simon Davies
2009/7/15 Dieter Dasberg : > Hello, > . . . > > This > > create table test (Afield INTEGER) > > leads always to a data-size of 4 byte, What makes you think this? See http://www.sqlite.org/datatype3.html > what I need is a data-size of 8 byte. > > What can I do? > > Best regards, > > Dieter SQLi

Re: [sqlite] Is there a substitute for Sqlite3_get_table ?

2009-07-17 Thread Simon Davies
2009/7/17 Atul_Vaidya : > > Hi, . . . > My question is, is it possible in > SQlite to retrieve the data stored in the database in the format in which it > is stored when the data was inserted in it ? for eg: if I store the data as > an Int, will I get it back as an Int, from what i get from the get

Re: [sqlite] Some SQL statements are not executing

2009-07-20 Thread Simon Davies
2009/7/20 Gary Verhaegen : > Hi everybody, . . . > I have narrowed the problem to the few following lines : > > > #define DEBUG > > int db_execute(sqlite3 *db, char stmt[STR_LEN]) { > DEBUG   PRINT("\nentering db_execute with statement %s.", stmt); >       int ret=0; >       sqlite3_stmt *s; >    

Re: [sqlite] Merging blobs on disk without taking up memory???

2009-08-03 Thread Simon Davies
2009/8/3 sorka : > > Hi. I have a table that stores pieces of an image as a bunch of blobs. I get > the pieces out of order and store them in a table until I get all of the > pieces I need. I then want to assemble them in order and store the resulting > complete image in in another table entirely.

Re: [sqlite] Error 14 - SQLITE_CANTOPEN

2009-08-13 Thread Simon Davies
2009/8/13 Simon Slavin : > > On 13 Aug 2009, at 12:47pm, Otto Grunewald wrote: > >> on the website at the following address: >> >> http://www.sqlite.org/c3ref/exec.html >> >> The second paragraph states the following: >> >> The error message passed back through the 5th parameter is held in >> memor

Re: [sqlite] Re triving the database name from the sqlite pointer ....

2009-08-18 Thread Simon Davies
2009/8/18 Atul_Vaidya : > > Hi, >   I have a Sqlite3 pointer. Is there any way to get the filename of this > pointer ? Execute "PRAGMA database_list;" See http://www.sqlite.org/pragma.html#pragma_database_list > Regards, > Atul Rgds, Simon ___ sqlite-

Re: [sqlite] how to make journal file roll back to my database file?

2009-08-26 Thread Simon Davies
2009/8/26 Zhanjun You : > hello all, >        I have read the article " > http://www.sqlite.org/fileformat.html#journal_file_formats"; and " > http://www.sqlite.org/fileformat.html#rollback_journal_method",but I am even > more confused, anyone have some sample code for rollback_journal_method. >Fr

Re: [sqlite] triggers question, OLD reference is not available after SET statment

2009-08-27 Thread Simon Davies
2009/8/27 Jarod Tang : > Hi List users, > > In my code, i create two triggers (Trigger_A, Trigger_B) on a table ( > sample_db), but after execution, it's found that Trigger_A is not executed > correctly ( old.msg_box hasnt be put into table log ). And it seems to me > that SqlLite invalids the OLD

Re: [sqlite] Integer Storage class

2009-09-02 Thread Simon Davies
2009/9/2 Sebastian Bermudez : > hi! i have an table ( articles ) with a column for EAN13 Barcodes like ( > 7790080066784). > I have created the column with Integer data type... ( i have chose that data > type after read the SQLITE DOC where it' say: "INTEGER. The value is a signed > integer, stor

Re: [sqlite] Integer Storage class

2009-09-02 Thread Simon Davies
2009/9/2 Sebastian Bermudez : > Ok. my problem is my SQLITE front end (SQLITE ADMINISTRATOR v 0.8.3.2) ... > show me 0 (cero) in that column. Looks like SQLITE ADMINISTRATOR v 0.8.3.2 only deals with signed 32 bit values. 2147483647 it accepts as a valid value, 2147483648 it rejects, saying that

Re: [sqlite] One more SQL statement question

2009-09-09 Thread Simon Davies
2009/9/10 Dennis Volodomanov : > Hello, > > I have one more SQL query question - the people on this list have been very > helpful in the past, so thank you! > > I'm trying to create a trigger that would delete unreferenced rows from a > table. > > Let's say the schema is like this: > > TABLEA ( I

Re: [sqlite] JOIN (SELECT o.pid, SUM(o.qty) 'qty_sold' FROM ORDERS o) qs

2009-09-15 Thread Simon Davies
009/9/15 Gert Cuykens : >   SELECT t.pid, >          t.txt, >          t.price, >          t.qty - IFNULL(qs.qty_sold, 0) 'onhand_qty' >     FROM PRODUCTS t > LEFT JOIN (SELECT o.pid, >                  SUM(o.qty) 'qty_sold' >             FROM ORDERS o) qs ON qs.pid = t.pid >    WHERE t.pid = ? > >

Re: [sqlite] Creating custom function for recursive queries

2009-09-16 Thread Simon Davies
2009/9/16 Marcel Strittmatter : > Hi > > I implemented a custom function that returns a comma separated list of > primary keys as a string by making recursive queries. This works well > if I don't use subqueries. But I like to use subqueries like this > > SELECT * FROM users WHERE id IN (SELECT par

Re: [sqlite] How can I do to build this query with a text that contains ' and "?

2009-09-20 Thread Simon Davies
2009/9/20 Guillermo Varona Silupú : > Hi > I want to insert this text: > > 1' equivale a 12" > > cQry := "INSERT INTO Tabla1 (Code,Equiv) VALUES (10, "1' equivale a 12"") INSERT INTO Tabla1 (Code,Equiv) VALUES (10, '1'' equivale a 12"'); > > TIA > Best Regards > GVS > > P.D.: Sorry for the post p

Re: [sqlite] Viewer for blobs in hex?

2009-09-21 Thread Simon Davies
2009/9/21 Yan Bertrand : >                Hi all, > > > > I would like to display the contents of blobs in my table as > hexadecimal. I have not found any easy way of doing this. I tried : > > -          wxSQLitePlus, but it does not display blobs contents (or I > could not make it do so) > > -    

Re: [sqlite] Why are allowed to keep a text of 3 characters in a field that has been set to 2?

2009-09-21 Thread Simon Davies
2009/9/21 Guillermo Varona Silupú : > Hi > In these SQL commands: > > CREATE TABLE "test" ("code" char(2)); > INSERT INTO test (code) VALUES("123") > > Why are allowed to keep a text of 3 characters in a field that has been > set to 2? > Is a bug? No - I suggest that you have a look at http://www.

Re: [sqlite] Date comparisons

2009-09-21 Thread Simon Davies
2009/9/21 Barton Torbert : > Hello, > > I am having trouble doing a rather odd data comparison. > > I have two table, each with a DateTime field.  The timestamps in these fields > do not match exactly.  I want to find the row in the second table that is > within a specific time period around the

Re: [sqlite] Strange File Import Error

2009-09-22 Thread Simon Davies
2009/9/22 Pavel Ivanov : >>   If I understand correctly, I can remove all quotes as long as the only >> commas delineate columns. Or, I can use the pipe as a separator and remove >> all quotes, too. Correct? > > AFAIK, you can do only the first - remove all quotes and make sure > that no commas met

Re: [sqlite] Strange File Import Error

2009-09-22 Thread Simon Davies
2009/9/22 Rich Shepard : > On Tue, 22 Sep 2009, Simon Slavin wrote: > >> Use a text editor on the file and change all occurrences of (including the >> quotes) >> >> "," >> >> to >> >> "|" >> >> then set .separator to the single character | before you import the >> file. > > Simon, > >   The default

Re: [sqlite] Strange File Import Error

2009-09-22 Thread Simon Davies
2009/9/22 Rich Shepard : > On Tue, 22 Sep 2009, Simon Davies wrote: > >> Remove the trailing pipe character > >   Did that as soon as I learned it made no difference. Each line should be > clean and there are 25 columns defined in it. Quite frustrating. > 117172|E

Re: [sqlite] Strange File Import Error

2009-09-22 Thread Simon Davies
2009/9/22 Rich Shepard : > On Tue, 22 Sep 2009, Simon Davies wrote: > >>> 117172|Engineered Structures Inc.|Brockway Center|10875 SW Herman >>> Rd|Tualatin|97062-8033|Washington|NWR|45.3834|-122.7882|1542|Nonresidential >>> Construct NEC|Gen12c(Agent)|Stormwate

Re: [sqlite] Strange File Import Error

2009-09-22 Thread Simon Davies
2009/9/23 Rich Shepard : > On Tue, 22 Sep 2009, Simon Davies wrote: > >> 25 separators -> 26 columns? > >   That's what the command line processor is telling me. Makes no sense to me > at all. I remove the first line, and get the same error for line 2 which is >

Re: [sqlite] Datetime mystery

2009-10-08 Thread Simon Davies
2009/10/8 Fredrik Karlsson : > Hi, > > > > On Thu, Oct 8, 2009 at 12:04 AM, P Kishor wrote: >> On Wed, Oct 7, 2009 at 5:02 PM, Fredrik Karlsson wrote: >>> Dear list, >>> >>> I am sorry if I am asking a FAQ, but what is differnent with >>> datetime() and time()? >>> date # This is the correct

Re: [sqlite] Select * from table where field = "value" does not work when "value" is also a field....

2009-10-14 Thread Simon Davies
2009/10/13 Hillebrand Snip : > I have a database with the following fields: > 1) Status (it will hold values like "Open", "Closed", "Submitted"... etc...) > 2) Closed (boolean field which contains 1 or 0) > > If i enter a query like:  Select * from Issues where Status != "Closed"  i > get all recor

Re: [sqlite] .import on a .csv file

2009-10-22 Thread Simon Davies
2009/10/22 Scott Baker : > I'm trying to .import a CSV file and I can't quite figure out the syntax. > > I created a table, and then did: > > .separator , > .import /tmp/foo.csv mytable > > This works sort of, unless my data has , in it. Something like "last, > first". Because it tries to split at

Re: [sqlite] A constraint bug?

2009-10-31 Thread Simon Davies
2009/10/31 Mick : > This is more FYI than needing it (as I have already worked around it), but I > have discovered that an IGNORE constraint on an insert, when one of the > fields in the constraint is NULL, will insert a duplicate record into the > database. > > i.e. > > CREATE TABLE mytable ( > ID

Re: [sqlite] 3.6.20 NATURAL self-join still not fixed

2009-11-07 Thread Simon Davies
2009/11/7 Kristoffer Danielsson : > > Using SQLite 3.6.20 (SQLITE_ENABLE_STAT2=1). > > PRAGMA foreign_keys=OFF; > > BEGIN TRANSACTION; > > CREATE TABLE Test > ( >  TestID INTEGER PRIMARY KEY, >  T1 INTEGER NOT NULL, >  T2 INTEGER NOT NULL, >  T3 INTEGER NOT NULL, >  T4 INTEGER NOT NULL, >  T5 INTEG

Re: [sqlite] execute or prepare+step+finalize

2009-11-11 Thread Simon Davies
2009/11/11 T : > > i think i understand why it doesnt work for select *.. > > because sqlite_step executes one row at time.. so after i prepare SELECT * , > i need to use sqlite_step as many times as table i`m selecting from has rows > (in this case 3 times).. > so i made another function that

Re: [sqlite] execute or prepare+step+finalize

2009-11-11 Thread Simon Davies
2009/11/11 T : > . . . > >> and finaly i get SQLITE_DONE but it still doesnt show me table i have >> selected... > > See http://www.sqlite.org/c3ref/column_blob.html > > > i dont understand what exactly do you mean.. > > combination of these: > > sqlite3_value *sqlite3_column_value(sqlite3_stmt

Re: [sqlite] sqlite3_free()

2009-11-11 Thread Simon Davies
2009/11/11 T : > > is this right way how to do it: > > sqlite_free (errmsg); > > ??? > > > or this: > > > sqlite3_free (NULL); >From http://www.sqlite.org/c3ref/free.html: "The sqlite3_free() routine is a no-op if is called with a NULL pointer." > > or how should i do it? Rgds, Simon ___

Re: [sqlite] execute or prepare+step+finalize

2009-11-11 Thread Simon Davies
2009/11/11 T : > > i`ve done it, and i think i understand it :) > > thank you.. > > > few more question to be sure that i`m not missing something important.. > > if i use prepared statements only (dont use exec function in program at all) > i dont need callback function, do i? No >  somehow a

Re: [sqlite] New sqlite bug report: Problem with /* */ comment followed by Non-SQL (sqlite-specific) command

2009-11-20 Thread Simon Davies
2009/11/20 Norbert : > Hi, > > I use SQLite 3.6.16 on Ubuntu Linux Karmic Koala, installation via > normal Ubuntu repository. At home (Linux) and also in the office > (Windows XP), I encountered the following problem. > > Source of test.sql: > > *BEGIN OF SOURCECODE  (next line is line

Re: [sqlite] INSERT OR IGNORE and sqlite3_last_insert_rowid()

2007-10-29 Thread Simon Davies
Hi All, Following this thread, I was experimenting with last_insert_rowid(), and found the following, which does not look right: SQLite version 3.4.2 Enter ".help" for instructions sqlite> sqlite> create table tmp( a integer, b integer ); sqlite> create unique index tmpIndex on tmp( a, b ); sqlit

Re: [sqlite] INSERT OR IGNORE and sqlite3_last_insert_rowid()

2007-10-29 Thread Simon Davies
Thanks for the explanation! On 29/10/2007, Dennis Cote <[EMAIL PROTECTED]> wrote: > Simon Davies wrote: > > Following this thread, I was experimenting with last_insert_rowid(), > > and found the following, which does not look right: > > > > SQLite version 3.4.2 &

Re: [sqlite] INSERT OR IGNORE and sqlite3_last_insert_rowid()

2007-10-29 Thread Simon Davies
On 29/10/2007, Odekirk, Shawn <[EMAIL PROTECTED]> wrote: > Adding "primary key" to column "a" results in the behavior I think you > were first expecting. > > sqlite> create table tmp (a integer primary key, b integer); > sqlite> create unique index tmpIndex on tmp (a, b); > sqlite> insert into tmp

Re: [sqlite] A beginner SQL question

2007-11-05 Thread Simon Davies
On 05/11/2007, A.J.Millan <[EMAIL PROTECTED]> wrote: > I All: > > Suppose a table: > > CREATE TABLE 'myTable' ( > A INTEGER NOT NULL, > B INTEGER NOT NULL, > C INTEGER); > > Do is there some query to return if there are some duplicate files and/or > who are they? > > Consider duplicate file if ther

Re: [sqlite] Re: A beginner SQL question

2007-11-05 Thread Simon Davies
On 05/11/2007, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Simon Davies > wrote: > > I use: > > > > select rowid, A, B, C > > from t > > where A||B||C in > > ( select A||B||C > > from t > > group by A, B, C > > having count(*)>1

Re: [sqlite] Re: Re: INSERT: how to include CR & LF symbols in a string constant?

2007-11-14 Thread Simon Davies
On 14/11/2007, Jevgenijs Rogovs <[EMAIL PROTECTED]> wrote: > Sounds too complicated for this simple situation... > Can anything be done w/o coding? > Why not change INSERT INTO sometable VALUES ('blablabla\r\nyadayadayada'); into INSERT INTO sometable VALUES ('blablabla yadayadayada'); (real r

Re: [sqlite] rollback fails incomprehencibly

2007-11-23 Thread Simon Davies
Hi, Statements will be in progress until you issue an sqlite_reset or sqlite_finalize on them. I don't know why rollback doesn't take care of this; perhaps someone will explain, Rgds, Simon On 23/11/2007, ??? <[EMAIL PROTECTED]> wrote: > Hi all... > > Explain me something please. C

Re: [sqlite] db crash when creating rows

2007-11-28 Thread Simon Davies
Hi Ged, Compiled your snippet using VS2005 on XP, sqlite 3.4.2 - ran to completion with no errors Rgds, Simon PS Took nrly 2 hrs. Added "BEGIN" and "COMMIT" around insert loop, reduced time to 10 seconds On 27/11/2007, Ged Murphy <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I am doing some pr

Re: [sqlite] Doubtful code in os_unix.c

2007-11-29 Thread Simon Davies
See http://www.nabble.com/SQLite-3.5.2---Unix---Memory-issue--tf4851124.html Rgds, Simon On 29/11/2007, Alexandre Balaban <[EMAIL PROTECTED]> wrote: > Hello, > > did someone recently tested the unix code with the locking > style enabled ? > I ask because I saw dubious code in this file, specifica

Re: [sqlite] Querying DATE column with date/time string.

2007-12-06 Thread Simon Davies
Hi Doug, I'm guessing that you expect your inserted values to be treated as a date. BUT sqlite> create table foo( d date null ); sqlite> insert into foo(d) values( '2008-01-01' ); sqlite> select d, typeof(d) from foo; 2008-01-01|text http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions may

Re: [sqlite] Seg fault after calling sqlite3_exec while running under cygwin

2007-12-11 Thread Simon Davies
Hi John, initdb() does not modify the db handle in main(). Call should be: err_c = initdb(&db); and initdb prototype should be int initdb(sqlite3** db) etc... Rgds, Simon On 11/12/2007, John Williams <[EMAIL PROTECTED]> wrote: > I forgot to attach my sample code to my previous mess

Re: [sqlite]:Using sqlite3_progress_handler for GUI application

2007-12-18 Thread Simon Davies
Prob shd be http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor On 18/12/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > "Sreedhar.a" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Say,I am having 4 entries in the table ALBUM. > > > > "CREATE TABLE ALBUM (AlbumtId INTEGER PRIMARY KEY NOT NU

Re: [sqlite] Variable substitution (TCL & SQLite)

2008-01-18 Thread Simon Davies
On 18/01/2008, Zbigniew Baniewski <[EMAIL PROTECTED]> wrote: > ...and now the contents of $columns (SQL variable) in the statement above, > has been replaced with the contents of $columns (TCL variable) - because the > variable names are "compatible". So - that was my assumption - we've got now: >

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Simon Davies
Hi Piotr, Looks fine to me. Isn't 123 the max weight for those rows with name 'C'? Rgds, Simon On 04/02/2008, Piotr Budny <[EMAIL PROTECTED]> wrote: > Hello, > I've got strange behaviour, I want to select row ID of MAX(something) row for > group: > > CREATE TABLE "test" ( "id" INTEGER , "name" C

Re: [sqlite] The best way to handle dynamic table creation

2008-02-21 Thread Simon Davies
See "IF NOT EXISTS" in http://www.sqlite.org/lang_createtable.html Rgds, Simon On 21/02/2008, Neville Franks <[EMAIL PROTECTED]> wrote: > I need to create tables on the fly which will persist across sessions. > These tables may or may not already exist. > > Calling sqlite3_exec( "create table ...

Re: [sqlite] FW: Query to Find number of distinct records

2008-02-27 Thread Simon Davies
Hi Bharath, Works for me in 3.4.2 SQLite version 3.4.2 Enter ".help" for instructions sqlite> create table tst( nun integer, nm text ); sqlite> insert into tst values( 23, 'A' ); sqlite> insert into tst values( 23, 'b' ); sqlite> insert into tst values( 24, 'C' ); sqlite> insert into tst values(

Re: [sqlite] Prepare Statement

2008-02-28 Thread Simon Davies
You need a placeholder in the SQL in order to bind a value. The following is untested but shows the sort of approach... Unsigned char u8_ClassificationCode=1; Unsigned short u16_Input=0x0061; if ( sqlite3_prepare( gpst_SqliteInstance, "SELECT id, Name FROM MUSIC WHERE Name >= '?'

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Simon Davies
Alexander, >From http://www.sqlite.org/c3ref/busy_handler.html "The presence of a busy handler does not guarantee that it will be invoked when there is lock contention. If SQLite determines that invoking the busy handler could result in a deadlock, it will go ahead and return SQLITE_BUSY or SQLIT

Re: [sqlite] Insert date

2008-04-25 Thread Simon Davies
2008/4/25 lrjanzen <[EMAIL PROTECTED]>: > > I have the following table ... > and the following insert > INSERT INTO Sighting (SpeciesID,LocationID,SightingDate,Note) > VALUES (3005,22,'2/26/2008','New Note') > > the insert works EXCEPT the date keeps coming in as NULL! What am I doing > wrong? > >

Re: [sqlite] Speed-Lost on using expression with combined "AND" and "OR"!

2008-06-04 Thread Simon Davies
Hi Markus, http://www.sqlite.org/optoverview.html may help... >From earlier performance discussions, ORs can prevent indices being used - do your tables have indices? Try "EXPLAIN QUERY PLAN " preceding your SELECTs to determine whether indices are being used. Rgds, Simon 2008/6/4 Markus Wolte

Re: [sqlite] SQL question

2008-06-06 Thread Simon Davies
Andrea, This appears to do what you want... SQLite version 3.4.2 Enter ".help" for instructions sqlite> sqlite> create table tst( name text, score integer, info text ); sqlite> insert into tst values( 'A', 289, 'A1' ); sqlite> insert into tst values( 'C', 29, 'C1' ); sqlite> insert into tst value

Re: [sqlite] Extracting distinct category and subcategory pairs

2008-06-09 Thread Simon Davies
Hi Gary, Does SELECT DISTINCT category, subcategory from documents; not provide what you want? If not you may need to be more specific. Rgds, Simon ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/s

Re: [sqlite] sqlite3 command line usage

2008-06-13 Thread Simon Davies
Hi John, I don't think that the first command can combine meta-commands with SQL statements. But redirect stdin: C:\> copy con tst.cmd create table if not exists tst( c1 integer ); insert into tst values( 0 ); insert into tst values( 1 ); insert into tst values( 2 ); .mode line select c1 from ts

Re: [sqlite] sqlite3 command line usage

2008-06-13 Thread Simon Davies
Or in similar vein if you wish the shell to remain running: C:\> sqlite3 tst.db ".read tst.cmd" 2008/6/13 Simon Davies <[EMAIL PROTECTED]>: > Hi John, > > I don't think that the first command can combine meta-commands with > SQL statements. > > But

Re: [sqlite] Question of reusable rowid

2008-06-13 Thread Simon Davies
http://www.sqlite.org/autoinc.html Rgds, Simon 2008/6/13 Kang Kai <[EMAIL PROTECTED]>: > Hi, > > In an application I use the default 'rowid' column as identifier of objects > stored in table. > > I found that if I delete the record that has the maximal rowid, the rowid > will be reused when I i

Re: [sqlite] table sqlite_extensions

2008-06-13 Thread Simon Davies
It appears that any table beginning "sqlite_" provokes "SQL error: object name reserved for internal use: sqlite_?" where ? is the text following "sqlite_" The articles you have referenced appear to be discussions of possible future enhancements. Rgds, Simon 2008/6/13 Alexey Pechnikov <[EMAIL PR

Re: [sqlite] Case-insensitive Glob?

2008-06-20 Thread Simon Davies
Hi Gilles, 'like' is case-insensitive. so: select * from customers where city like "%ville%"; would match "villes" or "VilleS". Rgds, Simon 2008/6/20 Gilles Ganault <[EMAIL PROTECTED]>: > Hello > > Is there a way for glob to be case-insensitive? I'd like to retrieve > all rows where the city

  1   2   3   4   >