[sqlite] Patch that add ".dumpdata" and "BEGIN TRANSACTION; " command to shell.c

2015-08-11 Thread sqlite-mail
Hello again !  

After sending the first patch I also realized that when sqlite3 dumps
".schema" or ".fullschema" it doesn't surround the dump with a transaction
and that takes longer and makes the hard disk work hard. So I also surrounded
".schema" and ".fullschema" with a transaction with this extended patch.  

Again the same license of sqlite apply to this patch.  

=patch to shell.c  

--- shell.c
+++ shell.c
@@ -550,10 +550,12 @@
?? sqlite3_stmt *pStmt;?? /* Current statement if any */
?? FILE *pLog;??? /* Write log output here */
?? int *aiIndent; /* Array of indents used in MODE_Explain
*/
?? int nIndent;?? /* Size of array aiIndent[] */
?? int iIndent;?? /* Index of current op in aiIndent[] */
+? int dumpDataOnly; /*when dump a database exclude schema */
+? int doStartTransaction; /* when dumping schema only before first record
output "BEGIN;" */
?};
?
?/*
?** These are the allowed shellFlgs values
?*/
@@ -908,10 +910,11 @@
 }
?? }
?? break;
 }
 case MODE_Semi:
+? if((p->cnt == 0) && p->doStartTransaction ) fprintf(p->out,"BEGIN
TRANSACTION;\n");
 case MODE_List: {
?? if( p->cnt++==0 && p->showHeader ){
 for(i=0; iout,"%s%s",azCol[i],
?? i==nArg-1 ? p->rowSeparator :
p->colSeparator);
@@ -1658,31 +1661,33 @@
?? if( nArg!=3 ) return 1;
?? zTable = azArg[0];
?? zType = azArg[1];
?? zSql = azArg[2];
?? 
-? if( strcmp(zTable, "sqlite_sequence")==0 ){
-??? zPrepStmt = "DELETE FROM sqlite_sequence;\n";
-? }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){
-??? fprintf(p->out, "ANALYZE sqlite_master;\n");
-? }else if( strncmp(zTable, "sqlite_", 7)==0 ){
-??? return 0;
-? }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
-??? char *zIns;
-??? if( !p->writableSchema ){
-? fprintf(p->out, "PRAGMA writable_schema=ON;\n");
-? p->writableSchema = 1;
-??? }
-??? zIns = sqlite3_mprintf(
-?? "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
-?? "VALUES('table','%q','%q',0,'%q');",
-?? zTable, zTable, zSql);
-??? fprintf(p->out, "%s\n", zIns);
-??? sqlite3_free(zIns);
-??? return 0;
-? }else{
-??? fprintf(p->out, "%s;\n", zSql);
+? if( !p->dumpDataOnly ){
+??? if( strcmp(zTable, "sqlite_sequence")==0 ){
+? zPrepStmt = "DELETE FROM sqlite_sequence;\n";
+??? }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){
+? fprintf(p->out, "ANALYZE sqlite_master;\n");
+??? }else if( strncmp(zTable, "sqlite_", 7)==0 ){
+? return 0;
+??? }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
+? char *zIns;
+? if( !p->writableSchema ){
+??? fprintf(p->out, "PRAGMA writable_schema=ON;\n");
+??? p->writableSchema = 1;
+? }
+? zIns = sqlite3_mprintf(
+ "INSERT INTO
sqlite_master(type,name,tbl_name,rootpage,sql)"
+ "VALUES('table','%q','%q',0,'%q');",
+ zTable, zTable, zSql);
+? fprintf(p->out, "%s\n", zIns);
+? sqlite3_free(zIns);
+? return 0;
+??? }else{
+? fprintf(p->out, "%s;\n", zSql);
+??? }
?? }
?
?? if( strcmp(zType, "table")==0 ){
 sqlite3_stmt *pTableInfo = 0;
 char *zSelect = 0;
@@ -1789,10 +1794,11 @@
?? ".databases List names and files of attached
databases\n"
?? ".dbinfo ?DB??? Show status information about the
database\n"
?? ".dump ?TABLE? ...? Dump the database in an SQL text format\n"
?? " If TABLE specified,
only dump tables matching\n"
?? " LIKE pattern TABLE.\n"
+? ".dumpdata? ?TABLE? ... Like .dump without schema\n"
?? ".echo on|off?? Turn command echo on or off\n"
?? ".eqp on|off??? Enable or disable automatic EXPLAIN
QUERY PLAN\n"
?? ".exit? Exit this program\n"
?? ".explain ?on|off?? Turn output mode suitable for EXPLAIN on or
off.\n"
?? " With no args, it turns
EXPLAIN on.\n"
@@ -2770,11 +2776,12 @@
?
?? if( c=='d' && strncmp(azArg[0], "dbinfo", n)==0 ){
 rc = shell_dbinfo_command(p, nArg, azArg);
?? }else
?
-? if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
+? if( c=='d' && ((strncmp(azArg[0], "dump", n)==0) ||
+? (p->dumpDataOnly = (strncmp(azArg[0], "dumpdata", n)==0))) ){
 open_db(p, 0);
 /* When playing back a "dump", the content might appear in an order
 ** which causes immediate foreign key constraints to be violated.
 ** So disable foreign-key constraint enforcement to prevent
problems. */
 if( nArg!=1 && nArg!=2 ){
@@ -2790,32 +2797,36 @@
 if( nArg==1 ){
?? run_schema_dump_query(p, 
 "SELECT name, type, sql FROM sqlite_master "
 "WHERE sql NOT NULL AND type=='table' AND
name!='sqlite_sequence'"
?? );
-? run_schema_dump_query(p, 
-??? "SELECT name, type, sql FROM sqlite_master "
-??? "WHERE name=='sqlite_sequence'"
-? );
-? run_table_dump_query(p,
-??? "SELECT sql FROM sqlite_master "
-??? "WHERE sql NOT NULL AND type IN ('index','trigger','view')",
0

[sqlite] I don't know how to cast ‘const unsigned char*’ to a 'const std::string'

2015-08-11 Thread Nicolas Jäger
I may found a solution by using 'reinterpret_cast'. Not
sure that is a good solution...

nicolas


[sqlite] I don't know how to cast ‘const unsigned char*’ to a 'const std::string'

2015-08-11 Thread Nicolas Jäger
hi John,

actualy what you suggest it's the common solution. You
missed the fact that here, there is an unsigned... 

in

> http://stackoverflow.com/questions/1195675/convert-a-char-to-stdstring

you can read :

"It has taken me so long to realize that this constructor absolute
refuses to match with (unsigned char*) as an argument !"

anyway, thx for the try.

nicolas.


[sqlite] I don't know how to cast ‘const unsigned char*’ to a 'const std::string'

2015-08-11 Thread Nicolas Jäger
Hi,
I have some basic problem, but I didn't found the solution so far...
maybe some people are using C++ and already deal with that problem :

conversion from ?const unsigned char*? to non-scalar type ?std::string

I got the `const unsigned char*` from `sqlite3_column_text()` and I
want to pass the result as a `std::string` parameter to a C++ function

regards,
Nicolas J.


[sqlite] I don't know how to cast ‘const unsigned char*’ to a 'const std::string'

2015-08-11 Thread Nicolas Jäger
Hi,
I have some basic problem, but I didn't found the solution so far...
maybe some people are using C++ and already deal with that problem :

conversion from ?const unsigned char*? to non-scalar type ?std::string

I got the `const unsigned char*` from `sqlite3_column_text()` and I
want to pass the result as a `std::string` parameter to a C++ function

regards,
Nicolas J.


[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
It will take a little while to compile with MSVC. ?In the meantime I removed 
-DSQLITE_DEFAULT_WORKER_THREADS=4 from the compilation flags and the index was 
created successfully. ?Haste makes waste?
Thanks, everyone.Bob Weiss 


 On Tuesday, August 11, 2015 1:55 PM, Joe Mistachkin  wrote:



Robert Weiss wrote:
>
> [continuing from previous gdb output]:(gdb) thread apply all where 15
> Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc ()
> from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
> 

Anyhow, the cause of this appears to be the "sysfer.dll", which belongs to
Symantec Network Threat Protection (NTP):

http://www.symantec.com/connect/forums/weve-found-new-big-one#comment-504141
1

I'm not exactly sure what is causing the bad interaction here; however, it
is possible that Cygwin and Symantec are attempting to hook similar Win32
APIs, with unpredictable results.

Does this issue occur when running a build of SQLite on your machine without
Cygwin (i.e. built using MSVC)?

--
Joe Mistachkin

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




[sqlite] Patch that add ".dumpdata" command to shell.c

2015-08-11 Thread no...@null.net
> This command should behave exactly like ".dump" but without the
> database schema.  

I would occasionally find that command useful.

> Here is a small patch that adds ".dumpdata" for "shell.c" in sqlite3.  

This mailing list does not accept attachments. Perhaps you can post a
link?

-- 
Mark Lawrence


[sqlite] I don't know how to cast ‘const unsigned char*’ to a 'const std::string'

2015-08-11 Thread John McKown
Perhaps this will help:
http://stackoverflow.com/questions/1195675/convert-a-char-to-stdstring

IIRC, something ike

std::string return_string(pointer_to_const_unsigned_char_var);

return_string is an std::string initialized to the value pointed to my the
variable in the initializer. If you want the return_string to have more
space, say to append to it, then you can do:

std::string return_string(pointer_to_const_unsigned_char_var,) //
replace  with the size of the area to be allocated.

ref: http://en.cppreference.com/w/cpp/string/basic_string/basic_string for
the above, in the examples section.

FWIW, I am not a C++ programmer. I have read up a bit on it, but found the
above with a simple Google search.
https://www.google.com/webhp?ie=UTF-8#q=C%2B%2B+std%3A%3Astring+cast



On Tue, Aug 11, 2015 at 9:07 PM, Nicolas J?ger 
wrote:

> Hi,
> I have some basic problem, but I didn't found the solution so far...
> maybe some people are using C++ and already deal with that problem :
>
> conversion from ?const unsigned char*? to non-scalar type ?std::string
>
> I got the `const unsigned char*` from `sqlite3_column_text()` and I
> want to pass the result as a `std::string` parameter to a C++ function
>
> regards,
> Nicolas J.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown


[sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Teg
Hello ch,

I'd say yes it'll block. As to whether this is a problem I guess it
depends on how much writing you do. I break my writing down into
sections so, there's time in between transactions for readers to get
in and read.

WAL mode should work. It used to work for me a number of versions back.

If I was going to look deeper into this I'd use a fresh simple table
put the new DB into WAL mode and experiment with 2-3 processes trying
to access the fresh DB.

Tuesday, August 11, 2015, 8:08:39 PM, you wrote:

c> We didn't try journal mode but the WAL mode doesn't work for us
c> even if we set busy timeout handler to try to go across this.
c> Unfortunately, the busy timeout handler doesn't get called every
c> time and after that we still cannot get the file recovered
c> correctly. The issue is still shown in 3.8.8.3. Thanks for letting
c> me know journal mode working for you! However, is reading gonna
c> blocked by writing in journal mode? I thought that is the sqlite documents 
mentioned.

>> Date: Tue, 11 Aug 2015 00:41:50 -0400
>> From: Teg at djii.com
>> To: chaihua_sina at hotmail.com
>> CC: sqlite-users at mailinglists.sqlite.org
>> Subject: Re: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY 
>> (Multithread)
>> 
>> Hello ch,
>> 
>> I  ran  into  a  similar  problem when I was trying to use WAL mode. I
>> ended up just turning it off. It seemed that once there was contention
>> for  the  file  it never recovered. This was in windows. I didn't look
>> into  it  any  deeper  than this.  The same code works fine in journal
>> mode.  I  haven't  tried  it  again with the latest.I think I last
>> tested this in 3.8.8.2.
>> 
>> There's  typically  not  much more than 2-3 connections contending for
>> file  access  in my program. Most of the time it's only one connection
>> at a time.
>> 
>> I  assumed  it  was something I was doing because I wasn't reading any
>> other reports of it. 
>> 
>> C
>> 
>> 
>> Monday, August 10, 2015, 9:28:03 PM, you wrote:
>> 
>> c> Hi,
>> c> I have similar problems. We have multiple connections to write to
>> c> the database and the updates are surrounded by create&release
>> c> savepoints. The issue is when two updates from different
>> c> connections try to modify the database, the second operation gonna
>> c> fail and it either returned database is busy or locked, while
>> c> another operation just keeps occupying the database lock until it
>> c> finishes. After the first operation finishes, the failed operation
>> c> (a short update) tries again with creating a new savepoint but it
>> c> still fails and after that any further operation cannot use the
>> c> database anymore and all of them fail with SQLITE_BUSY or database
>> c> locked. Is this because we don't create and handle savepoints
>> c> correct? One way to avoid the continuous abort is we use begin
>> c> transaction IMMEDIATE to wrap all our operations but it looks like
>> c> our solution is bandage. I don't know what will be the best
>> c> solution to solve our issue. If anyone could help answer it, I appreciate.
>> >> Date: Mon, 10 Aug 2015 15:40:17 +0300
>> >> From: dm3chip at gmail.com
>> >> To: sqlite-users at mailinglists.sqlite.org
>> >> Subject: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY 
>> >> (Multithread)
>> >> 
>> >> -- Forwarded message --
>> >> From: ??? ??? 
>> >> Date: 2015-08-10 0:37 GMT+03:00
>> >> Subject: Problem with SQLite in C++. DB is BUSY (Multithread)
>> >> To: sqlite-users at mailinglists.sqlite.org
>> >> 
>> >> 
>> >> Hello!
>> >> I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
>> >> got error's *DB is locked error code 5*. As I know error code 5 means, 
>> >> that
>> >> DB is busy. To solve this I started to use WAL journal mode. But it 
>> >> doesn't
>> >> help.
>> >> 
>> >> In my program I've got 2 connections to the same db. I use mutexes for 
>> >> both
>> >> DB connections.
>> >> I'm opening connections with this code:
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> *if (sqlite3_open_v2(db_path.c_str(), &this->db, SQLITE_OPEN_READWRITE |
>> >> SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, 0) ) {
>> >> LOG4CPLUS_FATAL(this->logger, "Can not open/create DB " <<
>> >> sqlite3_errmsg(db));sqlite3_close(this->db);}if 
>> >> (sqlite3_exec(this->db,
>> >> "PRAGMA journal_mode = WAL;", 0, 0, &err)) {
>> >> LOG4CPLUS_ERROR(this->logger, "SQL det journal mode error: " << err);
>> >> sqlite3_free(err);}*
>> >> 
>> >> First connection is used for inserting data to the DB. It happens with 4
>> >> time every second.
>> >> Second connection is used for starting transaction, selecting, updating,
>> >> deleting data and committing. It happens every 5 seconds.
>> >> 
>> >> I'm getting errors from the first connection.
>> >> 
>> >> Please help me to solve this problem.
>> >> 
>> >> P.S. Sorry for my bad English
>> >> ___
>> >> sqlite-users mailing list
>> >> sqlite-users at

[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
[continuing from previous gdb output]:(gdb) thread apply all where 15
Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc () from 
/cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
Thread 5 (Thread 12300.0x389c):#0 ?0x77791f92 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x77791f92 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#2 ?0x777c1d63 in 
ntdll!RtlpQueryDefaultUILanguage () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#3 ?0x6100626b in _cygtls::call2(unsigned 
long (*)(void*, void*), void*, void*) () from /usr/bin/cygwin1.dll#4 
?0x61006306 in _cygtls::call(unsigned long (*)(void*, void*), void*) () from 
/usr/bin/cygwin1.dll#5 ?0x610828d8 in threadfunc_fe(void*) () from 
/usr/bin/cygwin1.dll#6 ?0x75c4337a in KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#7 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#8 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#9 ?0x in ?? ()
Thread 4 (Thread 12300.0x328c):#0 ?0x777901a9 in ntdll!ZwWaitForMultipleObjects 
() from /cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x777901a9 in 
ntdll!ZwWaitForMultipleObjects () from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 
?0x777b1541 in ntdll!TpIsTimerSet () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#3 ?0x75c4337a in 
KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#4 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#5 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#6 ?0x in ?? ()
Thread 3 (Thread 12300.0x3530):#0 ?0x7778f951 in ntdll!ZwReadFile () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x7778f951 in ntdll!ZwReadFile () 
from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 ?0x7549dd62 in ReadFile () from 
/cygdrive/c/Windows/syswow64/KERNELBASE.dll#3 ?0x00a0 in ?? ()#4 
?0x in ?? ()
Thread 2 (Thread 12300.0x32f0):#0 ?0x002c03a3 in ?? ()#1 ?0x6100626b in 
_cygtls::call2(unsigned long (*)(void*, void*), void*, void*) () from 
/usr/bin/cygwin1.dll#2 ?0x61006306 in _cygtls::call(unsigned long (*)(void*, 
void*), void*) () from /usr/bin/cygwin1.dll#3 ?0x610828d8 in 
threadfunc_fe(void*) () from /usr/bin/cygwin1.dll#4 ?0x75c4337a in 
KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#5 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#6 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#7 ?0x in ?? ()
Thread 1 (Thread 12300.0x294c):#0 ?0x7778fc66 in ntdll!ZwQueryInformationThread 
() from /cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x7778fc66 in 
ntdll!ZwQueryInformationThread () from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 
?0x754a38f6 in KERNELBASE!GetThreadPriority () from 
/cygdrive/c/Windows/syswow64/KERNELBASE.dll#3 ?0x6108dcc4 in yield () from 
/usr/bin/cygwin1.dll#4 ?0x61106585 in pthread::create(void* (*)(void*), 
pthread_attr*, void*) () from /usr/bin/cygwin1.dll#5 ?0x61107d3d in 
pthread::create(pthread**, pthread_attr* const*, void* (*)(void*), void*) () 
from /usr/bin/cygwin1.dll#6 ?0x610e1e15 in _sigfe () from 
/usr/bin/cygwin1.dll#7 ?0x00421070 in vdbeSorterListToPMA ()#8 ?0x8006ae42 in 
?? ()Backtrace stopped: previous frame inner to this frame (corrupt stack?)



 On Tuesday, August 11, 2015 1:03 PM, Dan Kennedy  wrote:


 On 08/12/2015 02:15 AM, Robert Weiss wrote:
> The bug seems to be repeatable.? At least, it happened again today.
> I haven't used gdb in a long time.? Here's my first crack at it; what else 
> should I do?
> $ gdb sqliteGNU gdb (GDB) 7.8Copyright (C) 2014 Free Software Foundation, 
> Inc.License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to 
> change and redistribute it.There is NO WARRANTY, to the extent permitted by 
> law.? Type "show copying"and "show warranty" for details.This GDB was 
> configured as "i686-pc-cygwin".Type "show configuration" for configuration 
> details.For bug reporting instructions, please 
> see:.Find the GDB manual and other 
> documentation resources online 
> at:.For help, type 
> "help".Type "apropos word" to search for commands related to "word"...Reading 
> symbols from sqlite...done.(gdb) run /cygdrive/r/errd200.dbStarting program: 
> /usr/local/bin/sqlite /cygdrive/r/errd200.db[New Thread 12300.0x294c][New 
> Thread 12300.0x32f0][New Thread 12300.0x3530][New Thread 12300.0x328c][New 
> Thread 12300.0x389c]SQLite version 3.8.11.1 2015-07-29 20:00:57Enter ".help" 
> for usage hints.sqlite> create index d200_on_passport_fn on 
> d200_on_passport(fn);[New Thread 12300.0xa64]gdb: unknown

[sqlite] Site unavailable.

2015-08-11 Thread Richard Hipp
On 8/11/15, ??? ???  wrote:
> In Russia when I'm trying to visit sqlite.org site, I'm getting conection
> timeout.
>
> Also, sqlite.org doesn't pinged.

There was a transient issue at the datacenter, for a few minutes of
either side of 22:00 UTC.

If you ever have problems with www.sqlite.org, there are mirror sites
(in different datacenters, in different cities) at www2.sqlite.org and
www3.sqlite.org.

-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] Patch that add ".dumpdata" command to shell.c

2015-08-11 Thread sqlite-mail
Hello !  

Here is a small patch that adds ".dumpdata" for "shell.c" in sqlite3.  

This command should behave exactly like ".dump" but without the database
schema.  

I 'm giving it with the same license as sqlite.  

Cheers !


[sqlite] Site unavailable.

2015-08-11 Thread Donald Griggs
(No problem as of this writing from southeastern usa.)

You might want to try a traceroute.

There are two additional mirrors you can try.

http://www.sqlite.org/cgi/src (Dallas)
http://www2.sqlite.org/cgi/src (Newark)
http://www3.sqlite.org/cgi/src (Fremont)



On Tue, Aug 11, 2015 at 7:51 PM, Roger Binns  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 08/11/2015 04:18 PM, ??? ??? wrote:
> > In Russia when I'm trying to visit sqlite.org site, I'm getting
> > conection timeout.
>
> Use down for everyone or just me to check sites:
>
>   http://www.downforeveryoneorjustme.com/sqlite.org
>
> In this case it is you.
>
> > Also, sqlite.org doesn't pinged.
>
> $ ping sqlite.org
> PING sqlite.org (67.18.92.124) 56(84) bytes of data.
> 64 bytes from sqlite.org (67.18.92.124): icmp_seq=1 ttl=48 time=41.4 ms
> 64 bytes from sqlite.org (67.18.92.124): icmp_seq=2 ttl=48 time=40.6 ms
> 64 bytes from sqlite.org (67.18.92.124): icmp_seq=3 ttl=48 time=42.1 ms
> ^C
>
> You likely either have a transient issue, or there is some sort of
> filtering going on at some level.  It has been known for various
> content based firewalls to incorrectly decide sites like sqlite are
> inappropriate.  However they should generally tell you they blocked
> the access.
>
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iEYEARECAAYFAlXKioQACgkQmOOfHg372QQsUQCg156vPDGVqz4iqUNz31s+QNY8
> 9ScAniH0soJC+LiKEC+c3k8Xiw9jq6JI
> =EYWs
> -END PGP SIGNATURE-
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
The bug seems to be repeatable. ?At least, it happened again today.
I haven't used gdb in a long time. ?Here's my first crack at it; what else 
should I do? 
$ gdb sqliteGNU gdb (GDB) 7.8Copyright (C) 2014 Free Software Foundation, 
Inc.License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change 
and redistribute it.There is NO WARRANTY, to the extent permitted by law. ?Type 
"show copying"and "show warranty" for details.This GDB was configured as 
"i686-pc-cygwin".Type "show configuration" for configuration details.For bug 
reporting instructions, please see:.Find 
the GDB manual and other documentation resources online 
at:.For help, type "help".Type 
"apropos word" to search for commands related to "word"...Reading symbols from 
sqlite...done.(gdb) run /cygdrive/r/errd200.dbStarting program: 
/usr/local/bin/sqlite /cygdrive/r/errd200.db[New Thread 12300.0x294c][New 
Thread 12300.0x32f0][New Thread 12300.0x3530][New Thread 12300.0x328c][New 
Thread 12300.0x389c]SQLite version 3.8.11.1 2015-07-29 20:00:57Enter ".help" 
for usage hints.sqlite> create index d200_on_passport_fn on 
d200_on_passport(fn);[New Thread 12300.0xa64]gdb: unknown target exception 
0x8001 at 0x74d66d61
Program received signal ?, Unknown signal.[Switching to Thread 
12300.0xa64]0x74d66d61 in sysfer!FirstHookFunc () from 
/cygdrive/c/Windows/SysWOW64/SYSFER.DLL(gdb) bt#0 ?0x74d66d61 in 
sysfer!FirstHookFunc () from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 
?0x in ?? ()


 On Tuesday, August 11, 2015 1:43 AM, Dan Kennedy  wrote:


 On 08/11/2015 12:23 AM, Robert Weiss wrote:
> Dan Kennedy--
> What address, precisely, should I use to send the database to you?? When I 
> "reply" to your message I get the whole SQLite discussion group, which is 
> what I want to avoid (no offense intended, guys and gals).
> BTW, the problem does not seem to occur in version 3.8.10.2.
> Robert Weiss

Thanks for the database. We couldn't reproduce the problem here though.

The crash is repeatable, correct? Are you able to capture a stack trace 
from the command line shell with gdb?

Thanks,
Dan.


>
>
>? ? ? On Friday, August 7, 2015 11:31 PM, Dan Kennedy gmail.com> wrote:
>? ? 
>
>? On 08/08/2015 04:11 AM, Robert Weiss wrote:
>> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
>> OSwithout an error message) while running in a Cygwin shell under Windows 7 
>> when I tried to create anindex.? The source was compiled by gcc 4.9.2.? The 
>> same type of crashhappened when I tried the operation from a Lua script 
>> linked to the same objectlibrary.
>>
>>
>>? ? 
>> Here are the DDL statements entered previous to the crash:
>>
>>
>>? ? 
>> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>>
>> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>>
>> CREATE VIEW d200 as select * fromd200_on_passport;
>>
>>
>>? ? 
>> And here is the statement thatcaused the crash:
>>
>> create index d200_on_passport_fn ond200_on_passport(fn);
>>
>>
>>? ? 
>> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
>> database with the same ddlstatements but containing no data.
>>
>>
>> The compressed version of the database that illustrates the problem is a 
>> little smaller than 2 MB.? It contains some semi-personal information (it's 
>> part of an attempt to organize my photo library; pathnames hint at where 
>> I've been on vacation and so on, but the database contains no images) and 
>> I'd prefer not to post it to a list, but I can send it for use by those 
>> tracking down the bug.
>
> Can you send the database to me? Or to drh if that seems more prudent to
> you.
>
> Thanks,
> Dan.
>
>
>
>
>
>> Robert Weiss
>> ___
>> 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-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] setup C code with cppunit using test db

2015-08-11 Thread Richard Hipp
On 8/11/15, Adam Devita  wrote:
>
> I get an error stating that MREMAP_MAYMOVE is undeclared. (line 29874)
> I don't see in the source or .h file where it would be defined.
>

It's defined in /usr/include/linux/mman.h on my LTS14.04 box.   And
that file is included from /usr/include/mmap.h which is #included from
sqlite3.c.

-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] SQLite crash

2015-08-11 Thread Jan Nijtmans
Op 11 aug. 2015 17:06 schreef "Robert Weiss"  het
volgende:
>
> In the meantime I removed -DSQLITE_DEFAULT_WORKER_THREADS=4 from the
compilation flags and the index was created successfully.  Haste makes
waste?
> Thanks, everyone.Bob Weiss

That explains it! Your build of sqlite starts win32 threads, which don't
work well in a cygwin environment. On cygwin you should configure posix
threads.

I have a fix for that, it's included in the cygwin SQLite package. With
that you can use multiple threads as you wish.

Regards,
Jan Nijtmans


[sqlite] setup C code with cppunit using test db

2015-08-11 Thread Adam Devita
Good day,

I'd like to test some C code using the cpputest package.

The code is a simple transaction where 1 prepared update statement
gets various parameters bound and stepped in a loop.

I'd like to make a test db so I can ensure that the code will work
(and there are no syntax errors in the sql)

If I copy the amalgamation (3.8.8) into my test directory, and run the
make (Linux flavour is ubuntu 14.04lts being run on a Oracle virtual
box)

I get an error stating that MREMAP_MAYMOVE is undeclared. (line 29874)
I don't see in the source or .h file where it would be defined.

Has anyone run into this one?  What should I do ?


regards,
Adam DeVita

-- 
--
VerifEye Technologies Inc.
151 Whitehall Dr. Unit 2
Markham, ON
L3R 9T1


[sqlite] Site unavailable.

2015-08-11 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/11/2015 04:18 PM, ??? ??? wrote:
> In Russia when I'm trying to visit sqlite.org site, I'm getting
> conection timeout.

Use down for everyone or just me to check sites:

  http://www.downforeveryoneorjustme.com/sqlite.org

In this case it is you.

> Also, sqlite.org doesn't pinged.

$ ping sqlite.org
PING sqlite.org (67.18.92.124) 56(84) bytes of data.
64 bytes from sqlite.org (67.18.92.124): icmp_seq=1 ttl=48 time=41.4 ms
64 bytes from sqlite.org (67.18.92.124): icmp_seq=2 ttl=48 time=40.6 ms
64 bytes from sqlite.org (67.18.92.124): icmp_seq=3 ttl=48 time=42.1 ms
^C

You likely either have a transient issue, or there is some sort of
filtering going on at some level.  It has been known for various
content based firewalls to incorrectly decide sites like sqlite are
inappropriate.  However they should generally tell you they blocked
the access.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iEYEARECAAYFAlXKioQACgkQmOOfHg372QQsUQCg156vPDGVqz4iqUNz31s+QNY8
9ScAniH0soJC+LiKEC+c3k8Xiw9jq6JI
=EYWs
-END PGP SIGNATURE-


[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Rob Willett
Eric,

The humorous side of me would argue that RC4 isn?t encryption anymore than 
ROT13 is these days.

The serious side of me says that exportation of encryption stuff has changed 
significantly and is full of weird and vagueness. Since you don?t state your 
country of origin its difficult to know what to suggest to look for, my 
assumption is that you are US based in which case you should probably look at 
the US Export restrictions available from the Dept of Commerce (?). From 
memory, encryption got controlled more when the bit length got longer and 
longer. I recall that it used to be that 40 bit RC4 was OK and I *think* that 
the bit length is now longer (128bit?) as it has been shown that 40 bit RC4 is 
as much use as a chocolate fireguard. 

It also depends on where you are exporting to. The US has a list of countries 
that are forbidden to trade with (with various exceptions), e.g. North Korea, 
Sudan can?t even get ROT13 legally. 

I know that RC4 used to have US and export versions which had different key 
lengths. I *think* that has now changed. 

This link talks about the relaxation of export regulations on encryption but as 
a normal piece of govt literature its rather opaque (to say the least). Give it 
to the laywers through to keep them busy.

http://www.gpo.gov/fdsys/pkg/FR-2010-06-25/pdf/2010-15072.pdf 


This is also a good site 

http://www.cryptolaw.org 

One paragraph sticks out

"On 7 January 2011 <>, a minor amendment was made to the EAR (Federal Register? 
Vol. 76, No. 5, 
p. 1059). Publicly available mass-market encryption object code software (with 
symmetric key length exceeding 64 bits), and publicly available encryption 
object code of which the corresponding source code falls under License 
Exception TSU (i.e., when the source code ies publicly available), are no 
longer subject to the EAR. The amendment includes some minor specific 
revisions.?

I read this as if your use of RC4 is 64 bit (or less) and its publicly 
available than you may have a license Exception anyway.

My view is that you need to work with the lawyers on this and ?educate? them as 
to what encryption is and what generating random numbers is. 

You can also demonstrate that most browsers have RC4 with what appears to be 
128 bit encryption by going to 

https://cc.dcsec.uni-hannover.de 

It tells you the encryption supported by your browser. Here?s mine, I have 
128bit RC4 encryption (its near the bottom).

Cipher Suites Supported by Your Browser (ordered by preference):

SpecCipher Suite NameKey SizeDescription
(00,ff)EMPTY-RENEGOTIATION-INFO-SCSV0 BitUsed for secure renegotation.
(c0,24)ECDHE-ECDSA-AES256-SHA384256 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA384 
.
(c0,23)ECDHE-ECDSA-AES128-SHA256128 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA256 
.
(c0,0a)ECDHE-ECDSA-AES256-SHA256 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA1 
.
(c0,09)ECDHE-ECDSA-AES128-SHA128 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA1 
.
(c0,08)ECDHE-ECDSA-3DES-EDE-SHA168 BitKey exchange: ECDH 
, encryption: 3DES 
, MAC: SHA1 
.
(c0,28)ECDHE-RSA-AES256-SHA384256 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA384 
.
(c0,27)ECDHE-RSA-AES128-SHA256128 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA256 
.
(c0,14)ECDHE-RSA-AES256-SHA256 BitKey exchange: ECDH 
, encryption: AES 
, MAC: SHA1 
.
(c0,13)ECDHE-RSA-AES128-SHA128 BitKey exchange: ECDH 
, encryption: AES 


[sqlite] SQLite crash

2015-08-11 Thread Dan Kennedy
On 08/11/2015 12:23 AM, Robert Weiss wrote:
> Dan Kennedy--
> What address, precisely, should I use to send the database to you?  When I 
> "reply" to your message I get the whole SQLite discussion group, which is 
> what I want to avoid (no offense intended, guys and gals).
> BTW, the problem does not seem to occur in version 3.8.10.2.
> Robert Weiss

Thanks for the database. We couldn't reproduce the problem here though.

The crash is repeatable, correct? Are you able to capture a stack trace 
from the command line shell with gdb?

Thanks,
Dan.


>
>
>   On Friday, August 7, 2015 11:31 PM, Dan Kennedy  gmail.com> wrote:
> 
>
>   On 08/08/2015 04:11 AM, Robert Weiss wrote:
>> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
>> OSwithout an error message) while running in a Cygwin shell under Windows 7 
>> when I tried to create anindex.  The source was compiled by gcc 4.9.2.  The 
>> same type of crashhappened when I tried the operation from a Lua script 
>> linked to the same objectlibrary.
>>
>>
>>
>> Here are the DDL statements entered previous to the crash:
>>
>>
>>
>> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>>
>> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>>
>> CREATE VIEW d200 as select * fromd200_on_passport;
>>
>>
>>
>> And here is the statement thatcaused the crash:
>>
>> create index d200_on_passport_fn ond200_on_passport(fn);
>>
>>
>>
>> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
>> database with the same ddlstatements but containing no data.
>>
>>
>> The compressed version of the database that illustrates the problem is a 
>> little smaller than 2 MB.  It contains some semi-personal information (it's 
>> part of an attempt to organize my photo library; pathnames hint at where 
>> I've been on vacation and so on, but the database contains no images) and 
>> I'd prefer not to post it to a list, but I can send it for use by those 
>> tracking down the bug.
>
> Can you send the database to me? Or to drh if that seems more prudent to
> you.
>
> Thanks,
> Dan.
>
>
>
>
>
>> Robert Weiss
>> ___
>> 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-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Simon Slavin

On 11 Aug 2015, at 3:11pm, Richard Hipp  wrote:

> The RC4 encryption algorithm consists of three subcomponents:
> 
> (1) Key management logic
> (2) The pseudo-random number generator (PRNG)
> (3) The encoder/decoder
> 
> SQLite only implements (2).  It omits (1) and (3).  And hence, the RC4
> kernel inside of SQLite cannot be used for encryption.

That's a far better argument.  Can that be made clear in the comments for 
random.c ?

Simon.


[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Simon Slavin

On 11 Aug 2015, at 1:30pm, Eric Hill  wrote:

> We're getting some pushback from our lawyers suggesting that SQLite's use of 
> RC4 even just to generate random numbers is, in their minds, encryption for 
> export purposes.  Now, this makes absolutely no sense to me, I can assure 
> you, and I am not finding anything online that would suggest that is a valid 
> position, but I'm wondering if this has come up before and if you have any 
> good ammunition for dealing with such an argument.

Sorry, but the use of the encryption code in the product doesn't matter because 
the purpose of SQlite is not covered by Note 4 (see below).  If the 
product-as-a-whole incorporates encryption code then it is covered by the law.  
But ... how serious is that for SQLite ?

First



and flowchart 1.  It seems we have to understand Note 4.  My conclusion is that 
SQLite is not covered by Note 4 because it is for "storing information".

So SQLite is controlled under Cat 5 Part 2 and we proceed to ...



and we easily find the top test in flowchart 2 linked to from the above page:



SQLite seems covered under self-registration rules under 740.17(b)(2) because 
it has "Cryptographic functionality or "encryption component" that is 
user-accessible and can be easily changed by the user." because its source code 
is public.

Consequently you may self-classify as DF002: "WITH an encryption registration".

To be covered in such a way SQLite documentation must make it clear that the 
'user' of SQLite is the programmer who incorporated it in their software, not 
the end-user of the software or the product that incorporates the software.  If 
this is not true then the 'user' of SQLite could be a non=programmer who would 
not understand the source code sufficiently to "easily" change it.

Since RC4 is used only to generate random numbers for a non-cryptographic 
purpose, it may be worth simply replacing that algorithm in random.c with one 
which does not resemble cryptography or bring cryptography to mind.  My 
understanding is that this would not need to involve any failure in backward or 
forward compatibility.

  The above information was provided for free and worth every penny.
  If you want good advice consult a good lawyer.

Simon.


[sqlite] SQLite crash

2015-08-11 Thread Joe Mistachkin

Robert Weiss wrote:
>
> [continuing from previous gdb output]:(gdb) thread apply all where 15
> Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc ()
> from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
> 

Anyhow, the cause of this appears to be the "sysfer.dll", which belongs to
Symantec Network Threat Protection (NTP):

http://www.symantec.com/connect/forums/weve-found-new-big-one#comment-504141
1

I'm not exactly sure what is causing the bad interaction here; however, it
is possible that Cygwin and Symantec are attempting to hook similar Win32
APIs, with unpredictable results.

Does this issue occur when running a build of SQLite on your machine without
Cygwin (i.e. built using MSVC)?

--
Joe Mistachkin



[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Neville Dastur
I think answer 27 of the FAQ https://www.sqlite.org/faq.html#q27 
 might help you.


> On 11 Aug 2015, at 13:30, Eric Hill  wrote:
> 
> Sorry to bother folks with this.
> 
> We're getting some pushback from our lawyers suggesting that SQLite's use of 
> RC4 even just to generate random numbers is, in their minds, encryption for 
> export purposes.  Now, this makes absolutely no sense to me, I can assure 
> you, and I am not finding anything online that would suggest that is a valid 
> position, but I'm wondering if this has come up before and if you have any 
> good ammunition for dealing with such an argument.
> 
> Thanks,
> 
> Eric
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Eric Hill
Sorry to bother folks with this.

We're getting some pushback from our lawyers suggesting that SQLite's use of 
RC4 even just to generate random numbers is, in their minds, encryption for 
export purposes.  Now, this makes absolutely no sense to me, I can assure you, 
and I am not finding anything online that would suggest that is a valid 
position, but I'm wondering if this has come up before and if you have any good 
ammunition for dealing with such an argument.

Thanks,

Eric


[sqlite] Regarding root in transitive closure extension of SQLite

2015-08-11 Thread Sairam Gaddam
> Hello !
>
> Look this comment on ext/misc/closure.c:
>
> --
>
> ** When it is created, the new transitive_closure table may be supplied
> ** with default values for the name of a table T and columns T.X and T.P.
> ** *The T.X and T.P columns must contain integers*.  The ideal case is
> for
> ** T.X to be the INTEGER PRIMARY KEY.  The T.P column should reference
> ** the T.X column. The row referenced by T.P is the parent of the current
> row
>

Can anyone kindly tell how to extent the support to other data types like
Text?


[sqlite] Regarding root in transitive closure extension of SQLite

2015-08-11 Thread Sairam Gaddam
>
> Given that SQLite supports CTE's now, why use that extension?
>
> AFAIK, it was to add hierarchical query capability to SQLite, which CTE
> does builtin now. --DD


But will that solve my problem of having the data type of groupId other
than Integer primary key like Text???


[sqlite] what is typical pattern for test double of sqlite c api

2015-08-11 Thread Adam Devita
Good day,

I'm about to implement TDD for an existing c project that uses sqlite,
using CPPUnit.  Sqlite would be a dependency from the point of view of
the routines making calls to it.

Is is typical to just write a link time stub to substitute commonly
used parts of the interface (exec, open, prepare, bind, step, reset,
finalize, close)  or is it easy to do something in the spirit of
1) include sqlite3Ext.h  in the TDD sources
2) #define SQLITE_CORE
3) and use run time substitution on the sqlite3_api_routines to point
at my test doubles?

regards,
Adam D.





-- 
--
VerifEye Technologies Inc.
151 Whitehall Dr. Unit 2
Markham, ON
L3R 9T1


[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Rowan Worth
On 11 August 2015 at 06:22, Simon Slavin  wrote:

> If you did set a timeout then SQLite wais a very short time (a millisecond
> ?) before it tries again, then it waits a little longer, then a little
> longer still, etc..  It gradually increases the time until the total time
> reaches the time you set.  It does not use the number you used as a guide
> for the short times is waits.
>

If you're building sqlite yourself, note that this backoff behaviour is
dependent on a specific preprocessor macro, HAVE_USLEEP. If not set,
sqlite's busy handler sleeps in _one second_ intervals, which is not ideal
for concurrent usage scenarios.

(The above only applies to non-windows platforms. On windows the
incremental backoff is always used.)

-Rowan


[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Richard Hipp
On 8/11/15, Eric Hill  wrote:
>
> We're getting some pushback from our lawyers suggesting that SQLite's use of
> RC4 even just to generate random numbers is, in their minds, encryption for
> export purposes.

No.

The RC4 encryption algorithm consists of three subcomponents:

(1) Key management logic
(2) The pseudo-random number generator (PRNG)
(3) The encoder/decoder

SQLite only implements (2).  It omits (1) and (3).  And hence, the RC4
kernel inside of SQLite cannot be used for encryption.

-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread ch
Hi,
I have similar problems. We have multiple connections to write to the database 
and the updates are surrounded by create&release savepoints. The issue is when 
two updates from different connections try to modify the database, the second 
operation gonna fail and it either returned database is busy or locked, while 
another operation just keeps occupying the database lock until it finishes. 
After the first operation finishes, the failed operation (a short update) tries 
again with creating a new savepoint but it still fails and after that any 
further operation cannot use the database anymore and all of them fail with 
SQLITE_BUSY or database locked. Is this because we don't create and handle 
savepoints correct? One way to avoid the continuous abort is we use begin 
transaction IMMEDIATE to wrap all our operations but it looks like our solution 
is bandage. I don't know what will be the best solution to solve our issue. If 
anyone could help answer it, I appreciate.
> Date: Mon, 10 Aug 2015 15:40:17 +0300
> From: dm3chip at gmail.com
> To: sqlite-users at mailinglists.sqlite.org
> Subject: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)
> 
> -- Forwarded message --
> From: ??? ??? 
> Date: 2015-08-10 0:37 GMT+03:00
> Subject: Problem with SQLite in C++. DB is BUSY (Multithread)
> To: sqlite-users at mailinglists.sqlite.org
> 
> 
> Hello!
> I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
> got error's *DB is locked error code 5*. As I know error code 5 means, that
> DB is busy. To solve this I started to use WAL journal mode. But it doesn't
> help.
> 
> In my program I've got 2 connections to the same db. I use mutexes for both
> DB connections.
> I'm opening connections with this code:
> 
> 
> 
> 
> 
> 
> 
> 
> *if (sqlite3_open_v2(db_path.c_str(), &this->db, SQLITE_OPEN_READWRITE |
> SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, 0) ) {
> LOG4CPLUS_FATAL(this->logger, "Can not open/create DB " <<
> sqlite3_errmsg(db));sqlite3_close(this->db);}if (sqlite3_exec(this->db,
> "PRAGMA journal_mode = WAL;", 0, 0, &err)) {
> LOG4CPLUS_ERROR(this->logger, "SQL det journal mode error: " << err);
> sqlite3_free(err);}*
> 
> First connection is used for inserting data to the DB. It happens with 4
> time every second.
> Second connection is used for starting transaction, selecting, updating,
> deleting data and committing. It happens every 5 seconds.
> 
> I'm getting errors from the first connection.
> 
> Please help me to solve this problem.
> 
> P.S. Sorry for my bad English
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Lawyers, encryption, and RC4

2015-08-11 Thread Brian Willner
Have you found yourself in an ITAR mess?
https://en.wikipedia.org/wiki/Export_of_cryptography_from_the_United_States

The length of the keys is usually the determining factor for EAR.  I'm not
an expert, but I'm guessing that is why they are concerned.

-Original Message-
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Eric Hill
Sent: Tuesday, August 11, 2015 8:31 AM
To: General Discussion of SQLite Database
Subject: [sqlite] Lawyers, encryption, and RC4

Sorry to bother folks with this.

We're getting some pushback from our lawyers suggesting that SQLite's use of
RC4 even just to generate random numbers is, in their minds, encryption for
export purposes.  Now, this makes absolutely no sense to me, I can assure
you, and I am not finding anything online that would suggest that is a valid
position, but I'm wondering if this has come up before and if you have any
good ammunition for dealing with such an argument.

Thanks,

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


[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Дмитрий Чепуровский
Thank you for answers, but I have already solved this problem. I set busy
timeout for both connections.

???, 11 ??? 2015 ?.  Simon Slavin ???:

>
> On 11 Aug 2015, at 2:28am, ch >
> wrote:
>
> > Is this because we don't create and handle savepoints correct?
>
> Have you set a timeout value using the routine I pointed to earlier ?  If
> not, do so.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org 
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Simon Slavin

On 11 Aug 2015, at 2:28am, ch  wrote:

> Is this because we don't create and handle savepoints correct?

Have you set a timeout value using the routine I pointed to earlier ?  If not, 
do so.

Simon.


[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Дмитрий Чепуровский
Thank you for help and explain WAL mode.

2015-08-11 1:22 GMT+03:00 Simon Slavin :

>
> On 10 Aug 2015, at 11:12pm, ??? ???  wrote:
>
> > But what is minimum period?
>
> The minimum period doesn't matter.
>
> The number you set the timeout to is the /maximum/ period.  SQLite will
> continue to try to access the file until that amount of time has passed.
> Then it will give up, returning an error.
>
> But SQLite does not start by waiting that amount of time.  SQLite starts
> off by trying to access the file immediately.  If that fails and you
> haven't set a timeout, then it returns an error.
>
> If you did set a timeout then SQLite wais a very short time (a millisecond
> ?) before it tries again, then it waits a little longer, then a little
> longer still, etc..  It gradually increases the time until the total time
> reaches the time you set.  It does not use the number you used as a guide
> for the short times is waits.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Дмитрий Чепуровский
But what is minimum period?

2015-08-11 0:56 GMT+03:00 Simon Slavin :

>
> On 10 Aug 2015, at 10:49pm, ??? ???  wrote:
>
> > When I set timeout to 12 ms (2 minutes). It starts work. But as I
> > understand from reading SQLite C interface, when DB in WAL journal mode
> it
> > should work without busytimeout.
> >
> > Can it work without busy timeout?
>
> It is correct that you should need to set a timeout.  There is always a
> period of negotiation about file access, and there is always a chance that
> two connections will try to do this at once.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Дмитрий Чепуровский
When I set timeout to 12 ms (2 minutes). It starts work. But as I
understand from reading SQLite C interface, when DB in WAL journal mode it
should work without busytimeout.

Can it work without busy timeout?

2015-08-10 17:11 GMT+03:00 Simon Slavin :

>
> On 9 Aug 2015, at 10:37pm, ??? ???  wrote:
>
> > I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
> > got error's *DB is locked error code 5*. As I know error code 5 means,
> that
> > DB is busy.
>
> For testings, please use
>
> 
>
> int sqlite3_busy_timeout(sqlite3*, int ms);
>
> with a timeout of a couple of minutes. (Really.  Minutes.)  You will need
> to set it on all connections, not just the one which is currently reporting
> errors.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread Teg
Hello ch,

I  ran  into  a  similar  problem when I was trying to use WAL mode. I
ended up just turning it off. It seemed that once there was contention
for  the  file  it never recovered. This was in windows. I didn't look
into  it  any  deeper  than this.  The same code works fine in journal
mode.  I  haven't  tried  it  again with the latest.I think I last
tested this in 3.8.8.2.

There's  typically  not  much more than 2-3 connections contending for
file  access  in my program. Most of the time it's only one connection
at a time.

I  assumed  it  was something I was doing because I wasn't reading any
other reports of it. 

C


Monday, August 10, 2015, 9:28:03 PM, you wrote:

c> Hi,
c> I have similar problems. We have multiple connections to write to
c> the database and the updates are surrounded by create&release
c> savepoints. The issue is when two updates from different
c> connections try to modify the database, the second operation gonna
c> fail and it either returned database is busy or locked, while
c> another operation just keeps occupying the database lock until it
c> finishes. After the first operation finishes, the failed operation
c> (a short update) tries again with creating a new savepoint but it
c> still fails and after that any further operation cannot use the
c> database anymore and all of them fail with SQLITE_BUSY or database
c> locked. Is this because we don't create and handle savepoints
c> correct? One way to avoid the continuous abort is we use begin
c> transaction IMMEDIATE to wrap all our operations but it looks like
c> our solution is bandage. I don't know what will be the best
c> solution to solve our issue. If anyone could help answer it, I appreciate.
>> Date: Mon, 10 Aug 2015 15:40:17 +0300
>> From: dm3chip at gmail.com
>> To: sqlite-users at mailinglists.sqlite.org
>> Subject: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY (Multithread)
>> 
>> -- Forwarded message --
>> From: ??? ??? 
>> Date: 2015-08-10 0:37 GMT+03:00
>> Subject: Problem with SQLite in C++. DB is BUSY (Multithread)
>> To: sqlite-users at mailinglists.sqlite.org
>> 
>> 
>> Hello!
>> I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
>> got error's *DB is locked error code 5*. As I know error code 5 means, that
>> DB is busy. To solve this I started to use WAL journal mode. But it doesn't
>> help.
>> 
>> In my program I've got 2 connections to the same db. I use mutexes for both
>> DB connections.
>> I'm opening connections with this code:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> *if (sqlite3_open_v2(db_path.c_str(), &this->db, SQLITE_OPEN_READWRITE |
>> SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, 0) ) {
>> LOG4CPLUS_FATAL(this->logger, "Can not open/create DB " <<
>> sqlite3_errmsg(db));sqlite3_close(this->db);}if (sqlite3_exec(this->db,
>> "PRAGMA journal_mode = WAL;", 0, 0, &err)) {
>> LOG4CPLUS_ERROR(this->logger, "SQL det journal mode error: " << err);
>> sqlite3_free(err);}*
>> 
>> First connection is used for inserting data to the DB. It happens with 4
>> time every second.
>> Second connection is used for starting transaction, selecting, updating,
>> deleting data and committing. It happens every 5 seconds.
>> 
>> I'm getting errors from the first connection.
>> 
>> Please help me to solve this problem.
>> 
>> P.S. Sorry for my bad English
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
c>   
c> ___
c> sqlite-users mailing list
c> sqlite-users at mailinglists.sqlite.org
c> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



-- 
 Tegmailto:Teg at djii.com



[sqlite] Problem with SQLite in C++. DB is BUSY (Multithread)

2015-08-11 Thread R.Smith


On 2015-08-10 11:49 PM, ??? ??? wrote:
> When I set timeout to 12 ms (2 minutes). It starts work. But as I
> understand from reading SQLite C interface, when DB in WAL journal mode it
> should work without busytimeout.
>
> Can it work without busy timeout?

It can work without Timeouts - the timeout setting is only to make 
SQLite wait a bit for the DB to become available if it is busy. If you 
want to work without timeouts, you have to check for "SQLITE_BUSY" 
messages and make your program wait and retry the operation. By setting 
a timeout, SQLite simply does this for you.

Also, your assumption about WAL mode is wrong: It allows reading from a 
second connection while writing on one connection, but not writing from 
a second connection. This includes starting immediate transactions 
(requiring a write-lock) from a second connection and such operations as 
DELETE and UPDATE which you say you do use.

There is no way you can do writing from 2 connections without checking 
for SQLITE_BUSY and waiting when it is busy.

Starting these write-operations from the second connection needs to wait 
until the DB is accessible, and once it started writing, then the first 
connection has to wait until the DB is accessible before it can write 
again - so you have to wait for the DB to be accessible. Setting a 
Timeout does this automatically for you.

More info here:
https://www.sqlite.org/wal.html#concurrency

As to the minimum period: There is no minimum period, you have to 
understand what your database will do and how long it will write, how 
slow is your disk/media and make a timeout that is suitable. You can 
make the timeout very large, but if something goes wrong, your program 
will "hang" until the time runs out before it gives an error - so don't 
make it too large - and - test it really well.


>
> 2015-08-10 17:11 GMT+03:00 Simon Slavin :
>
>> On 9 Aug 2015, at 10:37pm, ??? ???  wrote:
>>
>>> I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
>>> got error's *DB is locked error code 5*. As I know error code 5 means,
>> that
>>> DB is busy.
>> For testings, please use
>>
>> 
>>
>> int sqlite3_busy_timeout(sqlite3*, int ms);
>>
>> with a timeout of a couple of minutes. (Really.  Minutes.)  You will need
>> to set it on all connections, not just the one which is currently reporting
>> errors.
>>
>> 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