Re: [sqlite] insert statement using temp variable

2011-04-04 Thread venkat easwar
Hi, Very simple, What will be the output of printf("i"); it won't be 0 right? use snprintf or sprintf and formulate the string then execute the query. int i=0; char * a[100]; snprintf(a,100,"insert into emp values(%d);",i); /or /*sprintf(a,"insert into emp values(%d);",i);*/ rc =

[sqlite] insert statement using temp variable

2011-04-04 Thread RAKESH HEMRAJANI
hi, need help with very basic question.. More of C than SQLite. have a very simple C program using sqlite DB. .. int i=0; rc = sqlite3_exec(db, "create table emp (empid num);", callback, 0, ); rc = sqlite3_exec(db, "insert into emp values(i);", 0, 0, ); ---

Re: [sqlite] Request for an example code use async IO

2011-04-04 Thread Pavel Ivanov
> Can someone be so kind as to provide a short example of initializing > asynchronous module, opening DB for read/write, create a table, and write > some data to it? There's nothing special in opening db, creating table or writing data into it while using async module. You should use the same

[sqlite] Request for an example code use async IO

2011-04-04 Thread Ricky Huang
Hi, I am planning on incorporating the sqlite3async module into my project to improve code responsiveness during disk writes. I've Googled all over for example code on using the module but can't find any. Can someone be so kind as to provide a short example of initializing asynchronous

Re: [sqlite] import thousands of documents in SQLite

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 9:04pm, Gert Van Assche wrote: > We need to import thousands of documents in an SQLite db for use with FTS. > The FTS part I understand (more or less) but I don't know how to import so > many docs in the DB. > Does anyone know a tool to do this? > I won't be the one doing the

[sqlite] import thousands of documents in SQLite

2011-04-04 Thread Gert Van Assche
All, We need to import thousands of documents in an SQLite db for use with FTS. The FTS part I understand (more or less) but I don't know how to import so many docs in the DB. Does anyone know a tool to do this? I won't be the one doing the import, but users that can't work on command line (or we

Re: [sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread Pavel Ivanov
> Basically, the column with name "model" has data type BLOB, and null is > being written to that column. I think your problem is with jdbc driver (I guess its setBytes implemented via the text data type, not blob) and with the fact that writeBuffer[0] is equal to 0. Changing writeBuffer[0] to

Re: [sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread tiwaris
Hello, I created the following sample code to test the BLOB data type. I am using sqlite-jdbc driver provided at (http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC). The following is the source code (SSCE). package org.sqlite; import java.sql.Connection; import java.sql.DriverManager; import

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Nico Williams
On Mon, Apr 4, 2011 at 12:26 PM, Simon Slavin wrote: > But he's combining two INSERTs into one.  What I think he needs is first an > INSERT OR FAIL to possibly add a new person, and then an INSERT ... SELECT > which looks up that person's ID. I didn't see that in the

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 6:01pm, Nico Williams wrote: > On Mon, Apr 4, 2011 at 11:25 AM, Simon Slavin wrote: >> Probably not. Don't try to turn SQL into a procedural language. Do the >> SELECT that tells you whether the record exists and gives you the >> information you need

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Nico Williams
On Mon, Apr 4, 2011 at 11:25 AM, Simon Slavin wrote: > Probably not.  Don't try to turn SQL into a procedural language.  Do the > SELECT that tells you whether the record exists and gives you the information > you need if it does, then do whatever INSERTs you need to do.

Re: [sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread Pavel Ivanov
> I can create the dll, but it does not work with BLOB data type. It works > with other data types. The dll that I downloaded from the sqlite.org website > works with BLOB data type. > > Any help would be appreciated. Any pointers on what doesn't work for you and how it works instead of intended

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 4:26pm, Marcelo Serrano Zanetti wrote: > About the "new" item, yes I do compare some specific fields and not the > primary key. For example name and surname of a person ... I look in the > database for such a person ... if yes I return her id ... if not I > include her and

[sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread tiwaris
Hello, I need build instructions for Windows with unicode support. I am using sqlite3.h and sqlite3.c from the amalgamation source downloaded from http://sqlite.org/sqlite-amalgamation-3070500.zip. I am using the following CFLAGS when compiling sqlite SQLITE_ENABLE_COLUMN_METADATA

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Marcelo Serrano Zanetti
On 04/04/2011 05:16 PM, Robert Poor wrote: > @Marcelo: > > Going back to your original question: do you really only want to > insert one item at a time? If so, I think your question has been > answered reasonably well. > > BUT: if you have a large number of items, and you want to insert items >

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Robert Poor
@Marcelo: Going back to your original question: do you really only want to insert one item at a time? If so, I think your question has been answered reasonably well. BUT: if you have a large number of items, and you want to insert items that aren't yet in the table, then you can do it

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Alexey Pechnikov
2011/4/4 Nico Williams : > You're missing something: FTS4 is a virtual table In triggers code we can't know about virtual tables! So in triggers we may get wrong results?.. As example (this _does not_ work now): CREATE TRIGGER view_job_update instead of update on view_job

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Nico Williams
On Mon, Apr 4, 2011 at 9:10 AM, Enrico Thierbach wrote: > I might have an exceptionally dumb day, but this sequence (from this post > http://www.mail-archive.com/sqlite-users@sqlite.org/msg34082.html ) looks > totally fine: You're missing something: FTS4 is a virtual table

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
On 04.04.2011, at 15:59, Simon Slavin wrote: > > On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote: > >> isn't last_insert_rowid defined as the ID of the last row inserted > > Yes it is. But the FTS system does what it does by maintaining extra tables, > and doing extra operations to them

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
On 04.04.2011, at 15:59, Simon Slavin wrote: > > On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote: > >> isn't last_insert_rowid defined as the ID of the last row inserted > > Yes it is. But the FTS system does what it does by maintaining extra tables, > and doing extra operations to them

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote: > isn't last_insert_rowid defined as the ID of the last row inserted Yes it is. But the FTS system does what it does by maintaining extra tables, and doing extra operations to them besides the ones that the programmer has asked for.

Re: [sqlite] Question:how to insert row with multiple values from same field of different rows of another table?

2011-04-04 Thread Colin Cuthbert
> From: contactcolincuthb...@hotmail.com > To: sqlite-users@sqlite.org > Date: Mon, 4 Apr 2011 13:12:02 + > Subject: Re: [sqlite] Question:how to insert row with multiple values from > same field of different rows of another table? > > > > > > From: punk.k...@gmail.com > > Date: Mon, 4

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
Hi Nico, this >> Is this really a bug? I at least wouldn't expect last_insert_rowid to be >> constant if the database gets modified. > was more a question for sake of my understanding. Both in the post Simon referred to > insert into one (value) values ("hello1"); > select

Re: [sqlite] Question:how to insert row with multiple values from same field of different rows of another table?

2011-04-04 Thread Colin Cuthbert
> From: punk.k...@gmail.com > Date: Mon, 4 Apr 2011 08:06:31 -0500 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Question:how to insert row with multiple values from > same field of different rows of another table? > > > On Apr 4, 2011, at 7:59 AM, Colin Cuthbert wrote: > > > >

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Nico Williams
On Mon, Apr 4, 2011 at 6:43 AM, Enrico Thierbach wrote: > Is this really a bug? I at least wouldn't expect last_insert_rowid to be > constant if the database gets modified. If you read the post that Simon referenced you'll see that the caller typically wants to know the row

Re: [sqlite] Question:how to insert row with multiple values from same field of different rows of another table?

2011-04-04 Thread Mr. Puneet Kishor
On Apr 4, 2011, at 7:59 AM, Colin Cuthbert wrote: > > > >> From: punk.k...@gmail.com >> Date: Sun, 3 Apr 2011 07:52:42 -0500 >> To: sqlite-users@sqlite.org >> Subject: Re: [sqlite] Question:how to insert row with multiple values from >> same field of different rows of another table? >> >>

Re: [sqlite] Question:how to insert row with multiple values from same field of different rows of another table?

2011-04-04 Thread Colin Cuthbert
> From: punk.k...@gmail.com > Date: Sun, 3 Apr 2011 07:52:42 -0500 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Question:how to insert row with multiple values from > same field of different rows of another table? > > > On Apr 3, 2011, at 7:50 AM, Luuk wrote: > > > On 03-04-2011

[sqlite] enable spatiaLite extension

2011-04-04 Thread Stephan-Alexander Meyer
Hi. I want to use spatiaLite extension in a php-Project. But i am not able to loaad it. I hope somebody could help me. I am using SQLite in this project as database. I have added: sqlite3.extension_dir = "/usr/local/spatiaLite"" ...to the php.ini and restarted apache. Now I can find exactly

Re: [sqlite] Question:how to insert row with multiple values from same field of different rows of another table?

2011-04-04 Thread Colin Cuthbert
> Date: Sun, 3 Apr 2011 14:50:30 +0200 > From: luu...@gmail.com > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Question:how to insert row with multiple values from > same field of different rows of another table? > > On 03-04-2011 14:43, Colin Cuthbert wrote: > > First time I've used

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
Is this really a bug? I at least wouldn't expect last_insert_rowid to be constant if the database gets modified. /eno On 04.04.2011, at 13:28, Alexey Pechnikov wrote: > $ sqlite3 > SQLite version 3.7.6 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite>

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 12:28pm, Alexey Pechnikov wrote: > sqlite> delete from fts where rowid=2; > sqlite> select last_insert_rowid(); > 3 See http://www.mail-archive.com/sqlite-users@sqlite.org/msg34082.html Simon. ___ sqlite-users mailing list

Re: [sqlite] Help with changing the code

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 11:53am, thilo wrote: > On 4/4/2011 2:05 AM, Guilherme Bamepe wrote: >> Hi! >> >> I'm new in SQLite, and I'm studying it to do a work in my college, >> and would be helpful if I get the SQLite to print, while executing >> the sql, after each table scan or join, the name of the

[sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Alexey Pechnikov
$ sqlite3 SQLite version 3.7.6 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> CREATE VIRTUAL TABLE fts USING fts4(a,TOKENIZE icu russian); sqlite> select last_insert_rowid(); 0 sqlite> insert into fts(a) values ('test'); sqlite> insert into fts(a) values

Re: [sqlite] Help with changing the code

2011-04-04 Thread thilo
On 4/4/2011 2:05 AM, Guilherme Bamepe wrote: > Hi! > > I'm new in SQLite, and I'm studying it to do a work in my college, > and would be helpful if I get the SQLite to print, while executing > the sql, after each table scan or join, the name of the table and > number of rows that are going to the

Re: [sqlite] Import data in SQLite from excel using C# code

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 7:12am, Deepti Marathe wrote: > From what I see in the examples in libxml, I can read an excel file in my > program, but I still cannot figure out how to upload that file(the data in > that file) to a table in SQlite. Use the data from that table to create the appropriate

Re: [sqlite] IF-THEN-ELSE sqlite

2011-04-04 Thread Marcelo Serrano Zanetti
On 04/03/2011 09:05 PM, Petite Abeille wrote: > On Apr 3, 2011, at 3:18 PM, Marcelo Serrano Zanetti wrote: > >> It does not work in this way ... could somebody tell me please what is >> the correct sintax or whether this is possible at all. > As mentioned, SQL is not a procedural language, so, no.

Re: [sqlite] Import data in SQLite from excel using C# code

2011-04-04 Thread Deepti Marathe
>From what I see in the examples in libxml, I can read an excel file in my program, but I still cannot figure out how to upload that file(the data in that file) to a table in SQlite. Mohd Radzi Ibrahim wrote: > > Hi, > Try use www.libxl.com that has C/C++/C#/Delphi interface to read excel >