[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
Yes, str and str2 are Unicode string, 2 bytes per character. lPos counts per character, not byte, so if the string in the database is abcde and I want to find the first position of d in that string then lPos will be 4. > You are converting in one direction (SQLite to VB), but not in the other I

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
Maybe I shouldn't make Unicode strings but keep it all in UTF8. Not sure though how to get the position then of string2 in string1, lPos. RBS On Tue, Dec 15, 2015 at 12:42 AM, Bart Smissaert wrote: > Yes, str and str2 are Unicode string, 2 bytes per character. > lPos counts per character,

[sqlite] Is rowid the fastest?

2015-12-15 Thread 王庆刚
When it revert back after dropping the index. The speed does not become slower. At 2015-12-14 21:35:03, "Hick Gunter" wrote: >Does it revert back to slower speed after dropping the index? >Can you compare the EXPLAIN output produced with and without the index? > >There is no difference on

[sqlite] Locked database

2015-12-15 Thread Cecil Westerhof
2015-12-14 15:14 GMT+01:00 Clemens Ladisch : > Cecil Westerhof wrote: > > sqlite3 "${DATABASE}" "begin immediate" 2>/dev/null > > errorCode="${?}" > > if [[ "${errorCode}" -eq 5 ]] ; then > > printf "${DATABASE} is locked\n" > > > > I saw that when it is locked I get back a 5. Is this always

[sqlite] Fastest read?

2015-12-15 Thread 王庆刚
hi,all I want to improve the speed of the retrieve records. I try so many methods. and find the result is not good. Such as retrieve by rowid, index and so on. Is there any other method which can improve the retrieve speed? Best regards. WQG

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Hick Gunter
The rules are quite simple: If the pointer refers to static memory (preallocated string constants, global variables that you can guarantee won't change while SQLite uses them) use SQLITE_STATIC If the pointer refers to memory obtained from sqlite3_malloc (directly or indirectly e.g. via

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
> but the string "abc" is not 4 bytes long, no matter how you count. Yes, sorry to cause confusion there, the -2 got in there as in my testing setup there was always a space before the string to find. This is not really to do with the problem I am seeing though. RBS On Tue, Dec 15, 2015 at

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
Thanks for clarifying that. > If the pointer refers to memory obtained from sqlite3_malloc How do I know that is the case? My callback procedure (the procedure that does the actual work, altering the string) is in a VB6 ActiveX dll, so not in sqlite3.dll > If the pointer refers to memory

[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread sanhua.zh
I?m very excited that I re-produce the SQLITE_BUSY code in a simple demo. Here is my test code, void showResultCode(int resultCode) { if (resultCode!=SQLITE_DONEresultCode!=SQLITE_OKresultCode!=SQLITE_ROW) { NSLog(@"unexperted result %d", resultCode); } } void SQLiteLog(void* userInfo,

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Hick Gunter
>Thanks for clarifying that. > >> If the pointer refers to memory obtained from sqlite3_malloc >How do I know that is the case? >My callback procedure (the procedure that does the actual work, altering the >string) is in a VB6 ActiveX dll, so not in sqlite3.dll If you called an sqlite3 API

[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread Hick Gunter
It looks like you have unfinalized statements in your transaction. You are preparing statements inside the loop, but finalizing only 1 (the last) statement. And attempting to commit even before finalizing only the last statement. So sqlite3_close() is complaining about improper call sequence,

[sqlite] get blob colums values by sqlite3_get_table?

2015-12-15 Thread 王庆刚
int sqlite3_get_table( sqlite3 *db, /* An open database */ const char *zSql, /* SQL to be evaluated */ char ***pazResult,/* Results of the query */ int *pnRow, /* Number of result rows written here */ int *pnColumn,/* Number of result columns written

[sqlite] [RE] System.Data.SQLite version 1.0.99.0 released

2015-12-15 Thread Zaumseil René
Hello I have still problems to get it working on SQL Server2012 R2. I got the following message: "That assembly does not allow partially trusted" The server is shared and there is no possibility to change system settings. The program uses ASP.NET C# library under IIS. Is there a possibility to

[sqlite] 回复: Why SQLITE_BUSY?

2015-12-15 Thread sanhua.zh
oh, sorry, I make this mistake. Another question is that if ?sqlite3_prepare? fail, do I need to ?sqlite3_finalize? the stmt. Here is the sample code, int ret = sqlite3_prepare(handle, ?some sql?, stmt, ?); if (ret==SQLITE_OK) { //step sqlite3_finalize(stmt); }else { //log error //should I

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
> like sqlite3_malloc() or sqlite3_mprinft() to produce the string. OK, I won't be doing that. > I guess NO So I will need to use SQLITE_TRANSIENT then? > You should know where the memory used to store the string in your own code comes from and how to deal with it. It will nearly always be a

[sqlite] SELECT CAST('' AS INTEGER) returns zero instead of null

2015-12-15 Thread Simon Slavin
On 14 Dec 2015, at 2:26pm, Anthony Damico wrote: > hi, sql standard says to strip whitespace and then convert. "" coercing to > zero instead of NULL strikes me as very odd.. thanks In your command SELECT CAST('' AS INTEGER) you explicitly tell it to CAST('' AS INTEGER) which means it has

[sqlite] Fastest read?

2015-12-15 Thread Simon Slavin
> On 15 Dec 2015, at 7:18am, ??? <2004wqg2008 at 163.com> wrote: > >I want to improve the speed of the retrieve records. >I try so many methods. and find the result is not good. Such as retrieve > by rowid, index and so on. >Is there any other method which can improve the retrieve

[sqlite] get blob colums values by sqlite3_get_table?

2015-12-15 Thread Clemens Ladisch
??? wrote: > int sqlite3_get_table( > char ***pazResult,/* Results of the query */ > > could I get blob colums values by sqlite3_get_table? Yes. But like any other values, they are converted to strings. Regards, Clemens

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
> If you are saying that you plan to obtain the character pointer by calling sqlite3_value_text, then pass that exact pointer to sqlite3_result_text, then I would suggest you use sqlite3_result_value instead But sqlite3_result_value has no option to only set the first X bytes, so it won't allow

[sqlite] Problem when upgrading from FTS3/4toFTS5modules(revisited)

2015-12-15 Thread a...@zator.com
> > Mensaje original > De: Dan Kennedy > Para: sqlite-users at mailinglists.sqlite.org > Fecha: Mon, 14 Dec 2015 19:15:23 +0700 > Asunto: Re: [sqlite] Problem when upgrading from > FTS3/4toFTS5modules(revisited) > > > >So that looks like database corruption, except we don't think

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
> I have no idea how VB6 implements local variables Pure local variables (declared in the actual procedure) are on the stack as well in VB6. VB6 hides all these kind of details, so I never think about this/deal with this. RBS On Tue, Dec 15, 2015 at 9:33 AM, Hick Gunter wrote: > >Thanks for

[sqlite] Bug: sqlite ships with old autotools

2015-12-15 Thread Jeroen Demeyer
Dear SQLite developers, The newest released version 3.9.2 of sqlite-autotools ships with an old version of autotools. In particular, it fails to compile on this system: $ uname -a Linux sardonis 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:13 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Richard Hipp
On 12/15/15, Bart Smissaert wrote: > So I will need to use SQLITE_TRANSIENT then? > Yes. Always use SQLITE_TRANSIENT, at least initially. All the other options are optimizations. Do not use the other options prematurely (that is to say, without first trying SQLITE_TRANSIENT and actually

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-15 Thread Bart Smissaert
Thanks, nice and simple and helpful advice. RBS On 15 Dec 2015 1:45 pm, "Richard Hipp" wrote: > On 12/15/15, Bart Smissaert wrote: > > So I will need to use SQLITE_TRANSIENT then? > > > > Yes. Always use SQLITE_TRANSIENT, at least initially. All the other > options are optimizations. Do not

[sqlite] Geting the errorcode in Java

2015-12-15 Thread gwenn
Hello, Your code looks good to me. You should report an issue here: https://github.com/xerial/sqlite-jdbc Regards. On Mon, Dec 14, 2015 at 8:38 PM, Cecil Westerhof wrote: > I have the following code: > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.Statement; >

[sqlite] Geting the errorcode in Java

2015-12-15 Thread Cecil Westerhof
2015-12-15 18:51 GMT+01:00 gwenn : > Your code looks good to me. > You should report an issue here: https://github.com/xerial/sqlite-jdbc > ?Done.? -- Cecil Westerhof

[sqlite] bug when columns are missing in embedded subselect

2015-12-15 Thread Karl Lehenbauer
Consider the following table definitions: DROP TABLE IF EXISTS flightplans; CREATE TABLE flightplans ( id text NOT NULL, ident text, recvd integer, orig text, dest text, PRIMARY KEY (id) ); DROP TABLE IF EXISTS inflight; CREATE TABLE inflight ( fp text,

[sqlite] bug when columns are missing in embedded subselect

2015-12-15 Thread Richard Hipp
On 12/15/15, Karl Lehenbauer wrote: > > sqlite> select fp from flightplans; > > Error: no such column: fp > > But if I select a column that doesn?t exist within an embedded subquery, it > is not an error? > > sqlite> delete from inflight where fp in (select fp from flightplans); > The "fp" in

[sqlite] Running Sqlite on 64-bit/Client-server data base

2015-12-15 Thread Hamdan Alabsi
Greetings Everyone, Hope all is well. I am wondering if I can run Sqlite on 64-bit machine? Also, does sqlite support client-server database engine ? I hope I can get the answers from you very soon. Thank you. Best regards, Hamdan

[sqlite] Running Sqlite on 64-bit/Client-server data base

2015-12-15 Thread Bernardo Sulzbach
It runs on 64-bit computers. It does not need a special process to serve other processes. Read the documentation to answer trivial questions like these. On Tue, Dec 15, 2015 at 9:47 PM, Hamdan Alabsi wrote: > Greetings Everyone, > Hope all is well. I am wondering if I can run Sqlite on 64-bit

[sqlite] bug when columns are missing in embedded subselect

2015-12-15 Thread Stephen Chrzanowski
I work for a flight planning software house, so I had to take a double-look at this. Competition, eh? ;) On Tue, Dec 15, 2015 at 4:14 PM, Richard Hipp wrote: > > > Interesting timing: I was monitoring an inbound flight on flightaware > when this issue report arrived in my inbox. :-) > > -- >

[sqlite] about attach database

2015-12-15 Thread Richard Hipp
On 12/15/15, ??? <2004wqg2008 at 163.com> wrote: > hi,all > There are two ways to open a database. > 1.sqlite3_open > 2.ATTACH DATABASE > > Because there are so many data base. So we used attach database to open > them. > But the efficiency of the programming is not ideal.

[sqlite] about attach database

2015-12-15 Thread Richard Hipp
On 12/15/15, ??? <2004wqg2008 at 163.com> wrote: >I mean only compare the two ways of get the database handl. > 1.sqlite3_open > 2.ATTACH DATABASE I think they both do about the same amount of work. -- D. Richard Hipp drh at sqlite.org

[sqlite] Problem with accumulating decimal values

2015-12-15 Thread James K. Lowden
On Fri, 11 Dec 2015 16:21:30 +0200 "Frank Millman" wrote: > sqlite> UPDATE fmtemp SET balance = balance + 123.45; > sqlite> SELECT bal FROM fmtemp; > 5925.599 To a question like that you'll receive a lot of answers about numerical accuracy. And it's true that there are ways to "do the

[sqlite] about attach database

2015-12-15 Thread Jim Dodgen
You cannot attach to this list. If you can just paste into the body of the email or provide a link to the information *Jim Dodgen* On Tue, Dec 15, 2015 at 9:33 PM, ??? <2004wqg2008 at 163.com> wrote: > > After testing the Sqlite3_open and ATTACH DATABASE, > I found that