Re: [sqlite] Crash in libsqlite3 with sqlite-3.21.0 and KDE plasmashell

2018-01-18 Thread Richard Hipp
On 1/19/18, Leonard Lausen  wrote:
>
> A crash in sqlite crashes plasmashell. Downstream bug
> https://bugs.kde.org/show_bug.cgi?id=388140. Please find the backtrace
> below:
>

(1) These kinds of things are almost always the result of heap
corruption in the application.  In other words, there is nothing wrong
with SQLite.  SQLite just happened to be the unlucky victim to first
stumble over the corrupted heap.  In fact, we find that whenever there
is heap corruption of any sort, SQLite is more likely that most other
libraries to be the first to stumble into it.

(2) You have provided us very little to go on:  There is no version
number on the SQLite library, no information on the platform on which
the application is running, no line-number information on the stack
trace, and no reproducible test case.

(3) Given the above, we will take no action on this.

(4) We will reconsider (3) if you can provide a scintilla of evidence
that SQLite is at fault.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "Error: NOT NULL constraint failed ..." when no such constraint exists

2018-01-18 Thread Shane Dev
I missed that part of the documentation, thanks

On 19 January 2018 at 07:51, Rowan Worth  wrote:

> https://www.sqlite.org/withoutrowid.html
>
> "NOT NULL is enforced on every column of the PRIMARY KEY in a WITHOUT ROWID
> table."
>
> It goes on to say that NOT NULL is supposed to be enforced on all PRIMARY
> KEY columns of _every_ table according to the SQL standard, but an early
> version of sqlite included a bug which allowed NULLs and as a result sqlite
> does not enforce this for ROWID tables.
>
> -Rowan
>
> On 19 January 2018 at 14:32, Shane Dev  wrote:
>
> > Hello,
> >
> > The following SQL works as I expect -
> >
> > sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
> > child));
> > sqlite> insert into edges select null, 1;
> > sqlite> select * from edges;
> > parent  child
> > 1
> > sqlite>
> >
> > but if I remove the superfluous rowid column from the table definition -
> >
> > sqlite> drop table edges;
> > sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
> > child)) without rowid;
> > sqlite> insert into edges select null, 1;
> > Error: NOT NULL constraint failed: edges.parent
> > sqlite>
> >
> > Why do I get this error?
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Crash in libsqlite3 with sqlite-3.21.0 and KDE plasmashell

2018-01-18 Thread Leonard Lausen

A crash in sqlite crashes plasmashell. Downstream bug
https://bugs.kde.org/show_bug.cgi?id=388140. Please find the backtrace
below:

-- Backtrace:
Application: Plasma (plasmashell), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f81e59b3e00 (LWP 2825))]

Thread 17 (Thread 0x7f80e159c700 (LWP 10067)):
#0  0x7f81df010c9d in poll () from /lib64/libc.so.6
#1  0x7f81d9c285e6 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x7f81d9c286fc in g_main_context_iteration () from 
/usr/lib64/libglib-2.0.so.0
#3  0x7f81df9811eb in 
QEventDispatcherGlib::processEvents(QFlags) () 
from /usr/lib64/libQt5Core.so.5
#4  0x7f81df92ccfa in 
QEventLoop::exec(QFlags) () from 
/usr/lib64/libQt5Core.so.5
#5  0x7f81df77de7a in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x7f81e2801cf5 in QQmlThreadPrivate::run() () from 
/usr/lib64/libQt5Qml.so.5
#7  0x7f81df7827f4 in QThreadPrivate::start(void*) () from 
/usr/lib64/libQt5Core.so.5
#8  0x7f81de8c7687 in start_thread () from /lib64/libpthread.so.0
#9  0x7f81df01c03f in clone () from /lib64/libc.so.6

Thread 16 (Thread 0x7f810089a700 (LWP 3252)):
#0  0x7f81de8ce586 in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x7f81df782fab in QWaitCondition::wait(QMutex*, unsigned long) () from 
/usr/lib64/libQt5Core.so.5
#2  0x7f8124b35005 in 
ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*,
 bool, bool, bool) () from /usr/lib64/libKF5ThreadWeaver.so.5
#3  0x7f8124b39198 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#4  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#5  0x7f8124b391f2 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#6  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#7  0x7f8124b3704b in ThreadWeaver::Thread::run() () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#8  0x7f81df7827f4 in QThreadPrivate::start(void*) () from 
/usr/lib64/libQt5Core.so.5
#9  0x7f81de8c7687 in start_thread () from /lib64/libpthread.so.0
#10 0x7f81df01c03f in clone () from /lib64/libc.so.6

Thread 15 (Thread 0x7f810109b700 (LWP 3251)):
#0  0x7f81de8ce586 in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x7f81df782fab in QWaitCondition::wait(QMutex*, unsigned long) () from 
/usr/lib64/libQt5Core.so.5
#2  0x7f8124b35005 in 
ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*,
 bool, bool, bool) () from /usr/lib64/libKF5ThreadWeaver.so.5
#3  0x7f8124b39198 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#4  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#5  0x7f8124b391f2 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#6  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#7  0x7f8124b3704b in ThreadWeaver::Thread::run() () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#8  0x7f81df7827f4 in QThreadPrivate::start(void*) () from 
/usr/lib64/libQt5Core.so.5
#9  0x7f81de8c7687 in start_thread () from /lib64/libpthread.so.0
#10 0x7f81df01c03f in clone () from /lib64/libc.so.6

Thread 14 (Thread 0x7f810189c700 (LWP 3250)):
#0  0x7f81de8ce586 in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x7f81df782fab in QWaitCondition::wait(QMutex*, unsigned long) () from 
/usr/lib64/libQt5Core.so.5
#2  0x7f8124b35005 in 
ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*,
 bool, bool, bool) () from /usr/lib64/libKF5ThreadWeaver.so.5
#3  0x7f8124b39198 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#4  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#5  0x7f8124b391f2 in 
ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, bool) () 
from /usr/lib64/libKF5ThreadWeaver.so.5
#6  0x7f8124b340fd in 
ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#7  0x7f8124b3704b in ThreadWeaver::Thread::run() () from 
/usr/lib64/libKF5ThreadWeaver.so.5
#8  0x7f81df7827f4 in QThreadPrivate::start(void*) () from 
/usr/lib64/libQt5Core.so.5
#9  0x7f81de8c7687 in start_thread () from /lib64/libpthread.so.0
#10 0x7f81df01c03f in clone () from /lib64/libc.so.6

Thread 13 

Re: [sqlite] Defect: Redundant CTE table materialization gives wrong answer.

2018-01-18 Thread petern
NO. I wrote that to rule out the objection that PostrgeSQL is getting the
right answer because random() is only being computed once per statement.
I naturally DO expect random() to run every time it is called.  What I
wrote is a formality for those thinking ahead about what else could be
happening.



On Thu, Jan 18, 2018 at 10:46 PM, Simon Slavin  wrote:

> On 19 Jan 2018, at 5:04am, petern  wrote:
>
> > WITH flips(s) AS (VALUES (random()), (random()), (random()))
> > SELECT * FROM flips;
> >
> > s
> > 0.760850821621716
> > 0.9941047639586031
> > 0.48273737309500575
>
> Are you expecting the three values to be the same ?  What about
>
> INSERT INTO MyTable VAKUES (random(), random(), random())
>
> ?  Would you expect those three values to be the same ?
>
> If you think of random() as an external function, do you think of it as
> marked SQLITE_DETERMINISTIC as defined in the following page ?
>
> 
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Defect: single row table cross join causes infinite loop

2018-01-18 Thread petern
This also works as expected in PostreSQL but not in SQLite.

WITH RECURSIVE params(n) AS (
   VALUES (5)
  ),
  coinflip(flip,side) AS (
SELECT 1, random()>0.5
UNION ALL
SELECT flip+1, random()>0.5 FROM coinflip
  )
SELECT flip,side FROM coinflip,params WHERE flip%n=0 LIMIT 3;

flip side
5 true
10 false
15 true
--no infinite loop here.  On the other hand, SQLite 3.22 beta plans an
infinite loop.



On Mon, Jan 15, 2018 at 1:10 AM, Clemens Ladisch  wrote:

> petern wrote:
> > there is an infinite loop when params table column "n" is used.
>
> >  WITH params(n) AS (
> >VALUES (5)
> >  ),
> >  coinflip(flip,side) AS (
> >SELECT 1, random()>0
> >UNION ALL
> >SELECT flip+1, random()>0 FROM coinflip
> >  )
> >  SELECT flip,side FROM coinflip,params WHERE flip%n=0 LIMIT 3;
>
> > So, what's going on here?  [params] is a constant one row table!
>
> But "coinflip" is infinitely large.  And the EXPLAIN output shows that
> the database tries to compute the entire table before doing the join.
>
> The only reliable way to prevent the infinite loop is to put a LIMIT (or
> a WHERE on a counter) inside the recursive CTE.
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "Error: NOT NULL constraint failed ..." when no such constraint exists

2018-01-18 Thread Rowan Worth
https://www.sqlite.org/withoutrowid.html

"NOT NULL is enforced on every column of the PRIMARY KEY in a WITHOUT ROWID
table."

It goes on to say that NOT NULL is supposed to be enforced on all PRIMARY
KEY columns of _every_ table according to the SQL standard, but an early
version of sqlite included a bug which allowed NULLs and as a result sqlite
does not enforce this for ROWID tables.

-Rowan

On 19 January 2018 at 14:32, Shane Dev  wrote:

> Hello,
>
> The following SQL works as I expect -
>
> sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
> child));
> sqlite> insert into edges select null, 1;
> sqlite> select * from edges;
> parent  child
> 1
> sqlite>
>
> but if I remove the superfluous rowid column from the table definition -
>
> sqlite> drop table edges;
> sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
> child)) without rowid;
> sqlite> insert into edges select null, 1;
> Error: NOT NULL constraint failed: edges.parent
> sqlite>
>
> Why do I get this error?
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Defect: Redundant CTE table materialization gives wrong answer.

2018-01-18 Thread Simon Slavin
On 19 Jan 2018, at 5:04am, petern  wrote:

> WITH flips(s) AS (VALUES (random()), (random()), (random()))
> SELECT * FROM flips;
> 
> s
> 0.760850821621716
> 0.9941047639586031
> 0.48273737309500575

Are you expecting the three values to be the same ?  What about

INSERT INTO MyTable VAKUES (random(), random(), random())

?  Would you expect those three values to be the same ?

If you think of random() as an external function, do you think of it as marked 
SQLITE_DETERMINISTIC as defined in the following page ?



Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] "Error: NOT NULL constraint failed ..." when no such constraint exists

2018-01-18 Thread Shane Dev
Hello,

The following SQL works as I expect -

sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
child));
sqlite> insert into edges select null, 1;
sqlite> select * from edges;
parent  child
1
sqlite>

but if I remove the superfluous rowid column from the table definition -

sqlite> drop table edges;
sqlite> CREATE TABLE edges(parent int, child int, primary key(parent,
child)) without rowid;
sqlite> insert into edges select null, 1;
Error: NOT NULL constraint failed: edges.parent
sqlite>

Why do I get this error?
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Defect: Redundant CTE table materialization gives wrong answer.

2018-01-18 Thread Shane Dev
Good question

On 19 January 2018 at 06:04, petern  wrote:

> WITH flips(s) AS (VALUES (random()>0), (random()>0), (random()>0))
> SELECT sum(s),(SELECT sum(s) FROM flips) FROM flips;
> sum(s),"(SELECT sum(s) FROM flips)"
> 1,3
> --Expected output is 1,1.
>
> Why isn't the constant notional table table [flips] materialized just once
> per CTE?
>
> FYI.  PostgreSQL 9.6 materializes [flips] exactly once per CTE:
>
> WITH flips(s) AS (VALUES (random()), (random()), (random()))
> SELECT sum(s),(SELECT sum(s) FROM flips) FROM flips;
> sum sum
> 1.503042308613658 1.503042308613658
>
> Also FYI, double checked:  random() is indeed run 3 times by PostgreSQL.
>
> WITH flips(s) AS (VALUES (random()), (random()), (random()))
> SELECT * FROM flips;
>
> s
> 0.760850821621716
> 0.9941047639586031
> 0.48273737309500575
>
> Peter
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Can a record count column be added to this random hierarchical view?

2018-01-18 Thread petern
>I was hoping to find a way to force the query planner to evaluate
v_random_hierarchy only once.

There is a way with a CTE if the defect I just reported is fixed.
Replying to my bug report with your vote to fix the problem can help.

I think PostgreSQL, the model for SQLite, has it correct.
Once computed, a named CTE table should be constant until the end of the
statement compilation boundary.

Peter


On Thu, Jan 18, 2018 at 9:26 PM, Shane Dev  wrote:

> On 19 January 2018 at 05:41, petern  wrote:
>
> > Were you expecting random() to return the same sequence when the view
> > materialized again in the subquery?
> >
>
> I was hoping to find a way to force the query planner to evaluate
> v_random_hierarchy
> only once. Perhaps this is not possible since it uses the non-deterministic
> random() function
>
>
> > Your ultimate query works fine when the random view is materialized once
> > into a table.
>
>
> Correct, but I work hoping to avoid the I/O penalty of this strategy when
> generating a large hierarchy
>
>
> >
> >
> FYI. as demonstrated above, to also count the NULL parent, use "IS" instead
> > of "=".
> >
> >
> I didn't know IS also worked with integers, good tip.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Can a record count column be added to this random hierarchical view?

2018-01-18 Thread Shane Dev
On 19 January 2018 at 05:41, petern  wrote:

> Were you expecting random() to return the same sequence when the view
> materialized again in the subquery?
>

I was hoping to find a way to force the query planner to evaluate
v_random_hierarchy
only once. Perhaps this is not possible since it uses the non-deterministic
random() function


> Your ultimate query works fine when the random view is materialized once
> into a table.


Correct, but I work hoping to avoid the I/O penalty of this strategy when
generating a large hierarchy


>
>
FYI. as demonstrated above, to also count the NULL parent, use "IS" instead
> of "=".
>
>
I didn't know IS also worked with integers, good tip.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Defect: Redundant CTE table materialization gives wrong answer.

2018-01-18 Thread petern
WITH flips(s) AS (VALUES (random()>0), (random()>0), (random()>0))
SELECT sum(s),(SELECT sum(s) FROM flips) FROM flips;
sum(s),"(SELECT sum(s) FROM flips)"
1,3
--Expected output is 1,1.

Why isn't the constant notional table table [flips] materialized just once
per CTE?

FYI.  PostgreSQL 9.6 materializes [flips] exactly once per CTE:

WITH flips(s) AS (VALUES (random()), (random()), (random()))
SELECT sum(s),(SELECT sum(s) FROM flips) FROM flips;
sum sum
1.503042308613658 1.503042308613658

Also FYI, double checked:  random() is indeed run 3 times by PostgreSQL.

WITH flips(s) AS (VALUES (random()), (random()), (random()))
SELECT * FROM flips;

s
0.760850821621716
0.9941047639586031
0.48273737309500575

Peter
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Can a record count column be added to this random hierarchical view?

2018-01-18 Thread petern
Were you expecting random() to return the same sequence when the view
materialized again in the subquery?
Your ultimate query works fine when the random view is materialized once
into a table.

CREATE TABLE v_random_hierarchy AS
WITH r(parent, child) as (select null, 1 union all select
abs(random())%child+1, child+1 from r)
SELECT * FROM r LIMIT 5;

select v1.parent, v1.child,
  (select count(child) from v_random_hierarchy as v2 where v2.parent IS
v1.parent) as number_children_of_parent
from v_random_hierarchy as v1;
parent,child,number_children_of_parent
,1,1
1,2,3
1,3,3
3,4,1
1,5,3

FYI. as demonstrated above, to also count the NULL parent, use "IS" instead
of "=".

Some style suggestions.  Uppercase SQL keywords, linebreaks, and
indentation will make your SQL far more readable and easier to see what's
wrong.

SELECT  
  ,
   ...
FROM 
  
  ...
WHERE 
  

Peter


On Thu, Jan 18, 2018 at 2:18 PM, Shane Dev  wrote:

> Hello,
>
> Here is a view which assigns randomly chosen parents to a sequence of
> children -
>
> CREATE VIEW v_random_hierarchy as with r(parent, child) as (select null, 1
> union all select abs(random())%child+1, child+1 from r) select * from r
> limit 5;
>
> sqlite> select * from v_random_hierarchy;
> parent  child
> 1
> 1   2
> 1   3
> 1   4
> 4   5
>
> Can a column be added to this view which counts the number of children for
> each parent?
>
> Here is my failed attempt -
>
> sqlite> select v1.parent, v1.child, (select count(*) from
> v_random_hierarchy as v2 where v2.parent=v1.parent) as
> number_children_of_parent from v_random_hierarchy as v1;
> parent  child   number_children_of_parent
> 1   0
> 1   2   3
> 2   3   0
> 3   4   0
> 3   5   1
>
> in this case, it should be -
>
> parent  child   number_children_of_parent
> 1   1
> 1   2   1
> 2   3   1
> 3   4   2
> 3   5   2
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Python program to convert CSV to sqlite

2018-01-18 Thread Dingyuan Wang
Hi,

I've also written a similar script to convert csv to sql (SQLite and
PostgreSQL compatible). This script doesn't require fancy external
libraries, and will correctly identify data types.



2018-01-18 15:33, Simon Slavin:
> csvs-to-sqlite
> 
> 
> 
> Simple command line makes simple SQLite table definitions.  Or you can get 
> fancy with the command line and it will create tables linked with foreign 
> keys, or add a column with the filename to a table, or do other things.
> 
> I have not tried this program myself, I just thought it might be useful for 
> other people.
> 
> For those not familiar with GitHub, there’s a "clone or download" button 
> which lets you just download the project (source code) without having to 
> install any special client on your computer.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_column_name with alias

2018-01-18 Thread J Decker
There is sqlite3_column_origin_name( stmt, n ) ; is that also the alias?
instead of sqlite3_column_name(stmt,n );
or does there need to be sqlite3_column_original that really returns the
not alias?

On Mon, Jan 8, 2018 at 3:21 AM, Bart Smissaert 
wrote:

> > As you can see
>
> Should read:
> As you said
>
> RBS
>
> On Mon, Jan 8, 2018 at 11:17 AM, Bart Smissaert 
> wrote:
>
> > > Best is to define type on output
> >
> > Yes, looks that way. As you can see the alias can help, eg:
> > select max(integer_date_column) as integer_date_column
> >
> > what I also added is coding to pick up the intended formatting from the
> > alias, not from the column but by just specifying the output datatype:
> > select max(integer_date) as int_date
> >
> > All this is only needed if sqlite3_column_decltype produces null.
> > Looks kind of sorted now, thanks.
> >
> >
> > RBS
> >
> > On Mon, Jan 8, 2018 at 10:29 AM, R Smith  wrote:
> >
> >>
> >> On 2018/01/08 12:00 AM, Bart Smissaert wrote:
> >>
> >>> OK, I can see your point and I am sure you are right.
> >>> All this has to do with the question (discussed not long ago) how one
> >>> should know how the output from a statement should be handled by
> >>> an application receiving the data. In my case that application is
> Excel.
> >>> Take for example an integer. Excel need to know if this integer should
> >>> be formatted as a plain integer or as an Excel date. When the user
> moves
> >>> data to SQLite (from the sheet or from eg a text file) he/she will tell
> >>> how
> >>> this data should be stored. In this case the data type will be INTEGER
> or
> >>> INT_DATE. This information will be stored in SQLite_master. The
> question
> >>> is now how to match up the columns of the output with these data types
> in
> >>> SQLite_master. I have a simple system for this with sqlite3_column_type
> >>> and sqlite3_column_decltype etc. but this is just not fool proof. It
> >>> looks
> >>> I will need to think up some more elaborate system. One option is that
> >>> the
> >>> user
> >>> just tells (along with the statement) what the output formatting should
> >>> be,
> >>> but that would be cumbersome.
> >>>
> >>
> >> Yeah, that is a tough one.
> >> Even in other databases you won't be able to achieve this. "Type" is
> used
> >> mostly as an internal specification and sometimes output formatter.
> >> Preserving the original column type through query abstraction to the
> output
> >> is simply not possible, especially if that type is homemade.  You are
> >> interested in an output type, it should be specified within the output.
> >>
> >> Best is to define type on output. You might decrease cumbersomeness a
> lot
> >> if the list of types is small, using perhaps just a one or two character
> >> type identifier, like this:
> >>
> >> SELECT  foo AS Col1_i,   bar AS Col2_d etc.
> >> (Where i denotes INT and d is INT-DATE etc.)
> >>
> >> If you expect the list of types to grow in future, pick slightly longer
> >> identifiers.
> >>
> >> This of course would not be feasible if you (as in your collective devs)
> >> do not control the resulting queries, like if users can make queries on
> the
> >> fly
> >>
> >> Another method is keeping a table with names and types that the
> >> application can read. Add to it all the names used for output and the
> types
> >> implied. Say it contains the name Col1 with Type INT then whenever your
> >> application reads a query where the column name is Col1 (via origin or
> >> alias) then it knows that is an INT. This is the saddest method and
> should
> >> be avoided if possible.
> >>
> >> Good luck!
> >>
> >> Ryan
> >>
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@mailinglists.sqlite.org
> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Can a record count column be added to this random hierarchical view?

2018-01-18 Thread Shane Dev
Hello,

Here is a view which assigns randomly chosen parents to a sequence of
children -

CREATE VIEW v_random_hierarchy as with r(parent, child) as (select null, 1
union all select abs(random())%child+1, child+1 from r) select * from r
limit 5;

sqlite> select * from v_random_hierarchy;
parent  child
1
1   2
1   3
1   4
4   5

Can a column be added to this view which counts the number of children for
each parent?

Here is my failed attempt -

sqlite> select v1.parent, v1.child, (select count(*) from
v_random_hierarchy as v2 where v2.parent=v1.parent) as
number_children_of_parent from v_random_hierarchy as v1;
parent  child   number_children_of_parent
1   0
1   2   3
2   3   0
3   4   0
3   5   1

in this case, it should be -

parent  child   number_children_of_parent
1   1
1   2   1
2   3   1
3   4   2
3   5   2
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Speed issue of SELECT in my application

2018-01-18 Thread Eduardo Morras
On Wed, 17 Jan 2018 17:59:22 +
Simon Slavin  wrote:

> Folks.  Nick published a figure of 60ms for his search.  That?s not
> unusually slow.  There was no request to shave every last millisecond
> off that figure.  There wasn?t even a statement that it was too
> slow.  No need to scare the guy by mentioning twenty complications of
> SQLite which may be irrelevant.

... I read "Speed issue..." in Subject, but you're rigth,
60ms is fast enough on common deployment configuration.

> If Nick needs to save more time he?ll need to post more details of
> what he?s doing.
> 
> Simon.

P.S. I sent the mail from my current contractor mail, sorry for that.

---   ---
Eduardo Morras 
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Speed issue of SELECT in my application

2018-01-18 Thread Jens Alfke


> On Jan 17, 2018, at 6:16 PM, Nick  wrote:
> 
> Jens, I totally agree with your opinion of profile. I have tried to find some
> useful tools to profile applications using sqlite

A CPU profiler works on arbitrary code, so it shouldn’t need to know anything 
about SQLite. (Although some profilers rely on instrumenting the code, so you 
have to compile with some special compiler flag, which means you’d need to 
compile sqlite3.c as part of your program.)

> So, what is the tool you mentioned such as ‘sample’ tool?

‘sample’ is Mac-specific. I don’t know what kind of CPU profiling tools exist 
for Android; that’s off-topic here but I’m sure there’s a lot of Android info 
out there…

—Jens

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] IN clause

2018-01-18 Thread petern
Of the IN clause under PostgreSQL 9.6 (sqlfiddle.com), both syntax variants
return true without error:

SELECT (1,2) IN ((1,2),(3,4));
SELECT (1,2) IN (VALUES (1,2),(3,4));

A clone of PostgreSQL would also have optional VALUES table alias and
column name specifiers as observed earlier.



On Thu, Jan 18, 2018 at 11:59 AM, petern 
wrote:

> >I am open to enhancing the syntax here, but not right now because we
> are trying to get the 3.22.0 release out - this would need to be
> during the next cycle.  Also, I'll need to check to see what
> PostgreSQL does first, and emulate them.
>
> Yes please!  Thank you for getting around to this:
>
> (VALUES ) AS  ()
>
> In PostgreSQL 9.6 (sqlfiddle.com), apparently where '' is
> specified, 'AS' and '()' are optional.
>
> Reference: https://www.postgresql.org/docs/9.5/static/queries-values.html
>
> ---quote---
>
> By default, PostgreSQL assigns the names column1, column2, etc. to the
> columns of a VALUES table. The column names are not specified by the SQL
> standard and different database systems do it differently, so it's usually
> better to override the default names with a table alias list, like this:
>
> => SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (3, 'three')) AS t 
> (num,letter);
>  num | letter
> -+
>1 | one
>2 | two
>3 | three
> (3 rows)
>
> -
>
> Peter
>
>
>
> On Thu, Jan 18, 2018 at 10:58 AM, Richard Hipp  wrote:
>
>> On 1/18/18, Szyk Cech  wrote:
>> > Hi
>> >
>> > My concern is about a Primary Key in two columns (integer values) which
>> > I want type explicitly in my query (like in example "Not works"). My
>> > example only shows problem and it is not real case (however database is
>> > real).
>> >
>> > Not works:
>> >
>> > select * from card where (statNumber, question) in ((2211, 'psuć się'),
>> > (2542, 'kontynuować'), (1449, 'wymrzeć'))
>>
>> Try it this way:
>>
>>   SELECT * FROM card WHERE (statNumber,question) IN
>> (VALUES(2211,'psuc sei'),(2542,'kontynuowac'), (1449,'wymrzec'));
>>
>> I am open to enhancing the syntax here, but not right now because we
>> are trying to get the 3.22.0 release out - this would need to be
>> during the next cycle.  Also, I'll need to check to see what
>> PostgreSQL does first, and emulate them.
>>
>> >
>> > Works:
>> >
>> > select * from card where (statNumber, question) in (select statNumber,
>> > question from card)
>> >
>> > Why?
>> >
>> > thanks and best regards
>> >
>> > Szyk Cech
>> >
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@mailinglists.sqlite.org
>> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>> >
>>
>>
>> --
>> D. Richard Hipp
>> d...@sqlite.org
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] IN clause

2018-01-18 Thread petern
>I am open to enhancing the syntax here, but not right now because we
are trying to get the 3.22.0 release out - this would need to be
during the next cycle.  Also, I'll need to check to see what
PostgreSQL does first, and emulate them.

Yes please!  Thank you for getting around to this:

(VALUES ) AS  ()

In PostgreSQL 9.6 (sqlfiddle.com), apparently where '' is
specified, 'AS' and '()' are optional.

Reference: https://www.postgresql.org/docs/9.5/static/queries-values.html

---quote---

By default, PostgreSQL assigns the names column1, column2, etc. to the
columns of a VALUES table. The column names are not specified by the SQL
standard and different database systems do it differently, so it's usually
better to override the default names with a table alias list, like this:

=> SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (3, 'three')) AS t
(num,letter);
 num | letter
-+
   1 | one
   2 | two
   3 | three
(3 rows)

-

Peter



On Thu, Jan 18, 2018 at 10:58 AM, Richard Hipp  wrote:

> On 1/18/18, Szyk Cech  wrote:
> > Hi
> >
> > My concern is about a Primary Key in two columns (integer values) which
> > I want type explicitly in my query (like in example "Not works"). My
> > example only shows problem and it is not real case (however database is
> > real).
> >
> > Not works:
> >
> > select * from card where (statNumber, question) in ((2211, 'psuć się'),
> > (2542, 'kontynuować'), (1449, 'wymrzeć'))
>
> Try it this way:
>
>   SELECT * FROM card WHERE (statNumber,question) IN
> (VALUES(2211,'psuc sei'),(2542,'kontynuowac'), (1449,'wymrzec'));
>
> I am open to enhancing the syntax here, but not right now because we
> are trying to get the 3.22.0 release out - this would need to be
> during the next cycle.  Also, I'll need to check to see what
> PostgreSQL does first, and emulate them.
>
> >
> > Works:
> >
> > select * from card where (statNumber, question) in (select statNumber,
> > question from card)
> >
> > Why?
> >
> > thanks and best regards
> >
> > Szyk Cech
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] IN clause

2018-01-18 Thread Szyk Cech

W dniu 18.01.2018 o 19:58, Richard Hipp pisze:

Try it this way:

   SELECT * FROM card WHERE (statNumber,question) IN
 (VALUES(2211,'psuc sei'),(2542,'kontynuowac'), (1449,'wymrzec'));

Thanks. This works (with spelling fixes).


I am open to enhancing the syntax here, but not right now because we
are trying to get the 3.22.0 release out - this would need to be
during the next cycle.  Also, I'll need to check to see what
PostgreSQL does first, and emulate them.
I not see any needs to enhancing syntax - I was just not aware of this 
syntax...

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] IN clause

2018-01-18 Thread Richard Hipp
On 1/18/18, Szyk Cech  wrote:
> Hi
>
> My concern is about a Primary Key in two columns (integer values) which
> I want type explicitly in my query (like in example "Not works"). My
> example only shows problem and it is not real case (however database is
> real).
>
> Not works:
>
> select * from card where (statNumber, question) in ((2211, 'psuć się'),
> (2542, 'kontynuować'), (1449, 'wymrzeć'))

Try it this way:

  SELECT * FROM card WHERE (statNumber,question) IN
(VALUES(2211,'psuc sei'),(2542,'kontynuowac'), (1449,'wymrzec'));

I am open to enhancing the syntax here, but not right now because we
are trying to get the 3.22.0 release out - this would need to be
during the next cycle.  Also, I'll need to check to see what
PostgreSQL does first, and emulate them.

>
> Works:
>
> select * from card where (statNumber, question) in (select statNumber,
> question from card)
>
> Why?
>
> thanks and best regards
>
> Szyk Cech
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] IN clause

2018-01-18 Thread Szyk Cech

Hi

My concern is about a Primary Key in two columns (integer values) which 
I want type explicitly in my query (like in example "Not works"). My 
example only shows problem and it is not real case (however database is 
real).


Not works:

select * from card where (statNumber, question) in ((2211, 'psuć się'), 
(2542, 'kontynuować'), (1449, 'wymrzeć'))


Works:

select * from card where (statNumber, question) in (select statNumber, 
question from card)


Why?

thanks and best regards

Szyk Cech

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Typo on https://www.sqlite.org/draft/c3ref/c_trace.html

2018-01-18 Thread Olivier Mascia
If I'm not mistaken, on https://www.sqlite.org/draft/c3ref/c_trace.html 
, the sentence "The third 
argument to sqlite3_trace_v2() is an OR-ed combination..." should read "The 
second argument...", according to 
https://www.sqlite.org/draft/c3ref/trace_v2.html 
.

:)
-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite V3.21.0 debug symbols

2018-01-18 Thread Ryan Robinson
I'm writing an application that is using sqlite in a multi-threaded
application and I am experiencing an app crash with an access violation
(exception 0xC005) in the sqlite3 dll.  I configured sqlite with
SQLITE_CONFIG_MULTITHREAD, and I'm using my own mutexes to synchronize
concurrent access to the sqlite api.  I am trying to debug the crash dump
files, but because I don't have access to the symbol files for sqlite to
effectively get any value from them.

 

Does someone have a copy of the debug symbol file (pdb) for version 3.21.0
that they could send to me so I can see where the problem lies?

 

Ryan Robinson

Software Engineer

 

PH: +1 (330) 533-6683 x:112

CELL: +1 (513) 403-6507

FAX: +1 (330) 533-7293

 

IES Systems Inc.

464 Lisbon St.

Canfield, OH 44406

 

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.22.0 coming soon

2018-01-18 Thread curmudgeon
8 d. Omit unused LEFT JOINs even if they are not the right-most joins of a
query. 

Thanks for fixing this. Working fine for me so far.



--
Sent from: http://sqlite.1065341.n5.nabble.com/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] c program which performs the same function as the SQLite shell command ".import"

2018-01-18 Thread Jean-Luc Hainaut


True, "some" parts of "some" games can be implemented with DB 
technology, particularly matrix- and graph-based ones. Not only for fast 
storage and retrieval of game data, but, more interestingly, for 
implementing complex computation algorithms through SQL queries, that 
may prove faster than their expression in standard languages.


In a series of case studies I have developed to show that many problems 
can be elegantly and efficiently solved by a carefully designed DB 
schema + SQL queries, I have included three applications close to the 
game domain: text-based adventure games, Conway's cellular automata (aka 
"Game of life") and shortest path finding.


The text of these studies (all implemented in SQLite) are available on 
https://projects.info.unamur.be/~dbm/mediawiki/index.php/LIBD:Outils#SQLfast 
.


- text-based adventure games: download document "Case study: The book of 
which you are the hero"
- Conway's cellular automata: download document "Case study: Conway's 
Game of Life"
- shortest path problem:  download document "Case study: Path finders, 
rovers and Ariadne's thread".


Just my three cents!

J-L Hainaut


  Any practical realtime video game using SQLite is probably
doing so only to save and restore the game board between games.

and perhaps calculating the initial "maze" or other non time sensitive data
processing


Even a cursory look into production
quality video game development will tell you that a database is the wrong
technology to base a video game engine on.

Fully agree, I would use another library for that part.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Speed issue of SELECT in my application

2018-01-18 Thread Bart Smissaert
No worries, I had figured you meant this applied to multiple read
statements.

RBS

On Thu, Jan 18, 2018 at 9:24 AM, R Smith  wrote:

>
> On 2018/01/17 4:26 PM, Bart Smissaert wrote:
>
>> 3. Start a transaction and hold the DB read locks for the duration of
>>>
>> your application (again, if it won't need writing)
>>
>> I had a look at this but couldn't see a speed increase.
>> This was for a single statement, so that is repeated (in a
>> loop) sqlite3_step, sqlite3_column_xxx etc.
>> In what situation should this increase read speed?
>>
>
> Apologies, should have been more clear - this will increase the speed
> between queries FOR consecutive queries, not so much inside any single
> query.
>
> To see why is easy, the loop amounts to either:
>
> // Slower loop:
> for each q in queries do {
>   Acquire read lock;
>   Prepare;
>   Loop query results;
>   Release readlock;
> }
>
> - OR -
>
> // Faster loop:
> Start Transaction;
> Acquire read lock;
> for each q in queries do {
>   Prepare;
>   Loop query results;
> }
> Release readlock;
> End Transaction;
>
> (This is very simplified and not technically 100% accurate how SQLite does
> it, but you get the idea).
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Speed issue of SELECT in my application

2018-01-18 Thread R Smith


On 2018/01/17 4:26 PM, Bart Smissaert wrote:

3. Start a transaction and hold the DB read locks for the duration of

your application (again, if it won't need writing)

I had a look at this but couldn't see a speed increase.
This was for a single statement, so that is repeated (in a
loop) sqlite3_step, sqlite3_column_xxx etc.
In what situation should this increase read speed?


Apologies, should have been more clear - this will increase the speed 
between queries FOR consecutive queries, not so much inside any single 
query.


To see why is easy, the loop amounts to either:

// Slower loop:
for each q in queries do {
  Acquire read lock;
  Prepare;
  Loop query results;
  Release readlock;
}

- OR -

// Faster loop:
Start Transaction;
Acquire read lock;
for each q in queries do {
  Prepare;
  Loop query results;
}
Release readlock;
End Transaction;

(This is very simplified and not technically 100% accurate how SQLite 
does it, but you get the idea).




___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] c program which performs the same function as the SQLite shell command ".import"

2018-01-18 Thread R Smith

To add some thoughts to Peter's discussion...

In game design speed is definitely of the utmost importance since a 
visual game is basically a UI that is time-sensitive (unlike nearly any 
other type of software). It's usual to implement some slow data 
mechanism, typically an internet service DB for things like profile and 
history, then an internet comms module (multiplayer etc.), normal SQLite 
style DB for local data and on top of that a quick-lookup cache DB for 
anything that the UI will need rapidly.


The reason the cache needs to exist is that DB's are slow in game terms. 
They spend their time and 50% of their code to ensure your transaction 
is SAFE and ACCURATE rather than Quick (which is a MUST for any normal 
application, but we really don't care about much in games). A lookup 
list or pointer dictionary is a far better way to access your speedy 
info - but not the best way to access ALL your info, so the best system 
usually turns out to be some hybrid setup.


Sadly there is no off-the-shelf guaranteed best hybridization (that I 
know of), you will have to use the best way that is memory and space 
efficient, and where that falls short in retrieving timing, cache the 
items that are needed quicker. It's a process. We usually start out with 
a good DB engine (SQLite always in our case) and a good caching engine 
(which we route through the same dispatcher so that development of the 
downstream parts are oblivious and unaffected by how the data arrives), 
and then move things over between these systems as needed.


One accidental side-effect of using sqlite as much as possible is that 
over the last ~15 years games/apps using sqlite have gotten faster by no 
effort of ours, but by the mere virtue of sqlite code itself doubling in 
speed every 10 years or so. That's an amazing benefit.




On 2018/01/18 2:41 AM, petern wrote:

FYI. 2D/3D game usability is extremely sensitive to response time.  A stock
in-memory SQLite database with plenty of memory is still too slow for
tracking the state of an interactive graphical game especially on portable
grade cpus.  Any practical realtime video game using SQLite is probably
doing so only to save and restore the game board between games.   The
actual game time logic and player movements are entirely coordinated by a
custom engine which interfaces directly between highly optimized in-memory
data structures and the graphics library.   The equivalent loop in SQLite
would be a statement that has already been prepared and is receiving rows
from the database without interruption for the entire game duration.
Without heavy rework of the whole database concept, that simply can't work
because a statement's results are isolated from subsequent model changes
while result rows are being read.   Even a cursory look into production
quality video game development will tell you that a database is the wrong
technology to base a video game engine on.


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users