Re: [sqlite] Getting the no of rows using count(*)

2008-01-30 Thread Bharath Booshan L
Hello Kirrthana, > should i use prepare and step in this case and where the result of the query > will be stored on executing my c code. retValue = sqlite3_prepare( dataBaseConnection ,sqlQuery,-1, ,0); if( retValue != SQLITE_BUSY && (retValue = sqlite3_step( ppStmt ) == SQLITE_ROW ) {

[sqlite] Getting the no of rows using count(*)

2008-01-30 Thread kirrthana M
Hi all, Im using the query Select count(*) from table to get the no of rows in the table in my c code. In the command line it will print the no of rows ,but in my c code how can i get the result, should i use prepare and step in this case and where the result of the query will be stored on

Re: [sqlite] CREATE VIEW or CREATE TEMP TABLE

2008-01-30 Thread Alexander Batyrshin
I got better performance when started to use TEMP tables with temp_store = MEMORY. But everything depends on situation. -- Alexander Batyrshin aka bash bash = Biomechanica Artificial Sabotage Humanoid - To unsubscribe,

[sqlite] SQLite website outage & mailing list upgrade, 2008-02-02

2008-01-30 Thread drh
We are going to be upgrading the server that runs the SQLite website this comming Saturday, if all goes according to plan. We are planning to changes the operating system from Debian to Ubuntu and the mailing list manager from ezmlm to GNU mailman. If everything goes as planned, the outage will

Re: [sqlite] Number of columns in table

2008-01-30 Thread Dennis Cote
Andreas Volz wrote: Hello, It's simple to the the maximum number of rows in a table with SELECT count(*) FROM table But how to find out the number of columns for a query like: SELECT * FROM table My practical problem is the read callback function: int readCallback (void *data, int argc,

Re: [sqlite] Adding data to the end of a column

2008-01-30 Thread jose isaias cabrera
"P Kishor" wrote... On 1/30/08, jose isaias cabrera <[EMAIL PROTECTED]> wrote: Punkish, I don't want to replace it. I want to add to the end of field. So, I did not know that I could do, UPDATE table SET field = field && 'data to be added' WHERE id = 55; first, you should use || as

Re: [sqlite] Implementation of TPCC benchmark

2008-01-30 Thread Steve VanDeBogart
On Wed, 30 Jan 2008, Steve VanDeBogart wrote: SQLite-ers, OSDL-DBT is a set of TPC like benchmarks implemented by OSDL (http://osdldbt.sourceforge.net/). I've added SQLite support to the DBT2 benchmark (TPCC like). The patch is attached in case anyone is interested in running a TPCC like

[sqlite] Number of columns in table

2008-01-30 Thread Andreas Volz
Hello, It's simple to the the maximum number of rows in a table with SELECT count(*) FROM table But how to find out the number of columns for a query like: SELECT * FROM table My practical problem is the read callback function: int readCallback (void *data, int argc, char **argv,

[sqlite] Implementation of TPCC benchmark

2008-01-30 Thread Steve VanDeBogart
SQLite-ers, OSDL-DBT is a set of TPC like benchmarks implemented by OSDL (http://osdldbt.sourceforge.net/). I've added SQLite support to the DBT2 benchmark (TPCC like). The patch is attached in case anyone is interested in running a TPCC like benchmark on SQLite. -- Steve

Re: [sqlite] FTS3 Unicode support

2008-01-30 Thread Myk Melez
Scott Hess wrote: The [3] status is ... pending, sorry :-(. But it is more along the lines of adding stuff to ICU rather than adding ICU-less stuff to SQLite, so it sounds like that is not relevant to what you're doing. Hi Scott, Thanks for the info. Indeed, enhancements to ICU don't

Re: [sqlite] How to make correct transaction use only SQL?

2008-01-30 Thread Alexander Batyrshin
Thank you =) This is good idea :) On Jan 30, 2008 2:44 PM, Samuel R. Neff <[EMAIL PROTECTED]> wrote: > > Instead of piping the sql into sqlite3.exe, use the ".read" command instead. > > > C:\Temp\s>sqlite3 test.dat > SQLite version 3.4.2 > Enter ".help" for instructions > sqlite> .read test.sql >

Re: [sqlite] Adding data to the end of a column

2008-01-30 Thread P Kishor
On 1/30/08, jose isaias cabrera <[EMAIL PROTECTED]> wrote: > Punkish, > > I don't want to replace it. I want to add to the end of field. So, I did > not know that I could do, > > UPDATE table SET field = field && 'data to be added' WHERE id = 55; first, you should use || as the string concat

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Dennis Cote
Ken wrote: Maybe your runtime library id different than the source code? Yep, that's it. I used standard 3.5.4 binary of sqlite3.exe for the test, but I was looking at the current CVS source files. I'm sorry if I created any confusion. Dennis Cote

Re: [sqlite] Adding data to the end of a column

2008-01-30 Thread jose isaias cabrera
Punkish, I don't want to replace it. I want to add to the end of field. So, I did not know that I could do, UPDATE table SET field = field && 'data to be added' WHERE id = 55; So, I think this should do it. I will give it a try and get back to the group. thanks all. josé -

Re: [sqlite] Odd issue when SELECT querying

2008-01-30 Thread David Hautbois
Thanks all ! I will receive a C book tomorrow. I need it. David. James Dennett wrote: David Hautbois wrote: Hi I have an odd issue. My function : char * get_config_value (sqlite3 * db, char * config_name) { [...]

RE: [sqlite] Odd issue when SELECT querying

2008-01-30 Thread James Dennett
David Hautbois [mailto:[EMAIL PROTECTED] wrote: > > I found the solution : > I replaced this line : > configvalue = (char *) sqlite3_column_text(stmt, 0); > by > configvalue = g_strdup((gchar *) sqlite3_column_text(stmt, 0)); > > and the configvalue type : gchar > > Now it works !! > > A

Re: [sqlite] Odd issue when SELECT querying

2008-01-30 Thread David Hautbois
I found the solution : I replaced this line : configvalue = (char *) sqlite3_column_text(stmt, 0); by configvalue = g_strdup((gchar *) sqlite3_column_text(stmt, 0)); and the configvalue type : gchar Now it works !! A newbie error... David. David Hautbois wrote: Hi I have an odd issue. My

RE: [sqlite] Odd issue when SELECT querying

2008-01-30 Thread James Dennett
David Hautbois wrote: > Hi > I have an odd issue. > > > My function : > > char * get_config_value (sqlite3 * db, char * config_name) { [...] > configvalue = (char *) sqlite3_column_text(stmt, 0); [...] > return

Re: [sqlite] Adding data to the end of a column

2008-01-30 Thread P Kishor
replace the field with new value. UPDATE table SET field = 'value with more data' WHERE field = 'value' On 1/30/08, jose isaias cabrera <[EMAIL PROTECTED]> wrote: > > Greetings. > > Is there a way to add data to the end of a field? I know I select that > field, import the data into a variable

[sqlite] Re: Adding data to the end of a column

2008-01-30 Thread Igor Tandetnik
jose isaias cabrera <[EMAIL PROTECTED]> wrote: Is there a way to add data to the end of a field? I know I select that field, import the data into a variable and then add whatever to the end. What I am trying to do is exactly NOT that. :-) So, instead, just add say a line or two of text to

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Frank van Vugt
Ken / Dennis, > My version of output_Csv (3.5.4) is missing conditional check. > static void output_csv(struct callback_data *p, const char *z, int bSep){ > FILE *out = p->out; > if( z==0 ){ > fprintf(out,"%s",p->nullvalue); > }else{ > int i; > for(i=0; z[i]; i++){ > if(

Re: [sqlite] Adding data to the end of a column

2008-01-30 Thread Shawn Milochik
-Original Message- From: jose isaias cabrera <[EMAIL PROTECTED]> Reply-To: sqlite-users@sqlite.org To: sqlite-users@sqlite.org Subject: [sqlite] Adding data to the end of a column Date: Wed, 30 Jan 2008 14:34:17 -0500 Greetings. Is there a way to add data to the end of a field? I know

[sqlite] Odd issue when SELECT querying

2008-01-30 Thread David Hautbois
Hi I have an odd issue. My database schema : sqlite> .schema CREATE TABLE config (id INTEGER PRIMARY KEY, config_name TEXT , config_value TEXT); CREATE TABLE waypoints (id INTEGER PRIMARY KEY, wp_date INTEGER, wp_longitude REAL, wp_latitude REAL, wp_speed REAL); The config table content :

[sqlite] Adding data to the end of a column

2008-01-30 Thread jose isaias cabrera
Greetings. Is there a way to add data to the end of a field? I know I select that field, import the data into a variable and then add whatever to the end. What I am trying to do is exactly NOT that. :-) So, instead, just add say a line or two of text to a field. Is this possible?

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Ken
My version of output_Csv (3.5.4) is missing conditional check. static void output_csv(struct callback_data *p, const char *z, int bSep){ FILE *out = p->out; if( z==0 ){ fprintf(out,"%s",p->nullvalue); }else{ int i; for(i=0; z[i]; i++){ if( needCsvQuote[((unsigned

Re: [sqlite] FTS3 Unicode support

2008-01-30 Thread Scott Hess
The [3] status is ... pending, sorry :-(. But it is more along the lines of adding stuff to ICU rather than adding ICU-less stuff to SQLite, so it sounds like that is not relevant to what you're doing. As Dan mentioned, there's stuff in there for supporting alternate tokenizers, including an

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Dennis Cote
Frank van Vugt wrote: I'll look into it tomorrow, but was under the impression that: * when using .mode csv, the separator _always_ is a comma * when one wants a different separator, one has to use .separator ... in combination with .mode list needCsvQuote() is called from output_csv(),

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Frank van Vugt
Dennis, > Your change assumes the separator is always a comma. SQLite does not > make that assumption. I'll look into it tomorrow, but was under the impression that: * when using .mode csv, the separator _always_ is a comma * when one wants a different separator, one has to use .separator ...

Re: [sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Dennis Cote
Frank van Vugt wrote: L.S. Comma seperated files tend to become a bit too seperated when the field data contains the character used for seperation while not being quoted ;) Sqlite 3.5.4 uses shell.c::needsCsvQuote() to determine whether or not to quote the field contents, but it doesn't

RE: [sqlite] How to make correct transaction use only SQL?

2008-01-30 Thread Samuel R. Neff
Instead of piping the sql into sqlite3.exe, use the ".read" command instead. C:\Temp\s>sqlite3 test.dat SQLite version 3.4.2 Enter ".help" for instructions sqlite> .read test.sql SQL error near line 10: column id is not unique SQL error near line 12: cannot commit - no transaction is active

Re: [sqlite] Re: Callback issue - using pointer as argument

2008-01-30 Thread David HAUTBOIS
It works better. Thanks. David. Igor Tandetnik wrote: David Hautbois <[EMAIL PROTECTED]> wrote: char * get_config_value (sqlite3 * db, char * config_name) { TabResult res; rc= sqlite3_exec( db, query, exec_get_config_value_cb , , ); Strings passed to the callback are valid only

[sqlite] csv files with unquoted data containing comma's

2008-01-30 Thread Frank van Vugt
L.S. Comma seperated files tend to become a bit too seperated when the field data contains the character used for seperation while not being quoted ;) Sqlite 3.5.4 uses shell.c::needsCsvQuote() to determine whether or not to quote the field contents, but it doesn't check for the comma..