[sqlite] Bug with DATETIME('localtime')

2015-12-14 Thread Hick Gunter
>... >We need a metric calendar. I propose redefining the second so that a day is >100,000 seconds long... ;) > >-- >Scott Robison And while we are already redefining the fundamental constants of measuring, we could redefine the meter to be exactly three feet and the kilogram to be exactly two

[sqlite] last_insert_rowid() and changes() per statement instead of per connection?

2015-12-14 Thread Olivier Mascia
m -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/attachments/20151214/7b567d13/attachment.pgp>

[sqlite] Why SQLITE_BUSY?

2015-12-14 Thread sanhua.zh
I queue all my db operation into one thread with single sqlite conn. neither multi-thread nor multi-process operation happened.But some SQLITE_BUSY error code still be catched. I can not re-produce this error code indeveloping environment,because it happen in alow probability. I only catch this

[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread 王庆刚
hi, every one. Here is a very strange and interesting problem. I used the following SQL to create the table teacher. CREATE TABLE techer(poiId INTEGER NOT NULL PRIMARY KEY, versionId INTEGER NOT NULL,

[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Stephan Beal
On Mon, Dec 14, 2015 at 11:21 AM, ??? <2004wqg2008 at 163.com> wrote: > hi, every one. > Here is a very strange and interesting problem. > I used the following SQL to create the table teacher. > CREATE TABLE techer(poiId INTEGER NOT NULL PRIMARY KEY, >

[sqlite] Locked database

2015-12-14 Thread Cecil Westerhof
I have a crontab job which uses a SQLite database. Sometimes this database is locked because I used SQLite DB Browser, but did not Write or Revert Changes. It looks like that when a database is locked there is a file with the database name with -journal appended to it. Can I count on this? Then I

[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Simon Slavin
On 14 Dec 2015, at 10:21am, ??? <2004wqg2008 at 163.com> wrote: > Here is a very strange and interesting problem. Your problem with renaming is not caused by SQLite. How are you talking to SQLite ? Have you written a C program which calls the SQLite API ? Are you using the command line

[sqlite] 答复: Very Strange and Interesting Problem

2015-12-14 Thread Quan Yong Zhai
https://www.sqlite.org/lang_createtable.html#rowid ???: ??? : ?2015/?12/?14 18:21 ???: sqlite-users at mailinglists.sqlite.org ??: [sqlite] Very Strange and Interesting Problem hi,

[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Stephan Beal
On Mon, Dec 14, 2015 at 11:47 AM, Stephan Beal wrote: > On Mon, Dec 14, 2015 at 11:21 AM, ??? <2004wqg2008 at 163.com> wrote: > >> hi, every one. >> Here is a very strange and interesting problem. >> I used the following SQL to create the table teacher. >> CREATE TABLE

[sqlite] Locked database

2015-12-14 Thread Clemens Ladisch
Cecil Westerhof wrote: > I have a crontab job which uses a SQLite database. Sometimes this database > is locked because I used SQLite DB Browser, but did not Write or Revert > Changes. It looks like that when a database is locked there is a file with > the database name with -journal appended to

[sqlite] 答复: Very Strange and Interesting Problem

2015-12-14 Thread 王庆刚
https://www.sqlite.org/lang_createtable.html#rowid The above link websit is very valuable. Thanks for Quan Yong Zhai. At 2015-12-14 19:08:59, "Quan Yong Zhai" wrote: >https://www.sqlite.org/lang_createtable.html#rowid > >???: ???

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

2015-12-14 Thread Dan Kennedy
On 12/13/2015 08:05 PM, ajm at zator.com wrote: >> Mensaje original >> De: Dan Kennedy >> Para: sqlite-users at mailinglists.sqlite.org >> Fecha: Fri, 11 Dec 2015 22:54:45 +0700 >> Asunto: Re: [sqlite] Problem when upgrading from FTS3/4 >> toFTS5modules(revisited) >> > 1a.-

[sqlite] Locked database

2015-12-14 Thread Cecil Westerhof
2015-12-14 12:40 GMT+01:00 Clemens Ladisch : > Cecil Westerhof wrote: > > I have a crontab job which uses a SQLite database. Sometimes this > database > > is locked because I used SQLite DB Browser, but did not Write or Revert > > Changes. It looks like that when a database is locked there is a

[sqlite] Is rowid the fastest?

2015-12-14 Thread 王庆刚
hi, create a table using the following sql. CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z); So the x is the alias of the rowid. Retrieving records by rowid around twice as fast as other indexs values. Because of the x is the alias of rowid, so retrieving records by x is also as

[sqlite] Is rowid the fastest?

2015-12-14 Thread Hick Gunter
You are probably falling into the cache effect trap again. There is no point in indexing on the primary key, it only wastes space and CPU cycles -Urspr?ngliche Nachricht- Von: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im

[sqlite] Is rowid the fastest?

2015-12-14 Thread 王庆刚
You said that "You are probably falling into the cache effect trap again. There is no point in indexing on the primary key, it only wastes space and CPU cycles ". I do not agree with you. let me tell you why. Before I retrieve by index which created for primary key. The speed of retrieve by

[sqlite] Is rowid the fastest?

2015-12-14 Thread Hick Gunter
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 my machine (Version 3.7.14); if yours behaves the same way then whatever changes speed is definitely not because SQLite is doing

[sqlite] Locked database

2015-12-14 Thread 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 the case? sqlite3 returns the SQLite error code, and 5

[sqlite] Is rowid the fastest?

2015-12-14 Thread Clemens Ladisch
??? wrote: > CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z); > > In order to testing the efficiency. After I create index on t(x). > And this give me a suprise, now I retrieve by x , I found that its is > faster than its before. An index entry is smaller than a table row, so if you

[sqlite] non-integer rowid/document id

2015-12-14 Thread jer...@copiousfreetime.org
Hi all, I'm working with FTS5 and I'd like to guarantee that a particular document is indexed only once. I have what I consider to be a document id, but it is not an integer value its a hexadecimal string, think GUID/md5/sha1. Since the fts5 rowid column is an integer, it appears I'll need to

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Bart Smissaert
Not sure if I need to call sqlite3_free after running sqlite3_result_text or if sqlite3_free should be an argument (last one) in sqlite3_result_text. Currently I am using SQLITE_TRANSIENT as the last argument, so that is after the number of bytes, but have feeling I might be doing this wrong.

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Igor Tandetnik
On 12/14/2015 2:21 PM, Bart Smissaert wrote: > Not sure if I need to call sqlite3_free after running sqlite3_result_text or > if sqlite3_free should be an argument (last one) in sqlite3_result_text. That depends on how the memory was obtained that the second argument points to. -- Igor

[sqlite] Geting the errorcode in Java

2015-12-14 Thread Cecil Westerhof
I have the following code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.SQLException; public class CheckProverbsLocked { private CheckProverbsLocked() { } public static void main(String [] args) throws Exception {

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Bart Smissaert
It could be either a pointer to sqlite3_value_text of sqlite3_value* or it could be a pointer to a locally declared variable, so that is declared in a procedure in a VB6 ActiveX dll. Do I need to run sqlite3_free in the first case and not in the second case? If do need to run it how do I do it? As

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Igor Tandetnik
On 12/14/2015 3:09 PM, Bart Smissaert wrote: > It could be either a pointer to sqlite3_value_text of sqlite3_value* No it can't be. sqlite3_result_text takes a char*, not a sqlite3_value* or a const unsigned char*(*)(sqlite3_value*) If you are saying that you plan to obtain the character

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Bart Smissaert
OK, thanks, will have to study this carefully. So, if I understand you well then the way I do it now I would need sqlite3_free? Not sure it is helpful, but this is the callback procedure as I have it. It will find a specified string (second argument in SQL) in the supplied field value (first

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Igor Tandetnik
On 12/14/2015 5:46 PM, Bart Smissaert wrote: > OK, thanks, will have to study this carefully. > So, if I understand you well then the way I do it now I would need > sqlite3_free? First, I don't know how you do it now - you've never described that. Second, I have not ever said you needed

[sqlite] sqlite3_free needed when calling sqlite3_result_text ?

2015-12-14 Thread Igor Tandetnik
On 12/14/2015 7:42 PM, Bart Smissaert wrote: > 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. ... and then you pass

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

2015-12-14 Thread Anthony Damico
hi, sql standard says to strip whitespace and then convert. "" coercing to zero instead of NULL strikes me as very odd.. thanks some code here- https://github.com/rstats-db/RSQLite/issues/127