[sqlite] Database corrupt after hard reboot. Can it be repaired?

2015-10-19 Thread Paul Sanderson
Gunnar

If the data is very important then don't do anything that will change
the computer.

If you have sometools that can take an image copy of the disk (DD to
another drive) or maybe the free accessdata imaging software then I
would recommend doing this first - it will leave all options open
should you wish to try something complex later.

I have tools that can recover tables and rows from a damaged database,
all they need is the schema of the original DB (the more complicated
the bettter). The data can be recovered from the corrupt DB, from any
journal files and also potentially from the swap file (or equivalent)
or unused space on the hard disk. Records can also potentially be
recovered from RAM - although in your case as the power has been off
this is not going to work.

The success of the operation depends on many factors but there is a
fair chance that it won't be 100% acceptable - depending on the nature
of the data (and any table constraints) this may be acceptable. It may
also require some manual "filtering" of the recovered data as more
simple tables are prone to include what can be best described as
suprious results.

Any old backups of the database can potentially be used to create a
working solution.

More information - the DB schema particularly - and what you need
recovered for it to be a success (even a partial success) would be
good.
Paul
www.sandersonforensics.com
skype: r3scue193
twitter: @sandersonforens
Tel +44 (0)1326 572786
http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit
-Forensic Toolkit for SQLite
email from a work address for a fully functional demo licence


On 19 October 2015 at 18:51, gunnar  wrote:
> Thanks a lot Simon!
> We'll try it.
>
>
> (BTW I also got an email from alexa, but looking in the sqlite mailing list
> I can see that I'm not the only one)
>
>
>
>
> On 10/19/2015 06:20 PM, Simon Slavin wrote:
>>
>> On 19 Oct 2015, at 5:13pm, gunnar  wrote:
>>
>>> We run sqlite with PRAGMA synchronous=OFF.
>>>
>>> Now we suffered from a 'hard reboot' because a sysadmin unplugged the
>>> power cable :(
>>>
>>> Is it possible to repair
>>
>> First take a copy of the database file and any other file from the same
>> directory with a similar name.  This is just in case you decide to use
>> heroic (i.e. expensive) means to rescue the database later.
>>
>> Open the proper (not the copy) database using the SQLite Shell Tool
>> downloadable from the SQLite site.  Use the '.dump' command to dump the
>> database as a text file of SQL commands.
>>
>> Read through that file and see if it looks like it has captured all your
>> data in it.  If it has ...
>>
>> Create a new blank database using the SQLite Shell Tool.
>> Use the '.read' command to execute the commands in the text file.
>> Use various commands in the SQLite shell tool to explore the resulting
>> database and see if it looks like it's worth using.
>>
>> Simon.
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Database corrupt after hard reboot. Can it be repaired?

2015-10-19 Thread gunnar
Thanks a lot Simon!
We'll try it.


(BTW I also got an email from alexa, but looking in the sqlite mailing 
list I can see that I'm not the only one)



On 10/19/2015 06:20 PM, Simon Slavin wrote:
> On 19 Oct 2015, at 5:13pm, gunnar  wrote:
>
>> We run sqlite with PRAGMA synchronous=OFF.
>>
>> Now we suffered from a 'hard reboot' because a sysadmin unplugged the power 
>> cable :(
>>
>> Is it possible to repair
> First take a copy of the database file and any other file from the same 
> directory with a similar name.  This is just in case you decide to use heroic 
> (i.e. expensive) means to rescue the database later.
>
> Open the proper (not the copy) database using the SQLite Shell Tool 
> downloadable from the SQLite site.  Use the '.dump' command to dump the 
> database as a text file of SQL commands.
>
> Read through that file and see if it looks like it has captured all your data 
> in it.  If it has ...
>
> Create a new blank database using the SQLite Shell Tool.
> Use the '.read' command to execute the commands in the text file.
> Use various commands in the SQLite shell tool to explore the resulting 
> database and see if it looks like it's worth using.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



[sqlite] Database corrupt after hard reboot. Can it be repaired?

2015-10-19 Thread gunnar
Hi,

We run sqlite with PRAGMA synchronous=OFF.

Now we suffered from a 'hard reboot' because a sysadmin unplugged the 
power cable :(

Is it possible to repair when you see after that:

OrderCallbackStorage::checkDatabaseIntegrity: row 1 [*** in database 
main ***
On tree page 413956 cell 2: Rowid 2178413 out of order (min less than 
parent min of 3012692)
On tree page 422781 cell 0: Rowid 2178406 out of order (min less than 
parent min of 2178415)
On tree page 422438 cell 2: Rowid 2178399 out of order (min less than 
parent min of 2178406)
On tree page 334618 cell 2: Rowid 2178385 out of order (min less than 
parent min of 2178475)
On tree page 697766 cell 1: Rowid 2178383 out of order (min less than 
parent min of 2178387)
On tree page 720566 cell 2: Rowid 2178379 out of order (min less than 
parent min of 2178384)
On tree page 422724 cell 1: Rowid 2178374 out of order (min less than 
parent min of 2178473)
On tree page 325009 cell 1: Rowid 2178372 out of order (min less than 
parent min of 2178375)
On tree page 422681 cell 0: Rowid 2178362 out of order (min less than 
parent min of 2178373)
On tree page 194104 cell 2: Rowid 2178354 out of order (min less than 
parent min of 3012756)
On tree page 438849 cell 1: Rowid 2178347 out of order (min less than 
parent min of 2178356)
On tree page 422447 cell 2: Rowid 2178334 out of order (min less than 
parent min of 2178348)
On tree page 422743 cell 2: Rowid 2178328 out of order (min less than 
parent min of 2178336)
On tree page 236562 cell 2: Rowid 2178322 out of order (min less than 
parent min of 2178345)
On tree page 311214 cell 0: 2nd reference to page 271619
On tree page 311214 cell 1: 2nd reference to page 275817
On tree page 311214 cell 2: 2nd reference to page 91403
On tree page 311214 cell 3: 2nd reference to page 292601
On tree page 311214 cell 4: Child page depth differs
On tree page 311214 cell 7: 2nd reference to page 160638
On tree page 311214 cell 7: Child page depth differs
On tree page 311214 cell 8: 2nd reference to page 273835
On tree page 311214 cell 9: 2nd reference to page 274642
On tree page 422924 cell 1: Rowid 2178314 out of order (min less than 
parent min of 2178390)
On tree page 476820 cell 2: Rowid 2178304 out of order (min less than 
parent min of 2178367)
On tree page 622874 cell 0: 2nd reference to page 230945
On tree page 622874 cell 1: Child page depth differs
On tree page 701236 cell 2: Rowid 2178312 out of order (max larger than 
parent max of 0)
On tree page 767658 cell 2: Rowid 2178267 out of order (max larger than 
parent max of 0)
On tree page 472626 cell 1: 2nd reference to page 150955
On tree page 472626 cell 1: Child page depth differs
On tree page 472626 cell 2: Child page depth differs
On tree page 688043 cell 0: 2nd reference to page 245840
On tree page 688043 cell 1: Child page depth differs
On tree page 248418 cell 0: 2nd reference to page 100017
On tree page 248418 cell 1: 2nd reference to page 125810
On tree page 248418 cell 2: 2nd reference to page 59456
On tree page 248418 cell 3: Child page depth differs
On tree page 248418 cell 4: 2nd reference to page 46971
On tree page 248418 cell 4: Child page depth differs
On page 248418 at right child: 2nd reference to page 64328
On tree page 894475 cell 15: Child page depth differs
On tree page 894475 cell 16: Child page depth differs
On tree page 677958 cell 1: 2nd reference to page 966321
On tree page 677958 cell 1: Child page depth differs
On tree page 677958 cell 2: 2nd reference to page 775609
On tree page 677958 cell 3: 2nd reference to page 1078447
On tree page 677958 cell 4: 2nd reference to page 652046
On tree page 677958 cell 5: Child page depth differs
On tree page 677958 cell 6: 2nd reference to page 726491
On tree page 677958 cell 6: Child page depth differs
On tree page 677958 cell 7: 2nd reference to page 1007385
On tree page 677958 cell 8: 2nd reference to page 902320
On tree page 677958 cell 9: 2nd reference to page 826098
On tree page 677958 cell 10: 2nd reference to page 650238
On page 677958 at right child: 2nd reference to page 910835
On tree page 699269 cell 2: Rowid 2178222 out of order (max larger than 
parent max of 0)
On tree page 748653 cell 1: Rowid 2178303 out of order (max larger than 
parent max of 0)
On tree page 621479 cell 1: 2nd reference to page 1033527
On tree page 621479 cell 1: Child page depth differs
On tree page 621479 cell 2: Child page depth differs
On tree page 651448 cell 9: 2nd reference to page 710853
On tree page 651448 cell 9: Child page depth differs
On tree page 651448 cell 10: Child page depth differs
On tree page 469407 cell 9: 2nd reference to page 293922
On tree page 469407 cell 9: Child page depth differs
On tree page 469407 cell 10: Child page depth differs
On tree page 853029 cell 1: 2nd reference to page 922049
On tree page 853029 cell 1: Child page depth differs
On tree page 853029 cell 2: Child page depth differs
Page 21261 is never used
Page 29169 is never used
Page 44115 is never used
Page 54336 is 

[sqlite] Database corrupt after hard reboot. Can it be repaired?

2015-10-19 Thread Simon Slavin

On 19 Oct 2015, at 5:13pm, gunnar  wrote:

> We run sqlite with PRAGMA synchronous=OFF.
> 
> Now we suffered from a 'hard reboot' because a sysadmin unplugged the power 
> cable :(
> 
> Is it possible to repair

First take a copy of the database file and any other file from the same 
directory with a similar name.  This is just in case you decide to use heroic 
(i.e. expensive) means to rescue the database later.

Open the proper (not the copy) database using the SQLite Shell Tool 
downloadable from the SQLite site.  Use the '.dump' command to dump the 
database as a text file of SQL commands.

Read through that file and see if it looks like it has captured all your data 
in it.  If it has ...

Create a new blank database using the SQLite Shell Tool.
Use the '.read' command to execute the commands in the text file.
Use various commands in the SQLite shell tool to explore the resulting database 
and see if it looks like it's worth using.

Simon.


[sqlite] Another unexpected source of SQLITE_BUSY_SNAPSHOT

2015-10-19 Thread Dan Kennedy

On 10/18/2015 10:27 PM, Florian Weimer wrote:
> My first surprise was SQLITE_BUSY_SNAPSHOT from BEGIN IMMEDIATE (see
> ?SQLITE_BUSY_SNAPSHOT from BEGIN IMMEDIATE?).  I have found another
> source of such snapshot failures with WAL-mode databases.
>
> I like to pre-compile my DML statements before starting transactions,
> mainly for the implied syntax check.  (But perhaps there are also
> performance benefits, too?I haven't checked.)
>
> Here is what I did (if my tracing is correct).  Unless mentioned
> otherwise, the operations succeed with SQLITE_OK.
>
>Open the database.
>Compile the UPDATE statement.
>Compile the ROLLBACK statement (used below).
>Start a BEGIN DEFERRED transaction (with a fresh statement).
>Reset the UPDATE statement.
>Step the UPDATE statement.
> -> this fails with SQLITE_BUSY_SNAPSHOT
>Reset/step/reset the pre-compiled ROLLBACK statement.
>Start a BEGIN IMMEDIATE transaction (with a fresh statement).
> -> this fails with SQLITE_BUSY_SNAPSHOT
>Start a BEGIN IMMEDIATE transaction (with a fresh statement).
>Reset the UPDATE statement.
> -> this fails with SQLITE_BUSY_SNAPSHOT
>
> After the last failure, iterating through the list of stattements does
> not show that the UPDATE statement is busy.


The SQLITE_BUSY_SNAPSHOT returned by the final call to sqlite3_reset() 
on the UPDATE is not a new error - it has just saved the error code from 
the error that occurred during the sqlite3_step() call in the previous 
transaction. So technically the error did not occur within the BEGIN 
IMMEDIATE transaction.


>
> This seems to contradict this piece of the documentation:
>
> | If X starts a transaction that will initially only read but X knows
> | it will eventually want to write and does not want to be troubled
> | with possible SQLITE_BUSY_SNAPSHOT errors that arise because another
> | connection jumped ahead of it in line, then X can issue BEGIN
> | IMMEDIATE to start its transaction instead of just an ordinary
> | BEGIN. The BEGIN IMMEDIATE command goes ahead and starts a write
> | transaction, and thus blocks all other writers. If the BEGIN
> | IMMEDIATE operation succeeds, then no subsequent operations in that
> | transaction will ever fail with an SQLITE_BUSY error.
>
> 
>
> This happens with version 3.8.11.1 on Fedora 22.
>
> I don't know how risky pre-compiling UPDATE statement is.  For SELECT
> statements, it is problematic because they can lead to persistent
> transaction failures with SQLITE_BUSY_SNAPSHOT because the
> pre-compiled and partitial executed statement is busy and will block
> creating a new transaction.  I wonder if this can happen with UPDATE
> statements as well.

I don't quite understand this. Preparing an SQL statement may read the 
database (in order to read the schema). But calling sqlite3_prepare() 
doesn't leave the statement in a "partially executed" state.

So if you do:

   sqlite3_prepare(UPDATE);
   BEGIN;
 sqlite3_prepare(SELECT);
 sqlite3_step(UPDATE);

then I guess you might get an SQLITE_BUSY_SNAPSHOT error (if the 
prepare() call actually needed to read the database), but if you do:

   sqlite3_prepare(SELECT);
   sqlite3_prepare(UPDATE);
   BEGIN;
 sqlite3_step();

then I don't think you can get an SQLITE_BUSY_SNAPSHOT error.

Dan.






[sqlite] Problem with sqlite3_create_function

2015-10-19 Thread Bart Smissaert
> The "context" passed to a user defined function is not and cannot be a
"statement handle".

Yes, you are right there. Not sure now how I thought it was a statement
handle, but this doesn't alter the problem.
Thanks in any case for correcting this mis-conception.

RBS

On Mon, Oct 19, 2015 at 1:40 PM, Hick Gunter  wrote:

> The "context" passed to a user defined function is not and cannot be a
> "statement handle". How would an aggregate function tell the difference
> between
>
> Select SUM(x) ...
>
> and
>
> Select SUM(x), SUM(y) ...
>
> if not by virtue of sqlite3_aggregate_context() returning different
> adresses?
>
> -Urspr?ngliche Nachricht-
> Von: sqlite-users-bounces at mailinglists.sqlite.org [mailto:
> sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Bart
> Smissaert
> Gesendet: Montag, 19. Oktober 2015 13:49
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Problem with sqlite3_create_function
>
> Still getting a crash here if I use the UDF more than once in the same
> statement:
>
> So, table with 2 integer columns and then doing:
>
> select XXX(field1), XXX(field2) from table1
>
> causes a crash.
>
> I can see that the statement prepares fine and that the UDF gets called
> twice (for the first row), but with no error, so
> sqlite3_errmsg(lDBHandle) gives not an error, but than my application
> crashes.
> I get the following information about this if it is of any help:
>
> Problem signature:
>   Problem Event Name: APPCRASH
>   Application Name: EXCEL.EXE
>   Application Version: 12.0.6732.5000
>   Application Timestamp: 55f969a5
>   Fault Module Name: sqlite3.dll
>   Fault Module Version: 3.9.1.0
>   Fault Module Timestamp: 562138c8
>   Exception Code: c005
>   Exception Offset: 0005a28b
>   OS Version: 6.1.7601.2.1.0.256.48
>   Locale ID: 2057
> Additional information about the problem:
>   LCID: 1033
>   Brand: Office12Crash
>   skulcid: 1033
>
> Using the UDF once in a statement is fine:
>
> select XXX(field1) from table1
>
> One thing I noticed is that every time the UDF is called (that is only
> twice, so once for field1 then again for field2) it is with a different
> statement handle.
> Is this to be expected?
>
>
> RBS
>
>
> On Mon, Oct 19, 2015 at 1:21 AM, Bart Smissaert 
> wrote:
>
> > Actually, I can see now that the result of
> > sqlite3_extended_errcode(lDBHandle) is in fact the same as the result
> > of sqlite3_step as I get for the 3 rows 100, 100, 100, 101 so
> > SQLITE_ROW 3 times then SQLITE_DONE.
> >
> > Note sure though why this is and why I get unknown error as a result
> > of sqlite3_errmsg(lDBHandle). Should that not be: Not an error?
> >
> > In any case it does all work now.
> >
> > RBS
> >
> >
> >
> > On Mon, Oct 19, 2015 at 1:05 AM, Bart Smissaert
> > 
> > wrote:
> >
> >> Some progress with this.
> >> Still get an error: unknown error, Extended error code: 100, but it
> >> all runs and get the right results and no crash.
> >> Problem was I did put the result of sqlite3_step in a VB Long datatype:
> >>
> >> Dim lStepResult As Long
> >>
> >> lStepResult = sqlite3_step(lStatementHandle)
> >>
> >> Now I do instead:
> >>
> >> Dim lStepResult 'VB variant datatype
> >>
> >>
> >> RBS
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert <
> >> bart.smissaert at gmail.com> wrote:
> >>
> >>> > Is that binary ?  Or hex ?
> >>>
> >>> Normal decimal, it is the result of
> >>> sqlite3_extended_errcode(lDBHandle)
> >>>
> >>> > Just to verify, can you download the SQLite shell tool and try to
> >>> execute the same sequence ?
> >>>
> >>> Not sure that is that simple as the code to produce the result is in
> >>> an ActiveX dll, not in sqlite3.dll.
> >>>
> >>> RBS
> >>>
> >>> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin 
> >>> wrote:
> >>>
> 
>  On 18 Oct 2015, at 8:35pm, Bart Smissaert
>  
>  wrote:
> 
>  > I get an error: unknown error, Extended error code: 100.
> 
>  Is that binary ?  Or hex ?
> 
>  > I do understand that most likely the problem is somewhere in my
>  > VB6
>  code,
>  > but I can't see it and maybe somebody can shed some light on this
>  from the
>  > SQLite side.
> 
>  Just to verify, can you download the SQLite shell tool and try to
>  execute the same sequence ?
> 
>  Simon.
>  ___
>  sqlite-users mailing list
>  sqlite-users at mailinglists.sqlite.org
>  http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-user
>  s
> 
> >>>
> >>>
> >>
> >
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0

[sqlite] printf with thousands separator

2015-10-19 Thread Clemens Ladisch
Bruce Hohl wrote:
> Is printf with thousands separator working for anyone?

No.  SQLite's printf is designed for database-internal processing (e.g.,
sorting), and does not support locales.

Formatting values for display is the responsibility of the application.
(The sqlite3 command-line shell has some rudimentary column width
settings, but otherwise does not really bother.)


Regards,
Clemens


[sqlite] Problem with sqlite3_create_function

2015-10-19 Thread Bart Smissaert
Still getting a crash here if I use the UDF more than once in the same
statement:

So, table with 2 integer columns and then doing:

select XXX(field1), XXX(field2) from table1

causes a crash.

I can see that the statement prepares fine and that the UDF gets called
twice (for the first row), but with no error, so
sqlite3_errmsg(lDBHandle) gives not an error, but than my application
crashes.
I get the following information about this if it is of any help:

Problem signature:
  Problem Event Name: APPCRASH
  Application Name: EXCEL.EXE
  Application Version: 12.0.6732.5000
  Application Timestamp: 55f969a5
  Fault Module Name: sqlite3.dll
  Fault Module Version: 3.9.1.0
  Fault Module Timestamp: 562138c8
  Exception Code: c005
  Exception Offset: 0005a28b
  OS Version: 6.1.7601.2.1.0.256.48
  Locale ID: 2057
Additional information about the problem:
  LCID: 1033
  Brand: Office12Crash
  skulcid: 1033

Using the UDF once in a statement is fine:

select XXX(field1) from table1

One thing I noticed is that every time the UDF is called (that is
only twice, so once for field1 then again for field2) it is with a
different statement handle.
Is this to be expected?


RBS


On Mon, Oct 19, 2015 at 1:21 AM, Bart Smissaert 
wrote:

> Actually, I can see now that the result of
> sqlite3_extended_errcode(lDBHandle) is in fact the same as the result of
> sqlite3_step as
> I get for the 3 rows 100, 100, 100, 101 so SQLITE_ROW 3 times then
> SQLITE_DONE.
>
> Note sure though why this is and why I get unknown error as a result of
> sqlite3_errmsg(lDBHandle). Should that not be: Not an error?
>
> In any case it does all work now.
>
> RBS
>
>
>
> On Mon, Oct 19, 2015 at 1:05 AM, Bart Smissaert 
> wrote:
>
>> Some progress with this.
>> Still get an error: unknown error, Extended error code: 100, but it all
>> runs and get the right results and no crash.
>> Problem was I did put the result of sqlite3_step in a VB Long datatype:
>>
>> Dim lStepResult As Long
>>
>> lStepResult = sqlite3_step(lStatementHandle)
>>
>> Now I do instead:
>>
>> Dim lStepResult 'VB variant datatype
>>
>>
>> RBS
>>
>>
>>
>>
>>
>>
>> On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert <
>> bart.smissaert at gmail.com> wrote:
>>
>>> > Is that binary ?  Or hex ?
>>>
>>> Normal decimal, it is the result of sqlite3_extended_errcode(lDBHandle)
>>>
>>> > Just to verify, can you download the SQLite shell tool and try to
>>> execute the same sequence ?
>>>
>>> Not sure that is that simple as the code to produce the result is in an
>>> ActiveX dll, not in sqlite3.dll.
>>>
>>> RBS
>>>
>>> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin 
>>> wrote:
>>>

 On 18 Oct 2015, at 8:35pm, Bart Smissaert 
 wrote:

 > I get an error: unknown error, Extended error code: 100.

 Is that binary ?  Or hex ?

 > I do understand that most likely the problem is somewhere in my VB6
 code,
 > but I can't see it and maybe somebody can shed some light on this
 from the
 > SQLite side.

 Just to verify, can you download the SQLite shell tool and try to
 execute the same sequence ?

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

>>>
>>>
>>
>


[sqlite] Problem with sqlite3_create_function

2015-10-19 Thread Hick Gunter
The "context" passed to a user defined function is not and cannot be a 
"statement handle". How would an aggregate function tell the difference between

Select SUM(x) ...

and

Select SUM(x), SUM(y) ...

if not by virtue of sqlite3_aggregate_context() returning different adresses?

-Urspr?ngliche Nachricht-
Von: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Bart 
Smissaert
Gesendet: Montag, 19. Oktober 2015 13:49
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Problem with sqlite3_create_function

Still getting a crash here if I use the UDF more than once in the same
statement:

So, table with 2 integer columns and then doing:

select XXX(field1), XXX(field2) from table1

causes a crash.

I can see that the statement prepares fine and that the UDF gets called twice 
(for the first row), but with no error, so
sqlite3_errmsg(lDBHandle) gives not an error, but than my application crashes.
I get the following information about this if it is of any help:

Problem signature:
  Problem Event Name: APPCRASH
  Application Name: EXCEL.EXE
  Application Version: 12.0.6732.5000
  Application Timestamp: 55f969a5
  Fault Module Name: sqlite3.dll
  Fault Module Version: 3.9.1.0
  Fault Module Timestamp: 562138c8
  Exception Code: c005
  Exception Offset: 0005a28b
  OS Version: 6.1.7601.2.1.0.256.48
  Locale ID: 2057
Additional information about the problem:
  LCID: 1033
  Brand: Office12Crash
  skulcid: 1033

Using the UDF once in a statement is fine:

select XXX(field1) from table1

One thing I noticed is that every time the UDF is called (that is only twice, 
so once for field1 then again for field2) it is with a different statement 
handle.
Is this to be expected?


RBS


On Mon, Oct 19, 2015 at 1:21 AM, Bart Smissaert 
wrote:

> Actually, I can see now that the result of
> sqlite3_extended_errcode(lDBHandle) is in fact the same as the result
> of sqlite3_step as I get for the 3 rows 100, 100, 100, 101 so
> SQLITE_ROW 3 times then SQLITE_DONE.
>
> Note sure though why this is and why I get unknown error as a result
> of sqlite3_errmsg(lDBHandle). Should that not be: Not an error?
>
> In any case it does all work now.
>
> RBS
>
>
>
> On Mon, Oct 19, 2015 at 1:05 AM, Bart Smissaert
> 
> wrote:
>
>> Some progress with this.
>> Still get an error: unknown error, Extended error code: 100, but it
>> all runs and get the right results and no crash.
>> Problem was I did put the result of sqlite3_step in a VB Long datatype:
>>
>> Dim lStepResult As Long
>>
>> lStepResult = sqlite3_step(lStatementHandle)
>>
>> Now I do instead:
>>
>> Dim lStepResult 'VB variant datatype
>>
>>
>> RBS
>>
>>
>>
>>
>>
>>
>> On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert <
>> bart.smissaert at gmail.com> wrote:
>>
>>> > Is that binary ?  Or hex ?
>>>
>>> Normal decimal, it is the result of
>>> sqlite3_extended_errcode(lDBHandle)
>>>
>>> > Just to verify, can you download the SQLite shell tool and try to
>>> execute the same sequence ?
>>>
>>> Not sure that is that simple as the code to produce the result is in
>>> an ActiveX dll, not in sqlite3.dll.
>>>
>>> RBS
>>>
>>> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin 
>>> wrote:
>>>

 On 18 Oct 2015, at 8:35pm, Bart Smissaert
 
 wrote:

 > I get an error: unknown error, Extended error code: 100.

 Is that binary ?  Or hex ?

 > I do understand that most likely the problem is somewhere in my
 > VB6
 code,
 > but I can't see it and maybe somebody can shed some light on this
 from the
 > SQLite side.

 Just to verify, can you download the SQLite shell tool and try to
 execute the same sequence ?

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

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


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.




[sqlite] Compilation fails under Linux (Ubuntu) when FTS5 is enabled

2015-10-19 Thread Rowan Worth
On 18 October 2015 at 04:15,  wrote:

> I just tried one more time with the -lm switch and this time it worked.
> Hmm...
>
> Problem solved.  Thanks.


You might find that specifying -lm *after* the .c files works but -lm
before the .c files doesn't. The linker processes libraries/object files in
the order they appear on the command line, and tends to only take
unresolved symbols from libraries.

So if the linker sees libm first, it looks at the symbols exported by the
library (which includes the 'log' function), but ignores them all because
it isn't yet aware of any unresolved symbols.

Then it looks at the object file derived from sqlite3.c, and finds it has
an unresolved symbol 'log'. But the linker only works with one object file
at a time and doesn't go backwards, and since there are no more
objects/libraries following sqlite3.c, the linker has no opportunity to
resolve 'log'.

Of course if the library appears after sqlite3.c, when the linker asks
"hmm, do I have any unresolved symbols which are exported by libm?" it
finds 'log' and you're all good.

Cheers,
-Rowan


[sqlite] Compilation fails under Linux (Ubuntu) when FTS5 isenabled

2015-10-19 Thread to...@acm.org
That's very likely what happened the first, must have put the -lm option 
before the .c files :(
(Not a regular gcc user.)

Thanks.

-Original Message- 
From: Rowan Worth
Sent: Monday, October 19, 2015 6:43 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Compilation fails under Linux (Ubuntu) when FTS5 
isenabled

On 18 October 2015 at 04:15,  wrote:

> I just tried one more time with the -lm switch and this time it worked.
> Hmm...
>
> Problem solved.  Thanks.


You might find that specifying -lm *after* the .c files works but -lm
before the .c files doesn't. The linker processes libraries/object files in
the order they appear on the command line, and tends to only take
unresolved symbols from libraries.



[sqlite] Fw: SQLlite with Gui4Cli

2015-10-19 Thread Gert Venter
I apologize! I sent this (very incomplete) question to the wrong forum late 
at night after some very frustrating hours searching for a solution! Please 
ignore it.

I found my answer on the Gui4Cli site (SQL3.dll) and can now hopefully 
proceed to produce Gui4Cli apps using a sqlite3 database.

I must, however, say that I will stay a SQLite forum member where, no doubt, 
I'll probably get many answers before I can ask a question. Who knows! I may 
even be able to contribute once in a while! Keep up the excellent work!

GAV

-Original Message- 
From: Gert Venter
Sent: Sunday, 18 October, 2015 11:22 PM
To: General Discussion of SQLite Database;
Subject: [sqlite] SQLlite with Gui4Cli

I?m using SQLite 3.9.0 on Windows 8.1

I?m a long time database developer (mainly Oracle, MySQL) but recently 
started using SQLite.

I?m currently trying to develop a small project using Gui4Cli (here I?m a 
newbie) and SQLite as database. The Gui4Cli database docs are not very 
helpful with this and after scouring the internet for several hours I?ve not 
managed to come up with a single Gui4Cli/SQLite sample program opening / 
reading/ updating a SQLite database. I would very much appreciate if anybody 
out there that help with a link or a sample?

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


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6172 / Virus Database: 4447/10845 - Release Date: 10/18/15 



[sqlite] Alexa Phishing

2015-10-19 Thread Gert Venter
I also received an eMail from alexa within 15 minutes after registering.

GAV 


[sqlite] Problem with sqlite3_create_function

2015-10-19 Thread Bart Smissaert
Actually, I can see now that the result of
sqlite3_extended_errcode(lDBHandle) is in fact the same as the result of
sqlite3_step as
I get for the 3 rows 100, 100, 100, 101 so SQLITE_ROW 3 times then
SQLITE_DONE.

Note sure though why this is and why I get unknown error as a result of
sqlite3_errmsg(lDBHandle). Should that not be: Not an error?

In any case it does all work now.

RBS



On Mon, Oct 19, 2015 at 1:05 AM, Bart Smissaert 
wrote:

> Some progress with this.
> Still get an error: unknown error, Extended error code: 100, but it all
> runs and get the right results and no crash.
> Problem was I did put the result of sqlite3_step in a VB Long datatype:
>
> Dim lStepResult As Long
>
> lStepResult = sqlite3_step(lStatementHandle)
>
> Now I do instead:
>
> Dim lStepResult 'VB variant datatype
>
>
> RBS
>
>
>
>
>
>
> On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert  > wrote:
>
>> > Is that binary ?  Or hex ?
>>
>> Normal decimal, it is the result of sqlite3_extended_errcode(lDBHandle)
>>
>> > Just to verify, can you download the SQLite shell tool and try to
>> execute the same sequence ?
>>
>> Not sure that is that simple as the code to produce the result is in an
>> ActiveX dll, not in sqlite3.dll.
>>
>> RBS
>>
>> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin 
>> wrote:
>>
>>>
>>> On 18 Oct 2015, at 8:35pm, Bart Smissaert 
>>> wrote:
>>>
>>> > I get an error: unknown error, Extended error code: 100.
>>>
>>> Is that binary ?  Or hex ?
>>>
>>> > I do understand that most likely the problem is somewhere in my VB6
>>> code,
>>> > but I can't see it and maybe somebody can shed some light on this from
>>> the
>>> > SQLite side.
>>>
>>> Just to verify, can you download the SQLite shell tool and try to
>>> execute the same sequence ?
>>>
>>> Simon.
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users at mailinglists.sqlite.org
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>
>>
>


[sqlite] Problem with sqlite3_create_function

2015-10-19 Thread Bart Smissaert
Some progress with this.
Still get an error: unknown error, Extended error code: 100, but it all
runs and get the right results and no crash.
Problem was I did put the result of sqlite3_step in a VB Long datatype:

Dim lStepResult As Long

lStepResult = sqlite3_step(lStatementHandle)

Now I do instead:

Dim lStepResult 'VB variant datatype


RBS






On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert 
wrote:

> > Is that binary ?  Or hex ?
>
> Normal decimal, it is the result of sqlite3_extended_errcode(lDBHandle)
>
> > Just to verify, can you download the SQLite shell tool and try to
> execute the same sequence ?
>
> Not sure that is that simple as the code to produce the result is in an
> ActiveX dll, not in sqlite3.dll.
>
> RBS
>
> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin 
> wrote:
>
>>
>> On 18 Oct 2015, at 8:35pm, Bart Smissaert 
>> wrote:
>>
>> > I get an error: unknown error, Extended error code: 100.
>>
>> Is that binary ?  Or hex ?
>>
>> > I do understand that most likely the problem is somewhere in my VB6
>> code,
>> > but I can't see it and maybe somebody can shed some light on this from
>> the
>> > SQLite side.
>>
>> Just to verify, can you download the SQLite shell tool and try to execute
>> the same sequence ?
>>
>> Simon.
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>


[sqlite] SQLlite with Gui4Cli

2015-10-19 Thread Gert Venter
I?m using SQLite 3.9.0 on Windows 8.1

I?m a long time database developer (mainly Oracle, MySQL) but recently started 
using SQLite.

I?m currently trying to develop a small project using Gui4Cli (here I?m a 
newbie) and SQLite as database. The Gui4Cli database docs are not very helpful 
with this and after scouring the internet for several hours I?ve not managed to 
come up with a single Gui4Cli/SQLite sample program opening / reading/ updating 
a SQLite database. I would very much appreciate if anybody out there that help 
with a link or a sample?

GAV