Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread Dan
On Mar 11, 2008, at 7:36 AM, [EMAIL PROTECTED] wrote: > > > I'm trying to get the concat operator to work with my user-defined > function. This works fine: > > SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM Employees > > But this doesn't work: > > SELECT FORMAT_DATE(login_time)

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread brettg
Yes, this works fine.  I get three columns: login date, empty column, login time Quoting Stephen Oberholtzer : > On Mon, Mar 10, 2008 at 7:36 PM,  wrote: >> >> >>    I'm trying to get the concat operator to work with my user-defined >>   function.  This works fine: >> >>    SELECT

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread brettg
Here is what the code does.  I set up the UDF after I open a file, like this:       � sqlite3_create_function( pDb, "format_time", -1, SQLITE_UTF16, 0, format_time, 0, 0 ); The format_time function formats the time according to a template and calls sqlite3_result_text16, like this:      

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread brettg
Thanks Tom.  Yes, I have tried that.  The function definitely returns a valid string. Quoting BareFeet : > Hi Brett, > >>   I'm trying to get the concat operator to work with my user-defined >> function.  This works fine: >> >>   SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM 

[sqlite] [TSV) mode vs. separator?

2008-03-10 Thread Gilles Ganault
Hello I'd like to save the output of SELECT into a tab-delimited text file, and noticed that there are two commands that seem to do the same thing: sqlite> .mode tabs sqlite> .separator \t sqlite> .output myfile.tsv sqlite> select * from mytable; sqlite> .exit What's the difference

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread Stephen Oberholtzer
On Mon, Mar 10, 2008 at 7:36 PM, <[EMAIL PROTECTED]> wrote: > > > I'm trying to get the concat operator to work with my user-defined > function. This works fine: > > SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM Employees > > But this doesn't work: > > SELECT

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread BareFeet
Hi Brett, > I'm trying to get the concat operator to work with my user-defined > function. This works fine: > > SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM Employees > > But this doesn't work: > > SELECT FORMAT_DATE(login_time) || ' ' || FORMAT_TIME(login_time) > FROM

Re: [sqlite] Basic system setup for tracing?

2008-03-10 Thread Neville Franks
Tuesday, March 11, 2008, 11:10:03 AM, you wrote: ss>> I am trying to setup a very basic system for just tracing the sqlite ss> code, ss>> but I didn't have any luck. ss>> Code::Blocks compiles everything, but when it comes to tracing, it ss> traces ss>> even through comments. ss>> Eclipse CDT

Re: [sqlite] Can't get concat operator to work

2008-03-10 Thread John Stanton
The problem appears to be in your function. Post the code for it. [EMAIL PROTECTED] wrote: > > I'm trying to get the concat operator to work with my user-defined > function. This works fine: > > SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM Employees > > But this doesn't

Re: [sqlite] Does an sqlite3_get_table() results set get updated.

2008-03-10 Thread John Stanton
Neville Franks wrote: > Hi John, > > Tuesday, March 11, 2008, 10:18:30 AM, you wrote: > > JS> Neville Franks wrote: > >>>Tuesday, March 11, 2008, 8:48:05 AM, you wrote: >>> >>>JAK> On Tue, Mar 11, 2008 at 08:37:27AM +1100, Neville Franks scratched on >>>the wall: >>> >>> >If I use

Re: [sqlite] Basic system setup for tracing?

2008-03-10 Thread drh
"software.simian" <[EMAIL PROTECTED]> wrote: > > Just step-in; I'm studying the sqlite code and it would be easier if I could > see the internal in action. > * Compile with -DSQLITE_DEBUG=1 * PRAGMA vdbe_trace=ON; * PRAGMA vdbe_listing=ON; -- D. Richard Hipp <[EMAIL PROTECTED]>

[sqlite] Can't get concat operator to work

2008-03-10 Thread brettg
I'm trying to get the concat operator to work with my user-defined function.  This works fine: SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM  Employees But this doesn't work: SELECT FORMAT_DATE(login_time) || ' ' || FORMAT_TIME(login_time) FROM  Sessions I get only the

Re: [sqlite] Basic system setup for tracing?

2008-03-10 Thread software.simian
ss> I am trying to setup a very basic system for just tracing the sqlite code, ss> but I didn't have any luck. ss> Code::Blocks compiles everything, but when it comes to tracing, it traces ss> even through comments. ss> Eclipse CDT includes the sqlite3.h, and accepts the *sqlite3 pointer, but

Re: [sqlite] Does an sqlite3_get_table() results set get updated.

2008-03-10 Thread Neville Franks
Hi John, Tuesday, March 11, 2008, 10:18:30 AM, you wrote: JS> Neville Franks wrote: >> Tuesday, March 11, 2008, 8:48:05 AM, you wrote: >> >> JAK> On Tue, Mar 11, 2008 at 08:37:27AM +1100, Neville Franks scratched on >> the wall: >> If I use sqlite3_get_table() and update/insert/delete one

Re: [sqlite] Update fail without ERRORS

2008-03-10 Thread [EMAIL PROTECTED]
SOLVED! Thanks to all and expecially to Dennis I've found MY MISTAKE!!! :-) My head is safe ;-) The error was in my_custom_function. Inside this function I need to query the same table to retrieve some values needed to calculate the float value. Inside my_custom_function I use the

Re: [sqlite] Does an sqlite3_get_table() results set get updated.

2008-03-10 Thread John Stanton
Neville Franks wrote: > Tuesday, March 11, 2008, 8:48:05 AM, you wrote: > > JAK> On Tue, Mar 11, 2008 at 08:37:27AM +1100, Neville Franks scratched on > the wall: > >>>If I use sqlite3_get_table() and update/insert/delete one of the tables >>>in the original query, does the results set get

Re: [sqlite] Basic system setup for tracing?

2008-03-10 Thread Neville Franks
Tuesday, March 11, 2008, 9:42:37 AM, you wrote: ss> I am trying to setup a very basic system for just tracing the sqlite code, ss> but I didn't have any luck. ss> Code::Blocks compiles everything, but when it comes to tracing, it traces ss> even through comments. ss> Eclipse CDT includes the

Re: [sqlite] Update fail without ERRORS

2008-03-10 Thread Dennis Cote
[EMAIL PROTECTED] wrote: > I've found what's matter, but I don't understand why ? Can you add the following line to dump the SQL string just before you call sqlite3_exec()? printf("%s\n", zSQL); Now run the program with and without the commented assignment and report the two strings back

[sqlite] Basic system setup for tracing?

2008-03-10 Thread software.simian
I am trying to setup a very basic system for just tracing the sqlite code, but I didn't have any luck. Code::Blocks compiles everything, but when it comes to tracing, it traces even through comments. Eclipse CDT includes the sqlite3.h, and accepts the *sqlite3 pointer, but doesn't accept the

Re: [sqlite] Update fail without ERRORS

2008-03-10 Thread Dennis Cote
[EMAIL PROTECTED] wrote: > > I don't know where I must crash my head :-( > It looks like the database is fine. Are you certain that you are using the same database file from the command line and in your program? Your program uses the file test.db in the current directory when it runs (unless

Re: [sqlite] Update fail without ERRORS

2008-03-10 Thread [EMAIL PROTECTED]
I've found what's matter, but I don't understand why ? I've tried to use the sqlite3_mprintf() to prepare my sql. If my numeric fValue is integer the SQL works fine, but if I've got a floating value the sql doesn't update the table. And the bad is that I can get any error I'll try to

Re: [sqlite] Does an sqlite3_get_table() results set get updated.

2008-03-10 Thread Jay A. Kreibich
On Tue, Mar 11, 2008 at 08:37:27AM +1100, Neville Franks scratched on the wall: > If I use sqlite3_get_table() and update/insert/delete one of the tables > in the original query, does the results set get updated. ie. If I > iterate through the original results from sqlite3_get_table() will I > see

[sqlite] Does an sqlite3_get_table() results set get updated.

2008-03-10 Thread Neville Franks
If I use sqlite3_get_table() and update/insert/delete one of the tables in the original query, does the results set get updated. ie. If I iterate through the original results from sqlite3_get_table() will I see the changes, or do I need to run the sqlite3_get_table() query anew? If I do see the

Re: [sqlite] Update fail without ERRORS

2008-03-10 Thread [EMAIL PROTECTED]
>The code looks OK except for the typo (i.e. sPre[2048[ should be > sPre[2048]). Yes, It's a mistype on the mailinglist, the code it's ok! > I assume that your real table isn't named "table" since that is a keyword. The real table name is "inputai" > Can you open the database file using the

Re: [sqlite] retrieve last unique value written

2008-03-10 Thread Igor Tandetnik
David McDivitt <[EMAIL PROTECTED]> wrote: > Is there a function that will return the most recent unique value > created on the database connection similar to DB2 or NS SQL Server? sqlite3_last_insert_rowid Igor Tandetnik ___ sqlite-users mailing

Re: [sqlite] ORDER BY

2008-03-10 Thread Igor Tandetnik
David McDivitt <[EMAIL PROTECTED]> wrote: > The database I'm reading has not been set up to collate without case. > What functions are available? Is there a ucase or lcase such as: > >ORDER BY UCASE(LastName) order by LastName collate NOCASE; Igor Tandetnik

[sqlite] retrieve last unique value written

2008-03-10 Thread David McDivitt
When adding a row to a table the ROWID may or may not be the highest value of the table. This can be found with MAX(ROWID) if it is the last. Two problems: what if not last, what if more than one thread. Is there a function that will return the most recent unique value created on the database

[sqlite] ORDER BY

2008-03-10 Thread David McDivitt
The database I'm reading has not been set up to collate without case. What functions are available? Is there a ucase or lcase such as: ORDER BY UCASE(LastName) Thanks ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread John Elrick
Brad Stiles wrote: > > >>> I wanted to know the algorithm used by sqlite to generate the new >>> rowid. Assume there can be N distinct rowid's possible, now insert N >>> records, followed by random deletion of some records. Now what rowid >>> will be assigned to a new row that is added?

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread Brad Stiles
> > I wanted to know the algorithm used by sqlite to generate the new > > rowid. Assume there can be N distinct rowid's possible, now insert N > > records, followed by random deletion of some records. Now what rowid > > will be assigned to a new row that is added? >

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread Igor Tandetnik
Scott Baker <[EMAIL PROTECTED]> wrote: > If a large amount of records are DELETED and > then a VACUUM is run do the rowids change? http://www.sqlite.org/lang_vacuum.html "The VACUUM command may change the ROWID of entires in tables that do not have an explicit INTEGER PRIMARY KEY." Igor

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread Scott Baker
Igor Tandetnik wrote: > B V, Phanisekhar <[EMAIL PROTECTED]> wrote: >> I wanted to know the algorithm used by sqlite to generate the new >> rowid. Assume there can be N distinct rowid's possible, now insert N >> records, followed by random deletion of some records. Now what rowid >> will be

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread Igor Tandetnik
B V, Phanisekhar <[EMAIL PROTECTED]> wrote: > I wanted to know the algorithm used by sqlite to generate the new > rowid. Assume there can be N distinct rowid's possible, now insert N > records, followed by random deletion of some records. Now what rowid > will be assigned to a new row that is

Re: [sqlite] Database Journal File

2008-03-10 Thread Ken
The journal file is created when you begin a transaction and has nothing to do with in memory. (memory db's do not have journal files). When your application commits the journal file is delete! This is the atomicity part of ACID. Verify upon exit that you are performing a commit. If your not

Re: [sqlite] Generating new rowid algo

2008-03-10 Thread Jay A. Kreibich
On Mon, Mar 10, 2008 at 11:35:23PM +0530, B V, Phanisekhar scratched on the wall: > All, > > I wanted to know the algorithm used by sqlite to generate the new > rowid. Assume there can be N distinct rowid's possible, now insert N > records, followed by random deletion of some records. Now

[sqlite] Generating new rowid algo

2008-03-10 Thread B V, Phanisekhar
All, I wanted to know the algorithm used by sqlite to generate the new rowid. Assume there can be N distinct rowid's possible, now insert N records, followed by random deletion of some records. Now what rowid will be assigned to a new row that is added? Regards, Phanisekhar

[sqlite] Database Journal File

2008-03-10 Thread Ovidiu Anghelidi
Hi there, I have a small issue and I was hoping that someone might be able to point me in the right direction. I am trying to build a C/C++ application using the amalgamation version without having the file.db-journal created. I am using version 3.5.3. My understanding is that in order to do

Re: [sqlite] rowid value

2008-03-10 Thread David McDivitt
Thanks Igor. That solved my problem. >From: [EMAIL PROTECTED] >To: >Date: 3/10/2008 11:53:47 AM > >http://sqlite.org/lang_createtable.html >Search this page for ROWID. >Igor tandetnik ___ sqlite-users mailing list

[sqlite] rowid value

2008-03-10 Thread David McDivitt
I just began using SQLite. I have an iPhone and want to write a Windows application to edit the database. After finding the database to be SQLite and researching SQLite, I made a good start at the application. I really like SQLite! It's the first alternative I've seen to Microsoft Jet, which is

Re: [sqlite] SQLite and (high) concurrency

2008-03-10 Thread John Stanton
If your synchronization logic is sound Sqlite will not ignore inserts. Tore Austraatt wrote: > I find sqlite3 as the perfect choice for our embedded application - if it > hasn't been for the > issues concering concurrency. > My questions are; > 1. is the "default behaviour" from sqlite3 to

Re: [sqlite] SQLite and (high) concurrency

2008-03-10 Thread Ken
1. Inserts are not ignored. You can ignore inserts in your app if the db is busy/locked etc.. 2. Test the return code for success/failure. Tore Austraatt <[EMAIL PROTECTED]> wrote: I find sqlite3 as the perfect choice for our embedded application - if it hasn't been for the issues concering

Re: [sqlite] Two Phase commit using sqlite

2008-03-10 Thread Ken
Hello Shailesh, Seems like you may be trying to put a square peg into a round hole. Sqlite is an embedded database. Meaning it is not "distributed" as such unless you build the distribution and 2 phase commit logic yourself. Let me just clarify for a moment, by distributed you mean. a. 2

[sqlite] SQLite and (high) concurrency

2008-03-10 Thread Tore Austraatt
I find sqlite3 as the perfect choice for our embedded application - if it hasn't been for the issues concering concurrency. My questions are; 1. is the "default behaviour" from sqlite3 to simply ignore inserts if the concurrency gets to high? 2. is there anything (C API) I can do to at

Re: [sqlite] newB question; c++ and sqlite3; how2 check if word exist in the table

2008-03-10 Thread Dennis Cote
vl.pavlov wrote: > > i wander how to do this query: > > insert into tablename values ('word') > but if does not exist the same word in other table > I'm not sure if this is what you are asking, but you can try this: insert into tablename select :word where not exists (select word from

Re: [sqlite] "sqlite3.h: No such file or directory" error when installing software on Linux

2008-03-10 Thread Dan
On Mar 10, 2008, at 6:44 PM, thomas Armstrong wrote: > Hi. > > I've just installed 'sqlite' (version 2.8.16) and 'sqlite-devel' > (version 2.8.16) from RPMs on my Linux Fedora Core, but I get this > error message when installing a software: Looks like you need to install version 3. Dan. > >

[sqlite] "sqlite3.h: No such file or directory" error when installing software on Linux

2008-03-10 Thread thomas Armstrong
Hi. I've just installed 'sqlite' (version 2.8.16) and 'sqlite-devel' (version 2.8.16) from RPMs on my Linux Fedora Core, but I get this error message when installing a software: -- - gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../include -I../../../include/sandesha2 -I.

Re: [sqlite] newB question; c++ and sqlite3; how2 check if word exist in the table

2008-03-10 Thread vl.pavlov
hello once more i wander how to do this query: insert into tablename values ('word') but if does not exist the same word in other table i suppose that with combination of your answers to this and my other post solution can be created, but i do not know how exactly :) thanx vl.pavlov

Re: [sqlite] Beginners bad luck

2008-03-10 Thread Aharon (Rony) Shapira
The problem was solved by Shibu Narayanan that gave me a link to older versions of sqlite. Thanks to you all for the effort. I guess that beginners do have good luck after all. Aharon - Original Message - From: "Robert L Cochran" <[EMAIL PROTECTED]> To: "General Discussion of SQLite