Re: [sqlite] Easy question concerning C++ & sqlite3

2008-02-28 Thread vl.pavlov
your code worked perfectly, thx once more! vl.pavlov wrote: > > thank u very much, > > i'll try :) > > > > Dennis Cote wrote: >> >> vl.pavlov wrote: >>> hello & thanks 4 reply >>> >>> ok, i think i understand, >>> i would like that you, if not prob., write the whole solution once with

[sqlite] Prepare Statement

2008-02-28 Thread Mahalakshmi.m
Hi, My table looks like: IdName 1 1aaa 2 01345 3 1asdf I want the statement to be like: "SELECT id, Name FROM MUSIC WHERE Name >= '1a' LIMIT 1;" But using prepare I could not able to get the desired

Re: [sqlite] Keeping ROWID for INSERT OR REPLACE

2008-02-28 Thread Dennis Cote
Neville Franks wrote: > I want to insert a row if its key clm doesn't exist otherwise update > it. I can search for the row and then do either an insert or update > accordingly. However I was wondering whether the SQLite Conflict > Resolution: INSERT OR REPLACE would be more efficient (faster).

[sqlite] FTS3 and 5.5.6 Amalgamation

2008-02-28 Thread John Elrick
I've poked around the SQLite website and found nothing really definitive so I am asking here. At one point, the FTS3 extension was listed on the download page, however, it is not any longer. Based on a few Google hits, I attempted an experiment to see if it was included in the amalgamation.

Re: [sqlite] Question on Blobs

2008-02-28 Thread Dennis Cote
Fred J. Stephens wrote: > For instance, how can I store a file in a table? > Not read the file and store the text, but the binary file itself? Fred, You can't do anything with the contents of a file until you read in into memory. To store a 1MB file in a database you need to decide if you will

Re: [sqlite] IF...THEN constructs

2008-02-28 Thread John Stanton
Sqlite does not have a built in procedural language like PL/SQL. For certain applications we just added Javascript to cover that requirement. It was straightforward using Spidermonkey and had the advantage of being the same language used by the AJAX applications backended by Sqlite so

Re: [sqlite] Question on Blobs

2008-02-28 Thread John Stanton
Rather than doing malloc you can mmap the file and then copy it into the blob. Peter A. Friend wrote: > On Feb 27, 2008, at 4:48 PM, Mike McGonagle wrote: > >> Hello all, >> I was hoping that someone might share some tips on working with >> Blobs? I >> would like to be able to store some

Re: [sqlite] Question on Blobs

2008-02-28 Thread Peter A. Friend
On Feb 27, 2008, at 7:35 PM, Mike McGonagle wrote: > Wow, Peter, didn't expect that anyone would go to the trouble of > writing a > program on the spot I didn't. :-) That was just a snippet of something I wrote for myself when I first started playing with SQLite. > Just curious, but

Re: [sqlite] Question on Blobs

2008-02-28 Thread John Stanton
Just get a pointer to the data in the file and the number of bytes and use the sqlite API call to transfer it into the DB. You can get the pointer by either reading the file into local memory or by mmap'ing it. Also look at the API calls which let you process a blob in chunks. A BLOB is

Re: [sqlite] Prepare Statement

2008-02-28 Thread John Stanton
You misunderstand binding. You use it like this - sql - "SELECT name FROM customers WHERE cust_id = ?"; this_cust_id - "CUST1275"; sqlite3_prepare_v2(...); sqlite3)bind_text(..., 1, this_cust_id, ...); You bind a value to the data represented by the ?. Then you reuse the

Re: [sqlite] FTS3 and 5.5.6 Amalgamation

2008-02-28 Thread P Kishor
On 2/28/08, John Elrick <[EMAIL PROTECTED]> wrote: > I've poked around the SQLite website and found nothing really definitive > so I am asking here. > > > At one point, the FTS3 extension was listed on the download page, > however, it is not any longer. Based on a few Google hits, I attempted

Re: [sqlite] Prepare Statement

2008-02-28 Thread Steven Fisher
On 28-Feb-2008, at 6:22 AM, Mahalakshmi.m wrote: > if ( sqlite3_prepare(gpst_SqliteInstance,"SELECT id, Name FROM MUSIC > WHERE > Name >= '%d%c' LIMIT 1;",-1,_SearchPrepareStmt,0)!= SQLITE_OK) That's not what a bind point looks like. Take a look here:

Re: [sqlite] How long time to index this table

2008-02-28 Thread Lars Aronsson
Gilles Ganault wrote: > But then, how many people use SQLite to handle 68 milions rows > in a table? That's a good question. I don't know. And I don't know if there is a recommended size for SQLite databases. But I was able to create the index in 12 minutes after I set the right

Re: [sqlite] Prepare Statement

2008-02-28 Thread Igor Tandetnik
Simon Davies <[EMAIL PROTECTED]> wrote: > You need a placeholder in the SQL in order to bind a value. > > "SELECT id, Name FROM MUSIC WHERE Name >= '?' LIMIT 1;", '?' is a string literal consisting of a single question mark character - _not_ a parameter placeholder. You want ? without quotes.

Re: [sqlite] How long time to index this table

2008-02-28 Thread Derrell Lipman
On Thu, Feb 28, 2008 at 11:48 AM, Lars Aronsson <[EMAIL PROTECTED]> wrote: > Gilles Ganault wrote: > > > But then, how many people use SQLite to handle 68 milions rows > > in a table? I've got 60 million in one table, and this is with an sqlite2 database. Works just fine, BTW. Derrell

[sqlite] How to recover from database corruption? (and why does it happen?)

2008-02-28 Thread Luca Olivetti
[resending, with small clarification edits, since I didn't see it, probably because I wasn't yet subscribed, I hope it won't appear twice] Hello, I'm using sqlite 3.3.8 under linux (mandriva 2007.1). Maybe it's something that's not advisable (I don't know) but in my program I have various

Re: [sqlite] Prepare Statement

2008-02-28 Thread Stephen Oberholtzer
On Thu, Feb 28, 2008 at 9:22 AM, Mahalakshmi.m <[EMAIL PROTECTED]> wrote: > > > Hi, > My table looks like: > IdName > 1 1aaa > 2 01345 > 3 1asdf > > I want to bind unsigned short as text. i.e, If the Unsighed short

[sqlite] DATETIME data type

2008-02-28 Thread Yong Zhao
It seems that sqlite3 does not support DATETIME data type. If I have the following data in table t1, how do I select people who is older than certain date? create table t1(dob text, name text); insert into t1('11/12/1930', 'Larry'); insert into t1('2/23/2003', 'Mary'); select * from t1 where

[sqlite] Nested calls to prepare/step/prepare

2008-02-28 Thread Ken
I wanted to find out if the following is allowed in Sqlite. sqlite3_prepare_v2 while ( ) { sqlite3_step sqlite3_prepare_v2 --- I;m getting a segv here. while ( ) { sqlite3_step } } So my questing is, does sqlite allow a prepare to be started while a

Re: [sqlite] DATETIME data type

2008-02-28 Thread Steven Fisher
On 28-Feb-2008, at 1:29 PM, Yong Zhao wrote: > It seems that sqlite3 does not support DATETIME data type. > > If I have the following data in table t1, how do I select people who > is > older than certain date? Use -MM-DD instead of M/D/Y. Available formats described here under Time

[sqlite] Join Syntax Questions

2008-02-28 Thread Mitchell Vincent
I could swear I've done this type of thing before and am sure I'm overlooking something simple. Is this correct syntax? SELECT im.invoice_date as invoice_date,im.pay_by as due_date,im.invoice_id as invoice_id, im.invoice_number as invoice_number,im.invoice_date as created,im.status as status,

Re: [sqlite] DATETIME data type

2008-02-28 Thread John Stanton
Try using the Sqlite date functions. Yong Zhao wrote: > It seems that sqlite3 does not support DATETIME data type. > > If I have the following data in table t1, how do I select people who is > older than certain date? > > create table t1(dob text, name text); > insert into t1('11/12/1930',

Re: [sqlite] DATETIME data type

2008-02-28 Thread Neville Franks
Friday, February 29, 2008, 8:29:16 AM, you wrote: YZ> It seems that sqlite3 does not support DATETIME data type. YZ> If I have the following data in table t1, how do I select people who is YZ> older than certain date? YZ> create table t1(dob text, name text); YZ> insert into t1('11/12/1930',

Re: [sqlite] undefined symbol: sqlite3_prepare_v2

2008-02-28 Thread Joanne Pham
Hi All, The same problem that I had one of linux server and this server didn't have the sqlite3 So I couldn't run command sqlite3 :memory to check for the sqllite version. On this server it has only the sqlite library which is libsqlite3.so.0.8.6. The question is how to check the sqlite version

Re: [sqlite] Question on Blobs

2008-02-28 Thread Fred J. Stephens
Thanks John & Dennis; Looks like I am getting ahead of myself here. I'm just doing a simple PIM app as a BASH script that uses SQLite to store data. Probably I can't do this in a script as you could in C. I find the formating of the text from a file is not saved if I read it and insert it into

Re: [sqlite] DATETIME data type

2008-02-28 Thread Igor Tandetnik
"Yong Zhao" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It seems that sqlite3 does not support DATETIME data type. > > If I have the following data in table t1, how do I select people who > is older than certain date? > > create table t1(dob text, name text); > insert into

Re: [sqlite] Optimization Question for SQLite Experts

2008-02-28 Thread Samuel Neff
Here's two suggestions. First the simple suggestion is instead of this.. for (z=0;z

Re: [sqlite] Optimization Question for SQLite Experts

2008-02-28 Thread Bill KING
You obviously have a set of UID's at the time of the loop, how about creating a huge select .. from where ...IN (list_of_uids_comma_separated)? It'll be one single query (or you can break it down into blocks of 50, or 100, etc). Will save the overhead of generating the queries over and over

Re: [sqlite] DATETIME data type

2008-02-28 Thread Trey Mack
Store it in '-mm-dd' format, or use the julian date that's suggested at: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions Yong Zhao wrote: > It seems that sqlite3 does not support DATETIME data type. > > If I have the following data in table t1, how do I select people who is > older

[sqlite] Optimizing an insert/update

2008-02-28 Thread Michael Miller
I apologize if this is a double-post; I just got approved for the mailing list, and I can't find the older message in the archives, so I'm reposting it. I have a table with two columns, the first with a string and the second with an integer. Given a set of input strings, I want to perform this

Re: [sqlite] Nested calls to prepare/step/prepare

2008-02-28 Thread Dan
On Feb 29, 2008, at 5:21 AM, Ken wrote: > I wanted to find out if the following is allowed in Sqlite. > >sqlite3_prepare_v2 > while ( ) { >sqlite3_step > sqlite3_prepare_v2 --- I;m getting a segv here. > while ( ) { >sqlite3_step > } > } > > > So my