[sqlite] How to select from table

2012-06-20 Thread deltagam...@gmx.net
Hello, how can i select from sqlite3 db ? How do I retrieve the number of records in a table ? Thx in advance ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] How to select from table

2012-06-20 Thread deltagam...@gmx.net
Am 20.06.2012 12:02, schrieb deltagam...@gmx.net: Hello, how can i select from sqlite3 db ? How do I retrieve the number of records in a table ? Thx in advance Sorry forgot to tell, I'm using the c++ API ___ sqlite-users mailing list

[sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pontus Bergsten
In our application we have two threads implementing a signal logger functionality, see pseudo code below. Thread 1: Reads signal data, and log to a global in-memory SQLite database after a pre-determined number of reads.  1   while( true )  2  {  3 // Buffer data, blocks until new data is

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pavel Ivanov
Probably the following scenario is possible in your situation: - thread 1 locks transaction mutex - thread 1 inserts buffered data - thread 2 starts transferring data to Dest database - thread 1 tries to commit, commit fails (do you check return code from it?), transaction is left open - thread 1

Re: [sqlite] How to select from table

2012-06-20 Thread Igor Tandetnik
deltagam...@gmx.net wrote: > how can i select from sqlite3 db ? By executing a SELECT statement, of course. See this example: http://books.google.com/books?id=VsZ5bUh0XAkC=PA222 > How do I retrieve the number of records in a table ? By running this statement: select count(*) from MyTable; --

[sqlite] Problem with select

2012-06-20 Thread deltagam...@gmx.net
Hello, I have a problem with the selection of the row, errorcode 21 s Indeed I would like to retrieve all rows, but as far as I understand it, this construction will retrieve only the last row/insert. What happens if the db is closed after the insert and reopened then for the

Re: [sqlite] Problem with select

2012-06-20 Thread Marcus Grimm
On 20.06.2012 15:03, deltagam...@gmx.net wrote: Hello, I have a problem with the selection of the row, errorcode 21 s You are missing a sqlite3_prepare_v2 for your select. Indeed I would like to retrieve all rows, but as far as I understand it, this construction will retrieve only the

Re: [sqlite] Problem with select

2012-06-20 Thread Simon Slavin
On 20 Jun 2012, at 2:03pm, deltagam...@gmx.net wrote: > I have a problem with the selection of the row, errorcode 21 s Look up the error code in the list, or make SQLite print out the text message which does with it. On this page you see that error

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pontus Bergsten
Thanks for the response, In fact, Thread 2 uses a series of INSERT INTO...SELECT queries to transfer data in chunks in a loop, from "main" to "Dest". The queries are prepared once in the beginning of the transfer loop. In each iteration the statements are bounded with new time interval

Re: [sqlite] Problem with select

2012-06-20 Thread Black, Michael (IS)
You missed the prepare for your select_sql: sqlite3_stmt *select_stmt = NULL; sqlite3_prepare_v2(db,select_sql,strlen(select_sql),_stmt,NULL); Add that one line and you get: Successfully bound string for insert: 'zweiter Anlauf/Versuch' Successfully bound real for insert: 22

Re: [sqlite] Odd insertion error FTS4 + ICU (E. Timothy Uy)

2012-06-20 Thread Klaas Van Be
>> >> inserting the following into my virtual table: >> >> >> >> 一日耶羅波安出 >> >> Can you post the list of codepoints in this text? Or the hex >> of the utf-16 or utf-8 encoding of the same? 00 4E E5 65 36 80 85 7F E2 6C 89 5B FA 51 Here no problem inserting this string (Mac OSX 10.6.8) sqlite>

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pavel Ivanov
> Thread 1 is using transaction statements "BEGIN" and "COMMIT" to start and > commit transactions. As we know the commit statement in Thread 2 does not > fail. I guess you meant Thread 1 in the last sentence. And how do you know that? Do you check the return code? Pavel On Wed, Jun 20,

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pontus Bergsten
> I guess you meant Thread 1 in the last sentence. And how do you know > that? Do you check the return code? You are absolutely right, I meant Thread 1. We are checking the return value of the commit statement which indicate success ( 0 ). Pontus >Pavel > > >On Wed, Jun 20, 2012 at 9:27 AM,

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pavel Ivanov
Then something else should happen in your application besides the given pseudo code. Could you try to check what sqlite3_get_autocommit() returns and execute rollback under the mutex but before doing detach? Pavel On Wed, Jun 20, 2012 at 10:11 AM, Pontus Bergsten

Re: [sqlite] How to select from table

2012-06-20 Thread deltagam...@gmx.net
Am 20.06.2012 14:55, schrieb Igor Tandetnik: deltagam...@gmx.net wrote: how can i select from sqlite3 db ? By executing a SELECT statement, of course. See this example: http://books.google.com/books?id=VsZ5bUh0XAkC=PA222 How do I retrieve the number of records in a table ? By running this

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pontus Bergsten
Let's see, the code in Thread 2 then look something like this: {    ...    copy data    request mutex    sqlite3_get_autocommit     returns 1 ( Autocommit mode enabled )    exec("ROLLBACK")   returns 1 ( SQLITE_ERROR )    exec("DETACH DATABASE Dest")   returns 1(

[sqlite] icu_load_collation: How do I load a case-insensitive collation?

2012-06-20 Thread Grace Batumbya
Hi there, How do I load a case-insensitive collation using the icu_load_collation method that is provided by the ICU extension. Regards, Grace Batumbya Research Assistant | Seneca CDOT Phone: 416-491-5050 x3548 cdot.senecac.on.ca

Re: [sqlite] How to select from table

2012-06-20 Thread Black, Michael (IS)
setup() must be some other function in the book. Get rid of it. Probably runs some pragmas. You can force the name error to go away by casting to char *. Or you can strdup the sqlite3_column_text value and free it when you're done. The error is warning you that you need to be aware

[sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
I'm working on a OSX10.7 ODBC query interface - type SQL, get results. It uses the open-source iODBC library set. I've got this working fairly well with MySQL (including major public servers on the 'net, cool!) and Firebird. I'd like to test it against SQLite as well, as this is obviously a

Re: [sqlite] Problem with concurrent transaction and DETACH DATABASE

2012-06-20 Thread Pavel Ivanov
It looks to me that you have corrupted memory or already closed database at this point. AFAIK, ROLLBACK cannot return SQLITE_ERROR in any "normal" situation (I exclude such situations as faulty disk or some similar I/O error), normally it can return only SQLITE_BUSY. Check your application in

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Simon Slavin
On 20 Jun 2012, at 4:43pm, Maury Markowitz wrote: > So can anyone suggest any SQLite command I might send in through the SQL > interface that should return something even if there is no active DB > connection? Your interface may do its own checking for a DB and

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
My apologies, I failed to mention this potentially important point: select * from sqlite_master returns columns in the result set, but no rows of data. So I *am* connected, but it just doesn't seem to see any data. ___ sqlite-users mailing list

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
On 2012-06-20, at 11:50 AM, Simon Slavin wrote: > SELECT sqlite_version() > PRAGMA database_list Ahhh, thanks Simon, this is precisely the sort of thing I was looking for. And the results are... > SELECT sqlite_version() 3.7.7 > PRAGMA database_list Onward!

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Pavel Ivanov
On Wed, Jun 20, 2012 at 11:57 AM, Simon Slavin wrote: > > On 20 Jun 2012, at 4:53pm, Maury Markowitz wrote: > >> On 2012-06-20, at 11:50 AM, Simon Slavin wrote: >>> SELECT sqlite_version() >>> PRAGMA database_list >> >> Ahhh, thanks Simon, this is

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Simon Slavin
On 20 Jun 2012, at 5:01pm, Pavel Ivanov wrote: > On Wed, Jun 20, 2012 at 11:57 AM, Simon Slavin wrote: >> >> It may not be finding your database in the folder where you think it's >> looking. When you tell it which database to open try specifying

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
On 2012-06-20, at 12:01 PM, Pavel Ivanov wrote: > Meaning "from '/' onwards" as OP works on OS X. ;-) Indeed! :-) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
On 2012-06-20, at 12:01 PM, Pavel Ivanov wrote: >> Well that looks like your library is loading, the connection with ODBC is >> working, but it isn't accessing your database file. I agree with your other >> post. >> >> It may not be finding your database in the folder where you think it's >>

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Simon Slavin
On 20 Jun 2012, at 5:12pm, Maury Markowitz wrote: > On 2012-06-20, at 12:01 PM, Pavel Ivanov wrote: >>> Well that looks like your library is loading, the connection with ODBC is >>> working, but it isn't accessing your database file. I agree with your >>> other

Re: [sqlite] Testing the ODBC link

2012-06-20 Thread Maury Markowitz
I swear I did nothing... and it's working perfectly. Ahhh... However, the ODBC driver does not properly return the "current catalog" from its connection info, which I use to drive the schema download/unfold. Nothing major, it's a minor annoyance only, but I'll keep poking at it and maybe I can

[sqlite] Bug report - compilation fails in VS2010 with SQLITE_ZERO_MALLOC defined (patch included)

2012-06-20 Thread Duncan Smith
Hi, I'm using the Amalgamation file currently available from (named sqlite-amalgamation-3071300.zip). When I compile it in Visual Studio 2010 with SQLITE_ZERO_MALLOC defined, I get a double-definition of the default memory allocator functions:

Re: [sqlite] Bug report - compilation fails in VS2010 with SQLITE_ZERO_MALLOC defined (patch included)

2012-06-20 Thread Duncan Smith
Oh dear, that got mangled quite horribly. I've attached the patch instead. -- Duncan Smith ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] fetching rows

2012-06-20 Thread Durga D
Hi All, I have to develop a sqlite application. Within the process, multiple threads are trying to access in write/read mode. Will sqlite supports read and write at a time? scenario: 1. x number of records (x related data) are going to insert in a transaction in ThreadA. still, not

Re: [sqlite] fetching rows

2012-06-20 Thread Pavel Ivanov
On Wed, Jun 20, 2012 at 11:33 PM, Durga D wrote: > Hi All, > >    I have to develop a sqlite application. Within the process, multiple > threads are trying to access in write/read mode. Will sqlite supports read > and write at a time? > >    scenario:  1. x number of records