[sqlite] Connection string

2015-08-12 Thread Igor Tandetnik
On 8/12/2015 4:27 AM, faizel williams wrote:
> I would like to create a link table in MS Access to a SQLite database. (Not
> using ODBC driver)

This can't possibly work. Access doesn't have any built-in knowledge of 
SQLite - by what magic do you expect it to acquire the ability to 
understand SQLite database file format, or to know how to use SQLite API?

This is precisely the problem that ODBC was designed to solve. By making 
"no ODBC driver" a requirement, you are painting yourself into a corner.--
Igor Tandetnik



[sqlite] Lawyers, encryption, and RC4

2015-08-12 Thread Eric Hill
Thanks to everyone for their contributions on this topic.  I sent Dr. Hipp's 
explanation to our legal team, and that was good enough for them.  (This is a 
US company, for those who wondered.)

I agree with Simon that if that explanation could be added to the comment in 
random.c about the use of RC4, it could perhaps shortcut these legal 
discussions for others.

Thanks again!

Eric


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

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-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to enable shared cache mode?

2015-08-12 Thread Aaron Hudon
I'm looking for a way to enable the shared-cache locking model in 
system.data.sqlite.  http://www.sqlite.org/sharedcache.html

I've looked through the source, and see there is a method in 
UnsafeNativeMethods.cs that exposes this internally to the assembly, but 
nothing that's public.

E.g.
internal static extern SQLiteErrorCode sqlite3_enable_shared_cache(
int enable);


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

2015-08-12 Thread Andy Ling
> Actualy (maybe I wrong) but it leads to the same result in that case
> that using `reinterpret_cast`
> 
> my problem about doing that is I don't know if it's safe...
> I mean, should I not get some mess with some char code
> (UTF8)?
> 

You could create a new unsigned string type

typedef std::basic_string  ustring;

ustring s = sqlite3_column_text(..);

Maybe that would do what you want and preserve any
odd UTF8 characters.

Regards

Andy Ling
---
This email has been scanned for email related threats and delivered safely by 
Mimecast.
For more information please visit http://www.mimecast.com
---



[sqlite] Lawyers, encryption, and RC4

2015-08-12 Thread Simon Slavin

On 12 Aug 2015, at 2:45pm, Brian Willner  wrote:

> If you point out to your lawyers that SQLite is not doing anything that
> Apple's OS X is doing, you may get some traction as well.

Sorry to have to tell you that OS X /is/ registered for a US export licence, 
mostly for its incorporation of AES-256 and HTTPS.  So is iTunes (including the 
Windows version) perhaps because some of the DRM it has to handle involves 
encryption.

Simon.


[sqlite] Lawyers, encryption, and RC4

2015-08-12 Thread Simon Slavin

On 11 Aug 2015, at 3:00pm, Rob Willett  wrote:

> 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. 

While it is allowable to export software incorporating short key lengths, it 
can still be necessary to register.  And the registration (which can require 
yearly reregistration) is extra annoying work to go through.  It's difficult 
even to figure out how the software should be registered.  And it can involve 
lawyers, which is expensive.

I prefer Dr Hipp's argument that to incorporate RC4 encryption SQLite would 
have to actually be able to encode stuff using RC4, and it can't.  It just uses 
one of the algorithms specified in RC4 to pick random numbers.

The encrypting addon to SQLite ('SEE') is, of course, another matter, and 
encryption code from it is not incorporated into normal SQLite.

Simon.


[sqlite] Using SQLite in a multi-threaded environment

2015-08-12 Thread Kai Kratz
Dear all,

I have a (probably) very basic question regarding the usage of SQLite in an
multithreaded environment.

I use a compiled version of SQLite with SQLITE_THREADSAFE 0. Inside my
application exists one thread that is the exclusive user of the SQLite
interface. So from my point of view I am using SQLite as if it was used in
a single threaded application.

The documentation regarding threadsavety reads:

SQLite support three different threading modes:

   1.

   *Single-thread*. In this mode, all mutexes are disabled and SQLite is
   unsafe to use in more than a single thread at once.
   2.

   *Multi-thread*. In this mode, SQLite can be safely used by multiple
   threads provided that no single database connection is used simultaneously
   in two or more threads.
   3.

   *Serialized*. In serialized mode, SQLite can be safely used by multiple
   threads with no restriction.


So the first question would be: Is my understanding correct that if i only
use SQLite from one exclusive thread SQLITE_THREADSAFE 0 is save to use?

I am asking because due to a unrelated bug in my application I had switched
from using strerror to the threadsafe variant strerror_r. During this
change I noticed that SQLite uses strerror if it is compiled with
SQLITE_THREADSAFE 0.

Given the wording above, shouldn't SQLite use strerror_r? Am I missing
something? Should (1) only be used for single threaded applications? If yes
maybe the wording should be updated to reflect this explicitly.

Your help is very much appreciated.

Cheers
Kai


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

2015-08-12 Thread Nicolas Jäger
thx Andy,
I'll keep that one close. When my program will be ready to perform some
tests with UTF8 encoding, I'll try your solution.

regards,
Nicolas


Le Wed, 12 Aug 2015 16:02:54 +,
Andy Ling  a ?crit :

> > Actualy (maybe I wrong) but it leads to the same result in that case
> > that using `reinterpret_cast`
> > 
> > my problem about doing that is I don't know if it's safe...
> > I mean, should I not get some mess with some char code
> > (UTF8)?
> > 
> 
> You could create a new unsigned string type
> 
> typedef std::basic_string  ustring;
> 
> ustring s = sqlite3_column_text(..);
> 
> Maybe that would do what you want and preserve any
> odd UTF8 characters.
> 
> Regards
> 
> Andy Ling
> ---
> This email has been scanned for email related threats and delivered
> safely by Mimecast. For more information please visit
> http://www.mimecast.com
> ---
> 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Small bug in ".dump", ".schema" and ".fullschema"

2015-08-12 Thread Tony Papadimitriou
I tried your example.

'.schema' and '.fullschema' do show the problem you describe.

However, for me, '.dump' worked correctly placing the semicolon on a line by 
itself right after the comment.

- Original Message - 
From: "sqlite-mail" 
To: 
Sent: Wednesday, August 12, 2015 1:14 AM
Subject: [sqlite] Small bug in ".dump", ".schema" and ".fullschema"


> Hello !
>
> Working with sqlite3 I noticed that sqlite3 ".dump", ".schema" and
> ".fullschema" outputs the contents of the field "sql" stored in
> "sqlite_master" and if the sql statement ends with a comment the resulted
> dump will be invalid see example:
>
> CREATE VIEW "event_event_ticket_list_view" AS
> SELECT a."id", a."name", a."price", a."deadline", a."seats_max",
> a."product_id", a."event_id"
> FROM "event_event_ticket" AS a
> --LEFT JOIN "product_product" AS b ON a."product_id" = b."id"; <
> here is the problem



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

2015-08-12 Thread Nicolas Jäger
Hi,
Actualy (maybe I wrong) but it leads to the same result in that case
that using `reinterpret_cast`

my problem about doing that is I don't know if it's safe...
I mean, should I not get some mess with some char code
(UTF8)?

I was expecting some people already did a such cast in the
past and just tell me quickly what strategy I should  use.

Anyway, don't waste your time on that, I stay with my solution and I'll
see in the future if I get some issue.

thank you John.

regards,
Nicolas


Le Wed, 12 Aug 2015 08:50:26 -0500,
John McKown  a ?crit :

> On Tue, Aug 11, 2015 at 9:06 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.
> >
> 
> ?Hi! Idiot me again after a bit of sleep. Have you considered casting
> away the "unsigned"-ness?
> 
> const char *someVar = (const char *) sqlite3_column_text(...)?
> 
> ?;
> std::string some?String(someVar);
> 



[sqlite] Connection string

2015-08-12 Thread faizel williams
Hi,

I would like to create a link table in MS Access to a SQLite database. (Not
using ODBC driver)
The following code works in MS Access, but link table are in another MS
Acces database

Private Sub CreateAccessLinkTable(ByVal stmtHandle As Long, newTableName As
String)
Dim td As DAO.TableDef
Dim colCount As Long
Dim colValue As Variant
Dim i As Long
Dim dbsCurrent As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim strDbFile As String
Dim strLinkName As String
Dim strPassword As String
Dim strSourceTableName As String

strDbFile = "C:\Test\Data.mdb"
strSourceTableName = "authorizationActions"
strLinkName = "authorizationActions"

 strConnect = "MS Access" & _
";DATABASE=" & strDbFile

Set dbsCurrent = CurrentDb
Set tdf = dbsCurrent.CreateTableDef

tdf.Connect = strConnect
tdf.SourceTableName = strSourceTableName
tdf.Name = strLinkName
dbsCurrent.TableDefs.Append tdf

   End Sub

I would like to do the same, but I'm missing the connection string for the
(Dim td As DAO.TableDef) td.Connect - for the SQLite connection.

Private Sub CreateLocalLinkTable(ByVal stmtHandle As Long, newTableName As
String)
Dim td As DAO.TableDef
Dim colCount As Long
Dim colValue As Variant
Dim i As Long
Dim dbsCurrent As DAO.Database

If myDbHandle = 0 Then Err.Raise 99, , "database not open"
colCount = SQLite3ColumnCount(stmtHandle)

' Create Table
Set dbsCurrent = CurrentDb
Set td = dbsCurrent.CreateTableDef

td.Connect = ?? (Not with ODBC
- must be from SQLite.DLL)
td.SourceTableName = newTableName
td.Name = newTableName
dbsCurrent.TableDefs.Append td
End Sub


[sqlite] Lawyers, encryption, and RC4

2015-08-12 Thread Brian Willner
"Several operating systems include arc4random, an API originating in OpenBSD
providing access to a random number generator originally based on RC4. In
OpenBSD 5.5, released in May 2014, arc4random was modified to use
ChaCha20.[11][12] As of January 2015, implementation of arc4random in
NetBSD[13][14] also uses ChaCha20, however, implementation of arc4random in
FreeBSD,[15] Linux's libbsd,[16] and Mac OS X[17] are still based on RC4." 
Sourced: https://en.wikipedia.org/wiki/RC4

If you point out to your lawyers that SQLite is not doing anything that
Apple's OS X is doing, you may get some traction as well.

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

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-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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

2015-08-12 Thread John McKown
On Tue, Aug 11, 2015 at 9:06 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.
>

?Hi! Idiot me again after a bit of sleep. Have you considered casting away
the "unsigned"-ness?

const char *someVar = (const char *) sqlite3_column_text(...)?

?;
std::string some?String(someVar);

-- 

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] Lawyers, encryption, and RC4

2015-08-12 Thread John McKown
Just speaking as a cantankerous old cynic, I wonder how much of this is
being driven by a real concern and how much is being driven by someone with
an agenda to use a "more favored" product. I've been pushed even further in
the latter direction, in general, when I learned from a person who was
evaluating a new server that they had decided against it because "It's not
made by MicroSoft." Not that it was too expensive. Or didn't do the job.
Just that it was not by the "most favored" vendor.


-- 

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-12 Thread ch
We tried already, still fail without correct recovery. 

> From: slavins at bigfraud.org
> Date: Tue, 11 Aug 2015 03:43:59 +0100
> To: sqlite-users at mailinglists.sqlite.org
> Subject: Re: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY 
> (Multithread)
> 
> 
> 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] SQLite crash

2015-08-12 Thread Dan Kennedy
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 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 ?? ()

What does typing this command at the (gdb) prompt after the crash output?

   thread apply all where 15

Or, if that doesn't work, just "where 15".

Thanks,
Dan.



>
>
>   On Tuesday, August 11, 2015 1:43 AM, Dan Kennedy  gmail.com> 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
> 

[sqlite] Site unavailable.

2015-08-12 Thread Дмитрий Чепуровский
In Russia when I'm trying to visit sqlite.org site, I'm getting conection
timeout.

Also, sqlite.org doesn't pinged.


[sqlite] Site unavailable.

2015-08-12 Thread Simon Slavin

On 12 Aug 2015, at 12:18am, ??? ???  wrote:

> In Russia when I'm trying to visit sqlite.org site, I'm getting conection
> timeout.
> 
> Also, sqlite.org doesn't pinged.

The web site is accessible from western Europe.  And I can reach Moscow State 
University so it doesn't seem to be a netsplit.  Thanks for the report anyway.

Simon.


[sqlite] Small bug in ".dump", ".schema" and ".fullschema"

2015-08-12 Thread sqlite-mail
Hello !  

Working with sqlite3 I noticed that sqlite3 ".dump", ".schema" and
".fullschema" outputs the contents of the field "sql" stored in
"sqlite_master" and if the sql statement ends with a comment the resulted
dump will be invalid see example:  

=== valid sql statement stored on sqlite_master  

CREATE VIEW "event_event_ticket_list_view" AS
SELECT a."id", a."name", a."price", a."deadline", a."seats_max",
a."product_id", a."event_id"
FROM "event_event_ticket" AS a
--LEFT JOIN "product_product" AS b ON a."product_id" = b."id"  

===  

?  

Sqlite3 only adds a semicolon to the value of "sql" field and in this case we
have an unterminated statement.  

=== the above sql statement dumped by sqlite3  

CREATE VIEW "event_event_ticket_list_view" AS
SELECT a."id", a."name", a."price", a."deadline", a."seats_max",
a."product_id", a."event_id"
FROM "event_event_ticket" AS a
--LEFT JOIN "product_product" AS b ON a."product_id" = b."id";?? <
here is the problem  

===  

?  

Cheers !


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

2015-08-12 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