Re: [sqlite] sqlite3_changes() using 64 bit counters?

2016-12-09 Thread Gelin Yan
On Fri, Dec 9, 2016 at 10:09 PM, Detlef Golze  wrote:

> The maximal number of rows is 1e+13 ().
>
> I do have tables with more than 2^32 rows. Of course one should avoid
> making that large transactions, but it is possible.
>
> Regards,
> dg.
>
>
>
  It is my first time to know sqlite is used to store 2^32 rows data.

Regards

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


Re: [sqlite] I keep getting seg faults building my database using python sqlite3

2016-12-09 Thread Kevin O'Gorman
It wasn't memory.  Or at least nothing obvious.  I ran Memtest86+ 5.01 in
SMP mode for 3 full passes (about 10 hours) with no errors.

On reflection, it didn't seem likely to be a kernel freeze anyway.  It
wasn't that the light on the keyboard was unresponsive, or not just that,
but that all the lights were off including the mouse laser.  The sort of
general "on" light in the tower was on, and the power supply fan was going,
but that's all.  I now wish I had looked at the motherboard readouts.
Anyway, that suggested a power distribution or power supply problem to me.
I just don't know how to bifurcate between the power supply and something
on the mobo USB interface.  And it hasn't happened again.

On Wed, Dec 7, 2016 at 5:18 PM, Kevin O'Gorman 
wrote:

> Good feedback.  I haven't done a memory check on that machine in a
> while
>
> Next on my list.
>
> On Sun, Dec 4, 2016 at 11:25 AM, Keith Medcalf 
> wrote:
>
>>
>> If pressing the CAPS LOCK or NUM LOCK keys on the keyboard does not
>> toggle the light on the keyboard then you have lost the all interrupt
>> processing since those keypresses have to be processed by the kernel mode
>> keyboard driver toggling the internal state of the keyboard driver, and
>> then the kernel driver sends output to the keyboard to change the status
>> LEDs.  Typically (all Operating Systems) this means you have suffered a
>> complete kernel crash (or halt) and the system is not running.
>>
>> Since the system must be running in order to output indicator status, all
>> indicators will stay "stuck" in their last known position (hold output).
>>
>> Only a power-cycle (or hardware reset -- assuming the RESET is a hardware
>> reset and not just a request to reset which will be ignored) triggering a
>> reboot will restart the system.
>>
>> The most frequent cause is a Parity Check.  Or in these latter days of
>> not having ECC or even Parity checked memory, just an undetected memory
>> fault which will cause random AHTBL.
>>
>> > -Original Message-
>> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org
>> ]
>> > On Behalf Of Kevin O'Gorman
>> > Sent: Sunday, 4 December, 2016 09:21
>> > To: SQLite mailing list
>> > Subject: Re: [sqlite] I keep getting seg faults building my database
>> using
>> > python sqlite3
>> >
>> > Well, the i7 system failed again, but this time it was quite different.
>> > And peculiar.
>> > The system wasn't doing anything, but it should have been.  So I tried
>> > something. It didn't matter what, because I could not get the mouse or
>> > keyboard to work -- it was like they weren't plugged in.  Really like
>> it,
>> > because the caps lock light wasn't on, nor was the laser light visible
>> in
>> > the mouse.  Even when I changed mouse, keyboard and USB slot.  I
>> couldn't
>> > get in with SSH from elsewhere either.  But the computer's "I'm running"
>> > light was on.
>> > So I'm suspecting a partial power failure.  I don't know enough about
>> > mobos
>> > and USB to diagnose whether the problem was on the mobo or the power
>> > supply.
>> >
>> > Creepty.  I had to do a hard reset  to get thing going again, and it's
>> > been
>> > running fine for a day now.
>> >
>> > On Mon, Nov 21, 2016 at 9:51 AM, Kevin O'Gorman <
>> kevinogorm...@gmail.com>
>> > wrote:
>> >
>> > > On Mon, Nov 21, 2016 at 9:41 AM, Roger Binns 
>> > > wrote:
>> > >
>> > >> On 19/11/16 08:08, Kevin O'Gorman wrote:
>> > >> > System with problems: Running Xubuntu Linux 16.04.1, Python 3.5.2.
>> > >> [...]
>> > >> > System without this problem: Running Ubuntu Linux 14.04.5, Python
>> > 3.4.3.
>> > >>
>> > >> You are good on Python versions then.  My remaining recommendation is
>> > to
>> > >> make the process that does SQLite be a child process (ie no making
>> its
>> > >> own children).  That will eliminate an entire class of potential
>> > >> problems, although it appears unlikely you are experiencing any of
>> > them.
>> > >>
>> > >> The final option is to run the process under valgrind.  That will
>> > >> definitively show the cause.  Do note however that you may want to
>> > >> change some of the default options since you have nice big systems.
>> > For
>> > >> example I like to set --freelist-vol and related to very big numbers
>> > >> (several gigabytes) which ensures that freed memory is not reused
>> for a
>> > >> long time.  You could also set the valgrind option so that only one
>> > >> thread is allowed - it will catch inadvertent threading you may note
>> be
>> > >> aware of.
>> > >>
>> > >> Roger
>> > >>
>> > >
>> > > Thanks for that.  I may do the valgrind thing -- it sounds useful.
>> But
>> > > just to add
>> > > to my annoyance about this whole things, I've been having both systems
>> > > running
>> > > for a couple of days now with no problems or interruptions.  Remember,
>> > the
>> > > i7 system was failing after 2 hours at most.  I did tweak the code a
>> > > little, 

Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Keith Medcalf

That would be my estimation.

Of course, you could also try setting the busy timeout using the pragma:

https://www.sqlite.org/pragma.html#pragma_busy_timeout

as soon as you open the connection.

On Friday, 9 December, 2016 15:17 Jay Weinstein  said:

> Hi Keith,
> 
> Made sure the timeouts are set to 1000 ms for both C and java
> implementations.  Same error.   So, you are suggesting this is an issue
> with the guys who wrote the driver for sqlite?   Not sure who these guys
> are.
> 
> On Fri, Dec 9, 2016 at 11:22 AM, Keith Medcalf 
> wrote:
> 
> >
> > Sounds like a java problem with the java interface, not an SQLite
> > problem.  Two observations however:
> >
> > 1)  With the C API you set the busy timeout to 1000 ms but with the java
> > api you set it to 100 ms
> > 2)  With the C API you set the busy timeout to the integer 1000 yet in
> the
> > java api you set it to the string "100"
> >
> > In any case, the problem is in the Java API.  You have demonstrated that
> > the problem is not caused by SQLite itself ...
> >
> > Perhaps a chat with the Java wrapper developers is in order.
> >
> >
> > > -Original Message-
> > > From: sqlite-users [mailto:sqlite-users-
> boun...@mailinglists.sqlite.org]
> > > On Behalf Of Jay Weinstein
> > > Sent: Friday, 9 December, 2016 11:50
> > > To: SQLite mailing list
> > > Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> > > database file is locked (database is locked)
> > >
> > > When I run the two C programs using
> > >
> > >   rc = sqlite3_busy_timeout(db, 1000);
> > >   if ( rc != SQLITE_OK ) {
> > > fprintf(stderr, "SQL error: sqlite3_busy_timeout
> > > failed.\n");
> > > exit(0);
> > >   }
> > >
> > > everything works perfectly.  No sqlite busy erros or table locked.
> > >
> > > But, when I to do this using a java app using the following the code
> > > doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> > > working as I anticipated --  see below.   Can you advise?
> > >
> > > Thanks, Jay
> > >
> > > Class.forName("org.sqlite.JDBC");
> > > String s = "jdbc:sqlite:"+db;
> > >
> > > config = new SQLiteConfig();
> > > config.setBusyTimeout("100");
> > > conn = DriverManager.getConnection(s, config.toProperties());
> > > conn.setAutoCommit(false);
> > > stmt = conn.createStatement();
> > >
> > > On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin 
> > wrote:
> > >
> > > >
> > > > On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:
> > > >
> > > > > Is it correct to say busy timeout will work for two separate
> > processes
> > > > and
> > > > > I don't have use fork in C/C++ or ProcessBuilder in java to
> execute
> > > one
> > > > as
> > > > > a child and a parent?
> > > >
> > > > The timeout setting is attached to the database connection.  If you
> > > > execute _open() twice you need to set it once for each connection.
> > > >
> > > > 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
> >
> >
> >
> > ___
> > 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


Re: [sqlite] Speaking of Ruby & Sqlite...a weekend oddity for someone

2016-12-09 Thread Roger Binns
On 09/12/16 14:09, Don V Nielsen wrote:
> However,
> it fails using the sqlite3 gem. The specific exception is "in
> 'initialize': near "with": syntax error

That will be a SQLite version issue - older SQLite's didn't support
with.  While you made some effort around versions, whatever is happening
there is an older library is actually used.

You can use this to find out exactly what library version is used:

  SELECT sqlite_version(), sqlite_source_id();

Also this will give a list of compilation options, to verify:

  PRAGMA compile_options;

Roger




signature.asc
Description: OpenPGP digital signature
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Interactive shell tab completion for queries

2016-12-09 Thread Roger Binns
On 09/12/16 14:18, Dominique Devienne wrote:
> How did you implement completion in APSW?

[Long answer] at bottom.

You get a callback from the readline or equivalent library when
completion is needed, with it expecting you to provide 0 or more
completions.  You can get the input line, the current token within that
line, and the beginning and end position of the token.

If the line starts with dot, then dot command completion code is called
which is fairly straight forward.

Otherwise SQL completion is used.  There is a cache of database, table,
column, collation, function etc names that is discarded before beginning
input of a new line.  This is because the previously executed line could
have caused changes in any of those.

> Given that you typically don't know the context (tables) involved
> when writing the select clause for example, do you just propose any column
> or declared functions?

I have a branch with an unfinished SQL parser in it, intended to handle
incomplete SQL such as when doing completions.  (Most parser solutions
require complete input, or they error.  What you really want to know is
what kind of tokens or grammar constructs are allowed at the cursor
position.)  Anyway that is not used, yet.[SQLite parser]

I have some code that deals with pragmas since they have a known
construct.  For everything else I just return everything from the cache
that matches the token so far.  Trying to be intelligent without a deep
knowledge parser as described in the previous paragraph isn't really
feasible since virtually anything is allowed anywhere.  Heck try to work
out what isn't allowed immediately after SELECT!  (Allowed includes
database, table, column, function names, some operators, strings,
numbers etc)  Also ponder AS/aliases.

I do make sure that the completions match the case of what was provided
so far: eg SEL has SELECT as completion while sel has select.  Functions
also have the opening parentheses as part of the completion - eg count(
- and closing if no arguments like in random().

It does mean that hitting tab after typing SELECT gives a lot of
choices, but even a few characters is enough to have a short list of
candidates and feel natural.

> There even isn't a way to list declared functions, despite wishes for a
> pragma for it, so can't even
> provide completion in a generic way, especially with dynamically loaded
> modules.

That and lint mode are my regular whines.  I do have a table of builtin
functions in the completion code, but there is no possible way for third
party code to get the function list from SQLite.

[Long answer]
https://github.com/rogerbinns/apsw/blob/master/tools/shell.py#L2550

[SQLite parser] The SQLite parser can't be used either because it
expects complete input, and the rules have code attached that aren't
helpful for this.  I'd dearly love to stay in sync with the SQLite
grammar, but using the canonical grammar file isn't practical.

Roger



signature.asc
Description: OpenPGP digital signature
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Interactive shell tab completion for queries

2016-12-09 Thread Roger Binns
On 09/12/16 14:18, Dominique Devienne wrote:
> How did you implement completion in APSW?

[Long answer] at bottom.

You get a callback from the readline or equivalent library when
completion is needed, with it expecting you to provide 0 or more
completions.  You can get the input line, the current token within that
line, and the beginning and end position of the token.

If the line starts with dot, then dot command completion code is called
which is fairly straight forward.

Otherwise SQL completion is used.  There is a cache of database, table,
column, collation, function etc names that is discarded before beginning
input of a new line.  This is because the previously executed line could
have caused changes in any of those.

> Given that you typically don't know the context (tables) involved
> when writing the select clause for example, do you just propose any column
> or declared functions?

I have a branch with an unfinished SQL parser in it, intended to handle
incomplete SQL such as when doing completions.  (Most parser solutions
require complete input, or they error.  What you really want to know is
what kind of tokens or grammar constructs are allowed at the cursor
position.)  Anyway that is not used, yet.[SQLite parser]

I have some code that deals with pragmas since they have a known
construct.  For everything else I just return everything from the cache
that matches the token so far.  Trying to be intelligent without a deep
knowledge parser as described in the previous paragraph isn't really
feasible since virtually anything is allowed anywhere.  Heck try to work
out what isn't allowed immediately after SELECT!  (Allowed includes
database, table, column, function names, some operators, strings,
numbers etc)  Also ponder AS/aliases.

I do make sure that the completions match the case of what was provided
so far: eg SEL has SELECT as completion while sel has select.  Functions
also have the opening parentheses as part of the completion - eg count(
- and closing if no arguments like in random().

It does mean that hitting tab after typing SELECT gives a lot of
choices, but even a few characters is enough to have a short list of
candidates and feel natural.

> There even isn't a way to list declared functions, despite wishes for a
> pragma for it, so can't even
> provide completion in a generic way, especially with dynamically loaded
> modules.

That and lint mode are my regular whines.  I do have a table of builtin
functions in the completion code, but there is no possible way for third
party code to get the function list from SQLite.

[Long answer]
https://github.com/rogerbinns/apsw/blob/master/tools/shell.py#L2550

[SQLite parser] The SQLite parser can't be used either because it
expects complete input, and the rules have code attached that aren't
helpful for this.  I'd dearly love to stay in sync with the SQLite
grammar, but using the canonical grammar file isn't practical.

Roger



signature.asc
Description: OpenPGP digital signature
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Jay Weinstein
Hi Keith,

Made sure the timeouts are set to 1000 ms for both C and java
implementations.  Same error.   So, you are suggesting this is an issue
with the guys who wrote the driver for sqlite?   Not sure who these guys
are.

On Fri, Dec 9, 2016 at 11:22 AM, Keith Medcalf  wrote:

>
> Sounds like a java problem with the java interface, not an SQLite
> problem.  Two observations however:
>
> 1)  With the C API you set the busy timeout to 1000 ms but with the java
> api you set it to 100 ms
> 2)  With the C API you set the busy timeout to the integer 1000 yet in the
> java api you set it to the string "100"
>
> In any case, the problem is in the Java API.  You have demonstrated that
> the problem is not caused by SQLite itself ...
>
> Perhaps a chat with the Java wrapper developers is in order.
>
>
> > -Original Message-
> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> > On Behalf Of Jay Weinstein
> > Sent: Friday, 9 December, 2016 11:50
> > To: SQLite mailing list
> > Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> > database file is locked (database is locked)
> >
> > When I run the two C programs using
> >
> >   rc = sqlite3_busy_timeout(db, 1000);
> >   if ( rc != SQLITE_OK ) {
> > fprintf(stderr, "SQL error: sqlite3_busy_timeout
> > failed.\n");
> > exit(0);
> >   }
> >
> > everything works perfectly.  No sqlite busy erros or table locked.
> >
> > But, when I to do this using a java app using the following the code
> > doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> > working as I anticipated --  see below.   Can you advise?
> >
> > Thanks, Jay
> >
> > Class.forName("org.sqlite.JDBC");
> > String s = "jdbc:sqlite:"+db;
> >
> > config = new SQLiteConfig();
> > config.setBusyTimeout("100");
> > conn = DriverManager.getConnection(s, config.toProperties());
> > conn.setAutoCommit(false);
> > stmt = conn.createStatement();
> >
> > On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin 
> wrote:
> >
> > >
> > > On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:
> > >
> > > > Is it correct to say busy timeout will work for two separate
> processes
> > > and
> > > > I don't have use fork in C/C++ or ProcessBuilder in java to execute
> > one
> > > as
> > > > a child and a parent?
> > >
> > > The timeout setting is attached to the database connection.  If you
> > > execute _open() twice you need to set it once for each connection.
> > >
> > > 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
>
>
>
> ___
> 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] Interactive shell tab completion for queries

2016-12-09 Thread Dominique Devienne
On Fri, Dec 9, 2016 at 11:05 PM, Roger Binns  wrote:

> On 09/12/16 06:29, daveparr...@tutanota.com wrote:
> > I'm writing to ask if it is possible to have table completion for SQL
> queries in the interactive shell?
>
> The APSW shell (compatible with the SQLite one) has completion and
> colouring:
>
>   https://rogerbinns.github.io/apsw/shell.html
>
> Disclaimer: I am the author
>
> You don't need to know anything about python etc to use it.
>
> Implementing completion is also quite fun if anyone wants to discuss it
> further.
>

I'd love to have completion in the SQLite shell.
How did you implement completion in APSW?
Given that you typically don't know the context (tables) involved
when writing the select clause for example, do you just propose any column
or declared functions?
There even isn't a way to list declared functions, despite wishes for a
pragma for it, so can't even
provide completion in a generic way, especially with dynamically loaded
modules. --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Speaking of Ruby & Sqlite...a weekend oddity for someone

2016-12-09 Thread Don V Nielsen
I have an odd problem. It involves Linux & Windows, and it involves
the ruby gem sqlite3. I've already contacted that author/maintainer of
the gem, but I have not heard back in several weeks.

I have a sql file that contains a ctas statement that employs cte with
statements. On Windows, the sql executes fine using the sqlite3
command line tool "sqlite3 aan.db -init cte_with.sql". And it runs
fine calling sqlite3 via the sqlite3 gem:

db = SQLite3::Database.new File.join(FOLDER,'aan.db')
db.execute 'drop table if exists fullfilled;'
sql = File.readlines( File.join(FOLDER,'cte_with.sql') ).collect {|ln| ln.chomp}
db.execute sql.join(' ')


Now with linux, the exact same sql code and ruby files are used. The
sql exec completes successfully using the command line tool. However,
it fails using the sqlite3 gem. The specific exception is "in
'initialize': near "with": syntax error (Sqlite3::SQLException)". It
is failing in the preparation of the statement. From all appearances,
sqlite3 is throwing the exception.

The gem compiles sqlite, creating sqlite_native.so, by downloading the
latest source file, as
"http://sqlite.org#{URL_PATH}/sqlite-autoconf-#{URL_VERSION}.tar.gz;
and compiling that. I have been comparing the gem code between the o/s
environments, and the C code (to this point) is identical.

I have dug into this deeper than my brain can figure out. Is it
possible that there is some kind of #ifdef or #ifndef being triggered,
based on o/s environment, that could effect the parsing or execution
of a cte?

I have a package that contains the sql, the ruby code, and a test db
(1.4k zipped) if anyone would like to give this a shot in their linux
environment and see if you get the same result. Just email me back and
I will send it to you.

* If I change the sql to create temporary tables instead of using the
cte with statements, then everything runs fine regardless of the o/s
environment.

I'm scratching my head on this, one. As always, thanks for your time
and consideration.
dvn

final note: if you take this one, a successful run will create an
empty table. it is good that the table is created. the problem is the
exception, not an empty table.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Interactive shell tab completion for queries

2016-12-09 Thread Roger Binns
On 09/12/16 06:29, daveparr...@tutanota.com wrote:
> I'm writing to ask if it is possible to have table completion for SQL queries 
> in the interactive shell? 

The APSW shell (compatible with the SQLite one) has completion and
colouring:

  https://rogerbinns.github.io/apsw/shell.html

Disclaimer: I am the author

You don't need to know anything about python etc to use it.

Implementing completion is also quite fun if anyone wants to discuss it
further.

Roger



signature.asc
Description: OpenPGP digital signature
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Keith Medcalf

Sounds like a java problem with the java interface, not an SQLite problem.  Two 
observations however:

1)  With the C API you set the busy timeout to 1000 ms but with the java api 
you set it to 100 ms
2)  With the C API you set the busy timeout to the integer 1000 yet in the java 
api you set it to the string "100"

In any case, the problem is in the Java API.  You have demonstrated that the 
problem is not caused by SQLite itself ...

Perhaps a chat with the Java wrapper developers is in order.


> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Jay Weinstein
> Sent: Friday, 9 December, 2016 11:50
> To: SQLite mailing list
> Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> database file is locked (database is locked)
> 
> When I run the two C programs using
> 
>   rc = sqlite3_busy_timeout(db, 1000);
>   if ( rc != SQLITE_OK ) {
> fprintf(stderr, "SQL error: sqlite3_busy_timeout
> failed.\n");
> exit(0);
>   }
> 
> everything works perfectly.  No sqlite busy erros or table locked.
> 
> But, when I to do this using a java app using the following the code
> doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> working as I anticipated --  see below.   Can you advise?
> 
> Thanks, Jay
> 
> Class.forName("org.sqlite.JDBC");
> String s = "jdbc:sqlite:"+db;
> 
> config = new SQLiteConfig();
> config.setBusyTimeout("100");
> conn = DriverManager.getConnection(s, config.toProperties());
> conn.setAutoCommit(false);
> stmt = conn.createStatement();
> 
> On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin  wrote:
> 
> >
> > On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:
> >
> > > Is it correct to say busy timeout will work for two separate processes
> > and
> > > I don't have use fork in C/C++ or ProcessBuilder in java to execute
> one
> > as
> > > a child and a parent?
> >
> > The timeout setting is attached to the database connection.  If you
> > execute _open() twice you need to set it once for each connection.
> >
> > 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



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


[sqlite] Interactive shell tab completion for queries

2016-12-09 Thread daveparrish
Hello,
I'm writing to ask if it is possible to have table completion for SQL queries 
in the interactive shell? If not, can this be included as a feature request in 
the ticket database?
David--
Securely sent with Tutanota. Claim your encrypted mailbox today!
https://tutanota.com
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Jay Weinstein
When I run the two C programs using

  rc = sqlite3_busy_timeout(db, 1000);
  if ( rc != SQLITE_OK ) {
fprintf(stderr, "SQL error: sqlite3_busy_timeout
failed.\n");
exit(0);
  }

everything works perfectly.  No sqlite busy erros or table locked.

But, when I to do this using a java app using the following the code
doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
working as I anticipated --  see below.   Can you advise?

Thanks, Jay

Class.forName("org.sqlite.JDBC");
String s = "jdbc:sqlite:"+db;

config = new SQLiteConfig();
config.setBusyTimeout("100");
conn = DriverManager.getConnection(s, config.toProperties());
conn.setAutoCommit(false);
stmt = conn.createStatement();

On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin  wrote:

>
> On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:
>
> > Is it correct to say busy timeout will work for two separate processes
> and
> > I don't have use fork in C/C++ or ProcessBuilder in java to execute one
> as
> > a child and a parent?
>
> The timeout setting is attached to the database connection.  If you
> execute _open() twice you need to set it once for each connection.
>
> 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_changes() using 64 bit counters?

2016-12-09 Thread Detlef Golze
The maximal number of rows is 1e+13 ().

I do have tables with more than 2^32 rows. Of course one should avoid making 
that large transactions, but it is possible.

Regards,
dg.

-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Donald Griggs
Sent: Thursday, December 08, 2016 7:00 PM
To: SQLite mailing list
Subject: Re: [sqlite] sqlite3_changes() using 64 bit counters?

Just curious -- some of your tables approach 2 billion (2 milliard) rows?
Or, more precisely, you operate on more than 2 billion rows in a single
transaction?
___
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] About a potential error in sqlite3.c, could you please check it?

2016-12-09 Thread David Raymond
I believe DRH answered this on Tuesday:

"The two lines at
https://www.sqlite.org/src/artifact/4e4aea7c?ln=7314-7316 guaranteed
that the NULL pointer deference at
https://www.sqlite.org/src/artifact/4e4aea7c?ln=7328 never happens.

-- 
D. Richard Hipp
d...@sqlite.org"

-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Zhendong Wu
Sent: Thursday, December 08, 2016 11:51 PM
To: sqlite-users@mailinglists.sqlite.org
Subject: [sqlite] About a potential error in sqlite3.c, could you please check 
it?

Hi,



I have downloaded the source code of SQLite Version 3.15.2 which is a big
file called sqlite3.c. I statically analyzed the code and found a potential
error. Could you please check it? Thank you.


In file ‘sqlite3.c’, function ‘sqlite3PagerOpenWal’, the piece of code is
shown as follow.



53659: SQLITE_PRIVATE int sqlite3PagerOpenWal(

53660:  Pager *pPager,  /* Pager object */

53661:  int *pbOpen /* OUT: Set to true if call is a
no-op */

53662: ) {

…

53683: *pbOpen = 1;



If NULL is passed to the second parameter of function
‘sqlite3PagerOpenWal’, LINE 53683 will dereference a NULL pointer and cause
a Segmentation fault. For example, in LINE 49625 ‘rc =
sqlite3PagerOpenWal(pPager, 0);’ the second argument is 0. I think ‘pPager’
may be from untrusted source and it may cause LINE 53662 dereference a NULL
pointer.



Looking forward to your reply.



Best,
Zhendong

-- 
Zhendong Wu
Ph.D. Candidate
School of Computer
National University of Defense Technology
Changsha, Hunan, China 410073
___
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] About a potential error in sqlite3.c, could you please check it?

2016-12-09 Thread Zhendong Wu
Hi,



I have downloaded the source code of SQLite Version 3.15.2 which is a big
file called sqlite3.c. I statically analyzed the code and found a potential
error. Could you please check it? Thank you.


In file ‘sqlite3.c’, function ‘sqlite3PagerOpenWal’, the piece of code is
shown as follow.



53659: SQLITE_PRIVATE int sqlite3PagerOpenWal(

53660:  Pager *pPager,  /* Pager object */

53661:  int *pbOpen /* OUT: Set to true if call is a
no-op */

53662: ) {

…

53683: *pbOpen = 1;



If NULL is passed to the second parameter of function
‘sqlite3PagerOpenWal’, LINE 53683 will dereference a NULL pointer and cause
a Segmentation fault. For example, in LINE 49625 ‘rc =
sqlite3PagerOpenWal(pPager, 0);’ the second argument is 0. I think ‘pPager’
may be from untrusted source and it may cause LINE 53662 dereference a NULL
pointer.



Looking forward to your reply.



Best,
Zhendong

-- 
Zhendong Wu
Ph.D. Candidate
School of Computer
National University of Defense Technology
Changsha, Hunan, China 410073
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users