Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jay A. Kreibich wrote: > I think you're actual question is if zero-characters are prohibited, > and I think the answer is no. SQLite quite happily works with strings with embedded nulls - it is also part of my test suite. SQLite has a count of

Re: [sqlite] Result_* functions

2010-03-17 Thread Dan Kennedy
On Mar 18, 2010, at 6:40 AM, Jean-Christophe Deschamps wrote: > Is it allowable/safe to invoke more than once any sqlite3_result_*() > function? In other terms, subsequent invokation of any result > function > will it harmlessly override a previous one? Yes and yes.

Re: [sqlite] one column is another table's row num

2010-03-17 Thread Igor Tandetnik
liubin liu wrote: > I want to create two tables like: > create table t1 (id INT PRIMARY KEY, cont TEXT); > create table t2 ({select count(*) from t1} INT); > > How could I do it? You create table t2 with plain vanilla integer field, then create insert and delete triggers on t1 that update t2.

[sqlite] one column is another table's row num

2010-03-17 Thread liubin liu
I want to create two tables like: create table t1 (id INT PRIMARY KEY, cont TEXT); create table t2 ({select count(*) from t1} INT); How could I do it? -- View this message in context: http://old.nabble.com/one-column-is-another-table%27s-row-num-tp27940860p27940860.html Sent from the SQLite

[sqlite] Result_* functions

2010-03-17 Thread Jean-Christophe Deschamps
Is it allowable/safe to invoke more than once any sqlite3_result_*() function? In other terms, subsequent invokation of any result function will it harmlessly override a previous one? As in: init... // once for all, post null return in anticipation for the various cases where // parameters

Re: [sqlite] database optimization issues.

2010-03-17 Thread Felipe Aramburu
Thanks I actually resolved this. I wasn't using a UNION operator On Wed, Mar 17, 2010 at 5:50 PM, Igor Tandetnik wrote: > Felipe Aramburu wrote: > > stmtGetQuestionsNewSystemType.text = 'SELECT > DISTINCT > > Question.id > > AS id, Question.name AS

Re: [sqlite] Problem with between clause and dates

2010-03-17 Thread Igor Tandetnik
Mike Martin wrote: >>> select tsid from recordings where '2010-03-16 23:05:00' between start and >>> end' > > It should return nothing because the time 2010-03-16 23:06:00 is later > than the end time of 2010-03-16 23:05:00 I don't see 23:06 anywhere in your statement nor in your data. -- Igor

[sqlite] Fwd: database optimization issues.

2010-03-17 Thread Felipe Aramburu
http://www.filesavr.com/dbexample Here is an example of some tables which I am having very poor performance querying. I was wondering if someone could give me some suggestions as to how I can optimize this. I am using the adobe Air framework (AS3) to access

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
I fink now is all right: I follow your instructions and no more call to strlen are maked. And utf8 chars are ignored returning the correct char index when non blob, and if in text have any '\0' (only in blob fields i believe), this code will work too. Porwerfull test cases: -- with text

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Nicolas Williams
On Wed, Mar 17, 2010 at 03:02:59PM -0500, Jay A. Kreibich wrote: > On Wed, Mar 17, 2010 at 04:42:59PM -0300, Israel Lins Albuquerque scratched > on the wall: > > are you right the call to strpos("??", "??") are returning 5 and > > not 3 > > > > I'm looking for this... > > You can't

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Pavel Ivanov
>  I think you're actual question is if zero-characters are prohibited, >  and I think the answer is no. Yes, that was exactly my question. >  In any event, you can use >  sqlite3_value_bytes() to find out the length of the text value >  returned.  That is, however BYTES, not CHARACTERS. Oh,

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Jay A. Kreibich
On Wed, Mar 17, 2010 at 04:36:02PM -0400, Pavel Ivanov scratched on the wall: > > ?You can't do pointer math with values returned by strlen(). > > BTW, I see that SQLite has sqlite3_value_text() function but has no > sqlite3_value_text_len() function. Is it explicitly mentioned > somewhere that

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Pavel Ivanov
>  You can't do pointer math with values returned by strlen(). BTW, I see that SQLite has sqlite3_value_text() function but has no sqlite3_value_text_len() function. Is it explicitly mentioned somewhere that '\0' bytes in the middle of the text are prohibited? It seems that sqlite3_bind_text()

Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
> Thanks for clarification. I assumed the error message of error code > > SQLITE_BUSY is something like "databased is busy". > > http://www.sqlite.org/c3ref/c_abort.html > Also in sqlite3.h file - comments on the right are almost exactly > reflect the corresponding error message. > You are

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Jay A. Kreibich
On Wed, Mar 17, 2010 at 04:42:59PM -0300, Israel Lins Albuquerque scratched on the wall: > are you right the call to strpos("??", "??") are returning 5 and not > 3 > > I'm looking for this... You can't do pointer math with values returned by strlen(). -j -- Jay A. Kreibich <

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
are you right the call to strpos("áéíóú", "í") are returning 5 and not 3 I'm looking for this... -- Atenciosamente, Israel Lins Albuquerque Desenvolvimento Polibrás Brasil Software Ltda. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
actually yes, because this is the minimal size of a char in UTF-8, because sqlite3_value_text returns the - Mensagem original - De: "Jay A. Kreibich" Para: "General Discussion of SQLite Database" Enviadas: Quarta-feira, 17 de Março de 2010

Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread Pavel Ivanov
> Thanks for clarification. I assumed the error message of error code > SQLITE_BUSY is something like "databased is busy". http://www.sqlite.org/c3ref/c_abort.html Also in sqlite3.h file - comments on the right are almost exactly reflect the corresponding error message. > Another newbie

Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
> According to documents, sqlite_busy will happen if new reader cannot get > > shared_lock or new writer cannot get reserved_lock. > > I didn't see sqlite_busy error from my application. > > I didn't understand this. "database is locked" is SQLITE_BUSY. > Thanks for clarification. I assumed the

Re: [sqlite] SQLite ODBC Driver - relative path

2010-03-17 Thread Guy Hachlili
Hello. On 17/03/2010 04:16, Shen Nan wrote: > I used SQLite ODBC Driver to display data in Excel, and everything works > fine. > Except in the connection String, I have to enter an absolute path, which is > very troublesome every time I move the file. > I wonder is there any way to specify

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Jay A. Kreibich
On Wed, Mar 17, 2010 at 01:15:35PM -0300, Israel Lins Albuquerque scratched on the wall: > There are the patch: Which seems to assume one character equals one byte. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have

Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
Thanks for help. As a novel sqlite user, it seems I need more. According to documents, sqlite_busy will happen if new reader cannot get shared_lock or new writer cannot get reserved_lock. I didn't see sqlite_busy error from my application. My usage is that: single process, multi-thread,

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
There are the patch: /***/ Index: func.c === --- func.c (revision 264) +++ func.c (working copy) @@ -117,6 +117,65 @@ } /* +** Implementation of the strpos()

Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread Pavel Ivanov
http://www.sqlite.org/faq.html#q5 http://www.sqlite.org/lockingv3.html Pavel On Wed, Mar 17, 2010 at 11:46 AM, imin imup wrote: > Hello users, > > I'm using sqlite 3.6.12 in muti-threaded application. I'm getting sqlite > errors occasionally. > The error message is > >

Re: [sqlite] SQLITE3 in multi-thread server

2010-03-17 Thread Pavel Ivanov
No TLS is used in SQLite. So you can open connection in one thread and use it in another. It's just a general suggestion to have one connection per thread. Otherwise you'll need to have some synchronization code or allow SQLite to do full synchronization for you. Pavel On Tue, Mar 16, 2010 at

[sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
Hello users, I'm using sqlite 3.6.12 in muti-threaded application. I'm getting sqlite errors occasionally. The error message is *sqlite error: database is locked* could someone explain to me what happened and what to be done? or point me to a document on how to fix this? Best Imin

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
I forgot attach... This are based in the current release 3.6.23. -- Atenciosamente, Israel Lins Albuquerque Desenvolvimento Polibrás Brasil Software Ltda. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
I've make an own implementation and I want to contribute see the patch attached. Sintax: strpos(string, substring[, pos]); string -> the master string, can be any type (INTEGER, REAL, BLOB) substring -> to be searched, can be any type (INTEGER, REAL, BLOB) pos [optional default = 1] -> is

Re: [sqlite] Why we don't have strpos function?

2010-03-17 Thread Simon Slavin
Strings are 16-bit strings which may or may not be Unicode strings, I think. It's hard to work out the position in a string if you don't know what encoding you're using. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] Why we don't have strpos function?

2010-03-17 Thread Israel Lins Albuquerque
... -- Atenciosamente, Israel Lins Albuquerque Desenvolvimento Polibrás Brasil Software Ltda. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Problem with between clause and dates

2010-03-17 Thread Jay A. Kreibich
On Wed, Mar 17, 2010 at 12:18:44PM +, Mike Martin scratched on the wall: > > >> select tsid from recordings where '2010-03-16 23:**05**:00' between > It should return nothing because the time 2010-03-16 23:**06**:00 is later > than the end time of 2010-03-16 23:**05**:00 Let me guess...

[sqlite] SQLite ODBC Driver - relative path

2010-03-17 Thread Shen Nan
Hi sqlite users, I used SQLite ODBC Driver to display data in Excel, and everything works fine. Except in the connection String, I have to enter an absolute path, which is very troublesome every time I move the file. I wonder is there any way to specify relative path instead in the

Re: [sqlite] Problem with between clause and dates

2010-03-17 Thread Igor Tandetnik
Mike Martin wrote: > I am getting occasional incorrect results using between operator > > example > > table structure > recordings > ID > tsid > start > end > > sample time= 2010-03-16 23:06:00 > sample start= 2010-03-16-22:00:00 > sample end= 2010-03-16 23:05:00 Do you actually have a dash

Re: [sqlite] Problem with between clause and dates

2010-03-17 Thread Michal Seliga
On 17. 3. 2010 11:49, Mike Martin wrote: > sample time= 2010-03-16 23:06:00 > sample start= 2010-03-16-22:00:00 > sample end= 2010-03-16 23:05:00 > select tsid from recordings where '2010-03-16 23:05:00' between start and end' > > This query should return nothing, so can anyone explain why it is

Re: [sqlite] Problem with between clause and dates

2010-03-17 Thread Simon Slavin
On 17 Mar 2010, at 10:49am, Mike Martin wrote: > sample time= 2010-03-16 23:06:00 > sample start= 2010-03-16-22:00:00 > sample end= 2010-03-16 23:05:00 > select tsid from recordings where '2010-03-16 23:05:00' between start and end' > > This query should return nothing, so can anyone explain

[sqlite] Problem with between clause and dates

2010-03-17 Thread Mike Martin
Hi I am getting occasional incorrect results using between operator example table structure recordings ID tsid start end sample time= 2010-03-16 23:06:00 sample start= 2010-03-16-22:00:00 sample end= 2010-03-16 23:05:00 select tsid from recordings where '2010-03-16 23:05:00' between start and

Re: [sqlite] SQLite on 64-bit Windows O/S

2010-03-17 Thread Simon Slavin
On 17 Mar 2010, at 4:04am, Roger Binns wrote: > Rashed Iqbal wrote: >> Has anyone compiled and used SQLite on 64-bit Windows? Are there any >> code changes that would be needed before compiling? Would the same DB >> file work on 32-bit and 64-bit Windows platforms? > > The file format is fixed

Re: [sqlite] VACUUM & journal size

2010-03-17 Thread Max Vlasov
> First, I'm sure it is nearly impossible to do this as a > guaranteed, atomic operation on most OSes and filesystems. ... > > Second, if this is meant to look like a cleanup operation on the > original file, the original file (including any filesystem meta-data) > should be kept in-tact.