Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Bo Peng
>> In any case, you set the cache size in pages by executing "PRAGMA 
>> cache_size=" after opening the database connection.

I am using "PRAGMA cache_size=-300" to set the cache to 3G, but
the process is still slow-going using 23M of RAM, despite the fact
that it is reading small pieces of all tables of a database of 62G...
I will try to see what is going on.

Cheers,
Bo
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Pavel Ivanov
On Mon, Jun 25, 2012 at 10:05 PM, Bo Peng  wrote:
>> Are these multiple tables in a single database (file), or multiple databases 
>> (files)?  Multiple connections or a single connection?
>
> Right now there are multiple read-only processes to read the same
> file. If I go with any RAM-based solution, I will have to use a single
> process to read database and feed the data to calculation processes.
>
>> In any case, you set the cache size in pages by executing "PRAGMA 
>> cache_size=" after opening the database connection.
>>
>> You can test it without modifying your code by executing "PRAGMA 
>> default_cache_size=;" against the database file using the shell.
>>
>> The default sqlite page cache per database connection is 2000 pages.  So the 
>> maximum memory used by sqlite for the page cache is  page_size * cache_size. 
>>  You can query these with "pragma page_size" and query/set the cache size 
>> with "pragma cache_size".
>
> This is a great idea because ideally I can load all database to cache
> if there are enough RAM. However, I am wondering if extra-large cache
> might actually hurt the performance if cached pages have to be
> consecutive. I mean, if there are 100,000 pages and I specify a cache
> to hold 40,000 pages. When I get the first and last table, will sqlite
> load the first 40,000 pages, read the first table, read the last
> 40,000 pages, and load the last table? I guess (and hope) sqlite is
> cleverer than that...

Yes, SQLite is better than that. Even for one table it loads into
cache only those pages which are needed to execute query, nothing
more.


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


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Bo Peng
> Are these multiple tables in a single database (file), or multiple databases 
> (files)?  Multiple connections or a single connection?

Right now there are multiple read-only processes to read the same
file. If I go with any RAM-based solution, I will have to use a single
process to read database and feed the data to calculation processes.

> In any case, you set the cache size in pages by executing "PRAGMA 
> cache_size=" after opening the database connection.
>
> You can test it without modifying your code by executing "PRAGMA 
> default_cache_size=;" against the database file using the shell.
>
> The default sqlite page cache per database connection is 2000 pages.  So the 
> maximum memory used by sqlite for the page cache is  page_size * cache_size.  
> You can query these with "pragma page_size" and query/set the cache size with 
> "pragma cache_size".

This is a great idea because ideally I can load all database to cache
if there are enough RAM. However, I am wondering if extra-large cache
might actually hurt the performance if cached pages have to be
consecutive. I mean, if there are 100,000 pages and I specify a cache
to hold 40,000 pages. When I get the first and last table, will sqlite
load the first 40,000 pages, read the first table, read the last
40,000 pages, and load the last table? I guess (and hope) sqlite is
cleverer than that...

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


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Keith Medcalf

Are these multiple tables in a single database (file), or multiple databases 
(files)?  Multiple connections or a single connection?

In any case, you set the cache size in pages by executing "PRAGMA 
cache_size=" after opening the database connection.  

You can test it without modifying your code by executing "PRAGMA 
default_cache_size=;" against the database file using the shell.

The default sqlite page cache per database connection is 2000 pages.  So the 
maximum memory used by sqlite for the page cache is  page_size * cache_size.  
You can query these with "pragma page_size" and query/set the cache size with 
"pragma cache_size".

Also note that the page_cache tied to the connection.

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Bo Peng
> Sent: Monday, 25 June, 2012 19:34
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] How to know the memory usage of an in-memory database.
> 
> On Mon, Jun 25, 2012 at 8:29 PM, Keith Medcalf  wrote:
> > What OS is it that does not have a block disk cache?
> >
> > Have you tried simply allocating a large page cache?
> 
> The application is cross-platform (python / sqlite / C). I frankly do
> not know how to create large page cache to accomplish what I need.
> Could you elaborate?
> 
> Thanks,
> Bo
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Bo Peng
> Most of the problem is that by keeping the data in separate tables, you are 
> ensuring that you almost never get hits from cache.  Do these tables need to 
> be separate or can you merge them on disk ?  Do they have the same columns ?

Unfortunately these tables can have slightly different structures so
merging them is not possible.

>> Because some users have slow disks and plenty of RAM (e.g. on a
>> high-mem cluster system), I would like to create an in-memory database
>> to cache frequently accessed tables. For example, if the user tells me
>> he can allocate 20G RAM to cache the tables, I will create a :memory:
>> database and use it to cache tables until the database reaches 20G in
>> size. The question is: How do I know the size of an in-memory database
>> so that I can keep it under the specified size?
>
> I believe you can multiply the page count by the page size:
>
> PRAGMA page_count
> PRAGMA page_size
>
> Does anyone know if the format "PRAGMA memory.page_count" is what works ?

Thank you very much! I will try these PRAGMAs.

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


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Bo Peng
On Mon, Jun 25, 2012 at 8:29 PM, Keith Medcalf  wrote:
> What OS is it that does not have a block disk cache?
>
> Have you tried simply allocating a large page cache?

The application is cross-platform (python / sqlite / C). I frankly do
not know how to create large page cache to accomplish what I need.
Could you elaborate?

Thanks,
Bo
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Simon Slavin

On 26 Jun 2012, at 2:07am, Bo Peng  wrote:

> My application needs to run a lot of queries from a large sqlite
> database (>100G) with many small tables (>10,000). The performance of
> the queries are acceptable if the database is on a SSD drive, but can
> be 50 times or more slower on a regular or network drive.

Most of the problem is that by keeping the data in separate tables, you are 
ensuring that you almost never get hits from cache.  Do these tables need to be 
separate or can you merge them on disk ?  Do they have the same columns ?

> Because some users have slow disks and plenty of RAM (e.g. on a
> high-mem cluster system), I would like to create an in-memory database
> to cache frequently accessed tables. For example, if the user tells me
> he can allocate 20G RAM to cache the tables, I will create a :memory:
> database and use it to cache tables until the database reaches 20G in
> size. The question is: How do I know the size of an in-memory database
> so that I can keep it under the specified size?

I believe you can multiply the page count by the page size:

PRAGMA page_count
PRAGMA page_size

Does anyone know if the format "PRAGMA memory.page_count" is what works ?

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


Re: [sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Keith Medcalf
> My application needs to run a lot of queries from a large sqlite
> database (>100G) with many small tables (>10,000). The performance of
> the queries are acceptable if the database is on a SSD drive, but can
> be 50 times or more slower on a regular or network drive.
 
> Because some users have slow disks and plenty of RAM (e.g. on a
> high-mem cluster system), I would like to create an in-memory database
> to cache frequently accessed tables. For example, if the user tells me
> he can allocate 20G RAM to cache the tables, I will create a :memory:
> database and use it to cache tables until the database reaches 20G in
> size. The question is: How do I know the size of an in-memory database
> so that I can keep it under the specified size?

What OS is it that does not have a block disk cache?

Have you tried simply allocating a large page cache?




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


[sqlite] How to know the memory usage of an in-memory database.

2012-06-25 Thread Bo Peng
Dear sqlite experts,

My application needs to run a lot of queries from a large sqlite
database (>100G) with many small tables (>10,000). The performance of
the queries are acceptable if the database is on a SSD drive, but can
be 50 times or more slower on a regular or network drive.

Because some users have slow disks and plenty of RAM (e.g. on a
high-mem cluster system), I would like to create an in-memory database
to cache frequently accessed tables. For example, if the user tells me
he can allocate 20G RAM to cache the tables, I will create a :memory:
database and use it to cache tables until the database reaches 20G in
size. The question is: How do I know the size of an in-memory database
so that I can keep it under the specified size?

Many thanks in advance,
Bo
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread Keith Medcalf
> Im using MSVS 2010 for an c++ GUI project.
> After including sqlite3.h and sqlite3.c from the amalgamation-3071200
> and with the Project Properties--> C/C++  --> Precompiled Headers -->
> Precompiled Header --> Use (/Yu)
> I get the error
> sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled
> header file is from a previous version of the compiler, or the
> precompiled header is C++ and you are using it from C (or vice versa)

> If I change to Precompiled Header --> Create (/Yc)
> I get the error
> sqlite3.c(136660): error C2857: '#include' statement specified with the
> /YcStdAfx.h command-line option was not found in the source file

> How can I solve this problem ?

cl /nologo /Oxity /Ob2 /GLFAy /MD sqlite3.c /Fesqlite3.dll

add defines as required or

cl /nologo /D_HAVE_SQLITE_CONFIG_H /Oxity /Ob2 /GLFAy /MD sqlite3.c 
/Fesqlite3.dll

and put your sqlite #define's in "config.h"




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


Re: [sqlite] C++ - ISERT from a data object

2012-06-25 Thread Keith Medcalf
> >> are not very useful in a real life C++ GUI  application.
> > That thing you quoted above ... the thing between the double quotes ... is
> a string.  You can make up the string yourself by concatenating several
> strings together.
 
> I may be a bit oversensitive here, but that seems like an incredibly bad
> thing to suggest, even in jest. People will do it and yet more SQL
> Injection attacks will appear.

http://xkcd.com/327/

Sorry, couldn't resist.  Now back to your regularly scheduled programming ...




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


Re: [sqlite] C++ - ISERT from a data object

2012-06-25 Thread Arbol One
My friend, heavens awaits you.
Outstanding!
Thanks man!

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 7:32 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ - ISERT from a data object

Arbol One  wrote:
> In my GUI application the user enters a information that will go in a 
> SQLite database table, so statements like:
> 
> string dbdata = "INSERT INTO friend (name, address, age) VALUES 
> ('Caramba',
> '490 New Bridge', '49')";
> 
> 
> 
> are not very useful in a real life C++ GUI  application. I would 
> assume that SQLite has functions to submit information in the form of 
> string object  to a table

sqlite_stmt* stmt;
sqlite3_prepare_v2(db, "insert into friend(name, address, age) values (?, ?,
?);", -1, , NULL);

string name = "Caramba";
string address = "490 New Bridge";
int age = 49;

sqlite3_bind_text(stmt, 1, name.c_str(), name.length(), SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, address.c_str(), address.length(),
SQLITE_STATIC); sqlite3_bind_int(stmt, 3, age);

sqlite3_step(stmt);
sqlite3_finalize(stmt);

--
Igor Tandetnik

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

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


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread Teg

AD> Do not use precompiled headers on sqlite3.c

This.  My Sqlite is in it's own library project so, it can have
different precompiled header settings than my other projects. About
80% of my projects use procompiled headers, the other 20 are typically
made of code like Sqlite which don't have built in support for PCH.

You can probably make it work if you really want to by including
"Stdafx.h" at the top of the amalgamation C file. You'll have to do
this every time you upgrade though.

C


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


Re: [sqlite] C++ - ISERT from a data object

2012-06-25 Thread Igor Tandetnik
Arbol One  wrote:
> In my GUI application the user enters a information that will go in a SQLite
> database table, so statements like:
> 
> string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba',
> '490 New Bridge', '49')";
> 
> 
> 
> are not very useful in a real life C++ GUI  application. I would assume that
> SQLite has functions to submit information in the form of string object  to
> a table

sqlite_stmt* stmt;
sqlite3_prepare_v2(db, "insert into friend(name, address, age) values (?, ?, 
?);", -1, , NULL);

string name = "Caramba";
string address = "490 New Bridge";
int age = 49;

sqlite3_bind_text(stmt, 1, name.c_str(), name.length(), SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, address.c_str(), address.length(), SQLITE_STATIC);
sqlite3_bind_int(stmt, 3, age);

sqlite3_step(stmt);
sqlite3_finalize(stmt);

-- 
Igor Tandetnik

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


Re: [sqlite] C++ - ISERT from a data object

2012-06-25 Thread Robert Myers

On 6/25/2012 5:58 PM, Simon Slavin wrote:

On 25 Jun 2012, at 11:36pm, Arbol One  wrote:


In my GUI application the user enters a information that will go in a SQLite
database table, so statements like:

string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba',
'490 New Bridge', '49')";

are not very useful in a real life C++ GUI  application.

That thing you quoted above ... the thing between the double quotes ... is a 
string.  You can make up the string yourself by concatenating several strings 
together.


I may be a bit oversensitive here, but that seems like an incredibly bad 
thing to suggest, even in jest. People will do it and yet more SQL 
Injection attacks will appear.


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


Re: [sqlite] C++ - ISERT from a data object

2012-06-25 Thread Simon Slavin

On 25 Jun 2012, at 11:36pm, Arbol One  wrote:

> In my GUI application the user enters a information that will go in a SQLite
> database table, so statements like:
> 
> string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba',
> '490 New Bridge', '49')";
> 
> are not very useful in a real life C++ GUI  application.

That thing you quoted above ... the thing between the double quotes ... is a 
string.  You can make up the string yourself by concatenating several strings 
together.

> I would assume that
> SQLite has functions to submit information in the form of string object  to
> a table

You already know how to use _prepare.  Now see how to use wildcards in it and 
bind values to them:



Simon.

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


[sqlite] C++ - ISERT from a data object

2012-06-25 Thread Arbol One
In my GUI application the user enters a information that will go in a SQLite
database table, so statements like:

string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba',
'490 New Bridge', '49')";

 

are not very useful in a real life C++ GUI  application. I would assume that
SQLite has functions to submit information in the form of string object  to
a table i.e.:

--snip--

std::string name;

int age;

sqlite3_submit_data_text(db, table, name, ..);

sqlite3_submit_data_int(db, table, age, ..);

 

What is the C++ API for entering data to a table?

 

Thanks!!

 

Freedom of speech does not translate to freedom of insulting

 

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


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread deltagam...@gmx.net

Am 25.06.2012 22:18, schrieb John Drescher:

On Mon, Jun 25, 2012 at 4:15 PM, deltagam...@gmx.net
 wrote:

Hello,

Im using MSVS 2010 for an c++ GUI project.
After including sqlite3.h and sqlite3.c from the amalgamation-3071200
and with the Project Properties--> C/C++  --> Precompiled Headers -->
Precompiled Header --> Use (/Yu)
I get the error
sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled header
file is from a previous version of the compiler, or the precompiled header
is C++ and you are using it from C (or vice versa)

This is something I see with Visual Studio from time to time (not with
sqlite but I use that with Qt):

Delete Debug\Contegos_UI.pch

and try again.

John


Hello John,
deleting the pch file did not lead to success.
In another non-GUI project , i did succeed by deleting the whole 
build-branch, nor only the pch file. And setting the Create (/Yc) option

But here it does not work.


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


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread Adam DeVita
Do not use precompiled headers on sqlite3.c

On Mon, Jun 25, 2012 at 4:22 PM, Pavel Ivanov  wrote:

> On Mon, Jun 25, 2012 at 4:15 PM, deltagam...@gmx.net
>  wrote:
> > Hello,
> >
> > Im using MSVS 2010 for an c++ GUI project.
> > After including sqlite3.h and sqlite3.c from the amalgamation-3071200
> > and with the Project Properties--> C/C++  --> Precompiled Headers -->
> > Precompiled Header --> Use (/Yu)
> > I get the error
> > sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled header
> > file is from a previous version of the compiler, or the precompiled
> header
> > is C++ and you are using it from C (or vice versa)
> >
> > If I change to Precompiled Header --> Create (/Yc)
> > I get the error
> > sqlite3.c(136660): error C2857: '#include' statement specified with the
> > /YcStdAfx.h command-line option was not found in the source file
> >
> >
> > How can I solve this problem ?
>
> Change it to Precompiled Header --> Not Using Precompiled Headers.
> Because you won't use the same headers to compile your application and
> sqlite3.c.
>
>
> Pavel
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
VerifEye Technologies Inc.
905-948-0015x245
151 Whitehall Dr, Unit 2
Markham ON, L3R 9T1
Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread Pavel Ivanov
On Mon, Jun 25, 2012 at 4:15 PM, deltagam...@gmx.net
 wrote:
> Hello,
>
> Im using MSVS 2010 for an c++ GUI project.
> After including sqlite3.h and sqlite3.c from the amalgamation-3071200
> and with the Project Properties--> C/C++  --> Precompiled Headers -->
> Precompiled Header --> Use (/Yu)
> I get the error
> sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled header
> file is from a previous version of the compiler, or the precompiled header
> is C++ and you are using it from C (or vice versa)
>
> If I change to Precompiled Header --> Create (/Yc)
> I get the error
> sqlite3.c(136660): error C2857: '#include' statement specified with the
> /YcStdAfx.h command-line option was not found in the source file
>
>
> How can I solve this problem ?

Change it to Precompiled Header --> Not Using Precompiled Headers.
Because you won't use the same headers to compile your application and
sqlite3.c.


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


Re: [sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread John Drescher
On Mon, Jun 25, 2012 at 4:15 PM, deltagam...@gmx.net
 wrote:
> Hello,
>
> Im using MSVS 2010 for an c++ GUI project.
> After including sqlite3.h and sqlite3.c from the amalgamation-3071200
> and with the Project Properties--> C/C++  --> Precompiled Headers -->
> Precompiled Header --> Use (/Yu)
> I get the error
> sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled header
> file is from a previous version of the compiler, or the precompiled header
> is C++ and you are using it from C (or vice versa)

This is something I see with Visual Studio from time to time (not with
sqlite but I use that with Qt):

Delete Debug\Contegos_UI.pch

and try again.

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


[sqlite] Problem with including sqlite3.c into c++ project

2012-06-25 Thread deltagam...@gmx.net

Hello,

Im using MSVS 2010 for an c++ GUI project.
After including sqlite3.h and sqlite3.c from the amalgamation-3071200
and with the Project Properties--> C/C++  --> Precompiled Headers --> 
Precompiled Header --> Use (/Yu)

I get the error
sqlite3.c : fatal error C1853: 'Debug\Contegos_UI.pch' precompiled 
header file is from a previous version of the compiler, or the 
precompiled header is C++ and you are using it from C (or vice versa)


If I change to Precompiled Header --> Create (/Yc)
I get the error
sqlite3.c(136660): error C2857: '#include' statement specified with the 
/YcStdAfx.h command-line option was not found in the source file



How can I solve this problem ?


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


Re: [sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 25/06/12 11:21, Andrew Rondeau wrote:
> IMO, I've been somewhat dissapointed with sqlite's deployment scenario
> on Windows. Perhaps this is an area that needs a bit more community 
> involvement?

You really are looking this the wrong way.  SQLite's source is as close to
public domain as you can get, and the amalgamation means there is only one
source file to deal with.

You can do whatever you want - you don't need anyone else's permission or
cooperation.  Why do you want to gate your usage through other people with
their own priorities and availability?

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/ovYEACgkQmOOfHg372QQrOACffzSBY6ZTR6/M6QrN4yxresMc
encAoLOLW8GQs7tVMHCur9jxt0uBCIra
=IV37
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Arbol One
Yes, yes!!
thank you, now I understand!!
Superb!
Thanks Michael!

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS)
Sent: Monday, June 25, 2012 11:03 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] C++ programming - Extracting data

You were doing two sqlite3_step()'s instead of one.  So you skipped the one
record you had inserted.

You can run this multiple times and you;; see error messages about the
create table on 2nd and subsequent runs.

Still adds the same record though so you'll see +1 records get printed out
for every time you run it.



Here's a complete working example:



#include 
#include "sqlite3.h"

using namespace std;

// TEST BENCH
// 1. Create/Open a database 'db'
// 2. Add a table in the database 'friend'
// 3. add data to table friend
// 4. Extract the data from table friend and display it

sqlite3 *db;

void OpenDB() {
  int rc;
  string dbName = "arbol.db";
  rc = sqlite3_open_v2(dbName.c_str(),
   , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
   NULL);
  if(rc != SQLITE_OK) { /* display error msg */
cerr << "Error???" << endl;
  }
}
void CreateTable() {
  string create_table = "CREATE TABLE friend (name TEXT, address TEXT, age
INT)";
  sqlite3_stmt *stmt;

  int rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
  if(rc != SQLITE_OK) {
cerr << "Error1: " << sqlite3_errmsg(db) << endl;
  }

  rc = sqlite3_step(stmt);
  if(rc != SQLITE_DONE) {
cerr << "Error2: " << sqlite3_errmsg(db) << endl;
  }
  sqlite3_finalize(stmt);
}
void Setter() {
  string Name;
  sqlite3_stmt *stmt;
  string dbdata = "INSERT INTO friend (name, address, age) VALUES
('Caramba', '490 New Bridge', '49')";
  int rc = sqlite3_prepare_v2(db,
dbdata.c_str(),dbdata.length(),,NULL);
  if(rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  rc = sqlite3_step(stmt);
  if(rc != SQLITE_DONE) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  sqlite3_finalize(stmt);
}
void getter() {
  string sName;
  string dbdata = "SELECT * FROM friend";
  sqlite3_stmt *stmt;

  int rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
  if(rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  while (sqlite3_step(stmt) == SQLITE_ROW) {
sName = (char*)sqlite3_column_text(stmt, 0);
//obj.Display(sName); //<== this is not display
cout << "sName=" << sName << endl;
  }
  sqlite3_finalize(stmt);
}
void theDestructor() {
  int rc=sqlite3_close(db);
  if (rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
}

int main() {
  OpenDB();
  CreateTable();
  Setter();
  getter();
  theDestructor();
  return 0;
}



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
behalf of Arbol One [arbol...@gmail.com]
Sent: Monday, June 25, 2012 9:30 AM
To: 'General Discussion of SQLite Database'
Subject: EXT :Re: [sqlite] C++ programming - Extracting data

I did what you suggested, you were right, now the exception is gone, but the
program now does not display anything, it just goes to the end of the
method.
Here is a more complete snip of the test bench program. I really hope that
someone here can help resolve this issue.

// TEST BENCH
// 1. Create/Open a database 'db'
// 2. Add a table in the database 'friend'
// 3. add data to table friend
// 4. Extract the data from table friend and display it

OpenDB() {
rc = sqlite3_open_v2(dbName.c_str(),
 , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
 NULL);
if(rc != SQLITE_OK) { /* display error msg */ }

}
CreateTable() {
create_table = "CREATE TABLE friend (name TEXT, address TEXT, age INT)";

rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */ }
sqlite3_finalize(stmt);
}
Setter() {
string Name;
string dbdata = "INSERT INTO friend (name, address, age) VALUES
('Caramba', '490 New Bridge', '49')";
rc = sqlite3_prepare_v2(db, bdata.c_str(),dbdata.length(),,NULL);
if(rc != SQLITE_OK) { /* display error msg */ }
.
rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */}

sqlite3_finalize(stmt);
}
getter() {
string sName;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != (SQLITE_DONE) && rc != (SQLITE_ROW)){ ... }
while (sqlite3_step(stmt) == SQLITE_ROW) {
sName = (char*)sqlite3_column_text(stmt, 0);

Re: [sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread Andrew Rondeau
IMO, I've been somewhat dissapointed with sqlite's deployment scenario on
Windows. Perhaps this is an area that needs a bit more community
involvement?

On Mon, Jun 25, 2012 at 5:58 AM, Richard Hipp  wrote:

> On Sun, Jun 24, 2012 at 1:04 PM, Bill Pytlovany  wrote:
>
> > Can the download page include a distributable version without debug
> > information or would this require paid support?
> > Anyone else thinks this is a bug?
> >
>
> A "bug" is when the software gets the wrong answer.  This is not a bug.
>
> Or, rather, it is not a bug in SQLite.  Possibly it is a bug in your
> application.  From the sounds of things, you should be using the
> amalgamated
> source code  and compiling SQLite
> directly into your application code, using whatever compilation options are
> important to your application, and not using a DLL.
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXT :Re: Can't create empty database

2012-06-25 Thread Tim Streater
On 25 Jun 2012 at 14:30, Niall O'Reilly  wrote: 

> On 25 Jun 2012, at 13:24, Black, Michael (IS) wrote:
>
>> Does the shell compile differently for Mac?
>
>   Sorry.  I've no idea whether it does.
>   SQLite comes bundled with OSX and I haven't had a need to build it from
> source.
>   Besides, I haven't needed either to upgrade (?) to current OSX.  You
> mentioned
>   a later version of SQLite than the one I have.  I guess that has 
> something to
>   do with the divergence in behaviour.

I've built it from the amalgamation, but only because I wanted to fiddle in a 
trivial way with some of the output. But in my case I just shove all the code 
in an Xcode project and let Xcode figure out how to compile and build it. Seems 
to work - so I don't know what Michael means by "differently".

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


Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Black, Michael (IS)
You were doing two sqlite3_step()'s instead of one.  So you skipped the one 
record you had inserted.

You can run this multiple times and you;; see error messages about the create 
table on 2nd and subsequent runs.

Still adds the same record though so you'll see +1 records get printed out for 
every time you run it.



Here's a complete working example:



#include 
#include "sqlite3.h"

using namespace std;

// TEST BENCH
// 1. Create/Open a database 'db'
// 2. Add a table in the database 'friend'
// 3. add data to table friend
// 4. Extract the data from table friend and display it

sqlite3 *db;

void OpenDB() {
  int rc;
  string dbName = "arbol.db";
  rc = sqlite3_open_v2(dbName.c_str(),
   , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
   NULL);
  if(rc != SQLITE_OK) { /* display error msg */
cerr << "Error???" << endl;
  }
}
void CreateTable() {
  string create_table = "CREATE TABLE friend (name TEXT, address TEXT, age 
INT)";
  sqlite3_stmt *stmt;

  int rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
  if(rc != SQLITE_OK) {
cerr << "Error1: " << sqlite3_errmsg(db) << endl;
  }

  rc = sqlite3_step(stmt);
  if(rc != SQLITE_DONE) {
cerr << "Error2: " << sqlite3_errmsg(db) << endl;
  }
  sqlite3_finalize(stmt);
}
void Setter() {
  string Name;
  sqlite3_stmt *stmt;
  string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba', 
'490 New Bridge', '49')";
  int rc = sqlite3_prepare_v2(db, dbdata.c_str(),dbdata.length(),,NULL);
  if(rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  rc = sqlite3_step(stmt);
  if(rc != SQLITE_DONE) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  sqlite3_finalize(stmt);
}
void getter() {
  string sName;
  string dbdata = "SELECT * FROM friend";
  sqlite3_stmt *stmt;

  int rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
  if(rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
  while (sqlite3_step(stmt) == SQLITE_ROW) {
sName = (char*)sqlite3_column_text(stmt, 0);
//obj.Display(sName); //<== this is not display
cout << "sName=" << sName << endl;
  }
  sqlite3_finalize(stmt);
}
void theDestructor() {
  int rc=sqlite3_close(db);
  if (rc != SQLITE_OK) {
cerr << "Error: " << sqlite3_errmsg(db) << endl;
  }
}

int main() {
  OpenDB();
  CreateTable();
  Setter();
  getter();
  theDestructor();
  return 0;
}



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Arbol One [arbol...@gmail.com]
Sent: Monday, June 25, 2012 9:30 AM
To: 'General Discussion of SQLite Database'
Subject: EXT :Re: [sqlite] C++ programming - Extracting data

I did what you suggested, you were right, now the exception is gone, but the
program now does not display anything, it just goes to the end of the
method.
Here is a more complete snip of the test bench program. I really hope that
someone here can help resolve this issue.

// TEST BENCH
// 1. Create/Open a database 'db'
// 2. Add a table in the database 'friend'
// 3. add data to table friend
// 4. Extract the data from table friend and display it

OpenDB() {
rc = sqlite3_open_v2(dbName.c_str(),
 , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
 NULL);
if(rc != SQLITE_OK) { /* display error msg */ }

}
CreateTable() {
create_table = "CREATE TABLE friend (name TEXT, address TEXT, age INT)";

rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */ }
sqlite3_finalize(stmt);
}
Setter() {
string Name;
string dbdata = "INSERT INTO friend (name, address, age) VALUES
('Caramba', '490 New Bridge', '49')";
rc = sqlite3_prepare_v2(db, bdata.c_str(),dbdata.length(),,NULL);
if(rc != SQLITE_OK) { /* display error msg */ }
.
rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */}

sqlite3_finalize(stmt);
}
getter() {
string sName;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != (SQLITE_DONE) && rc != (SQLITE_ROW)){ ... }
while (sqlite3_step(stmt) == SQLITE_ROW) {
sName = (char*)sqlite3_column_text(stmt, 0);
obj.Display(sName); //<== this is not display
...
}
sqlite3_finalize(stmt);
}
theDestructor() {
sqlite3_close(db);
}


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS)
Sent: Monday, June 25, 2012 9:39 AM
To: General 

Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Keith Medcalf

Your logic is incorrect.  You have already stepped to the first row before you 
enter the loop, which starts out by stepping again, thus exhausting the 
returned data (since you only have one row).  If you insert multiple rows your 
code may work but leave out the first row.

Try something like:

getter()
{
string sName;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
if (rc == SQLITE_OK)
{
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
{
sName = (char*)sqlite3_column_text(stmt, 0);
obj.Display(sName); //<== this is not display
...
}
}
sqlite3_finalize(stmt);
return (rc == SQLITE_DONE) ? SQLITE_OK : rc
}

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Arbol One
> Sent: Monday, 25 June, 2012 08:31
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] C++ programming - Extracting data
> 
> I did what you suggested, you were right, now the exception is gone, but the
> program now does not display anything, it just goes to the end of the
> method.
> Here is a more complete snip of the test bench program. I really hope that
> someone here can help resolve this issue.
> 
> // TEST BENCH
> // 1. Create/Open a database 'db'
> // 2. Add a table in the database 'friend'
> // 3. add data to table friend
> // 4. Extract the data from table friend and display it
> 
> OpenDB() {
> rc = sqlite3_open_v2(dbName.c_str(),
>  , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
>  NULL);
> if(rc != SQLITE_OK) { /* display error msg */ }
> 
> }
> CreateTable() {
> create_table = "CREATE TABLE friend (name TEXT, address TEXT, age INT)";
> 
> rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
> if(rc != SQLITE_OK) { /* display error msg */ }
> 
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) { /* display error msg */ }
> sqlite3_finalize(stmt);
> }
> Setter() {
> string Name;
> string dbdata = "INSERT INTO friend (name, address, age) VALUES
> ('Caramba', '490 New Bridge', '49')";
> rc = sqlite3_prepare_v2(db, bdata.c_str(),dbdata.length(),,NULL);
> if(rc != SQLITE_OK) { /* display error msg */ }
> .
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) { /* display error msg */}
> 
> sqlite3_finalize(stmt);
> }
> getter() {
> string sName;
> string dbdata = "SELECT * FROM friend";
> 
> rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
> if(rc != SQLITE_OK) { /* display error msg */ }
> 
> rc = sqlite3_step(stmt);
> if(rc != (SQLITE_DONE) && rc != (SQLITE_ROW)){ ... }
> while (sqlite3_step(stmt) == SQLITE_ROW) {
> sName = (char*)sqlite3_column_text(stmt, 0);
> obj.Display(sName); //<== this is not display
> ...
> }
> sqlite3_finalize(stmt);
> }
> theDestructor() {
> sqlite3_close(db);
> }
> 
> 
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS)
> Sent: Monday, June 25, 2012 9:39 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] C++ programming - Extracting data
> 
> You're not doing the right sequencing...so your cout is only executing when
> there is NOT a row.
> 
> 
> 
> Change
> 
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) { ... }
> while ( sqlite3_step(stmt) != SQLITE_ROW)  {
> sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
> std::cout << sName << std::endl;
> ...
> }
> 
> To
> 
> while ( sqlite3_step(stmt) == SQLITE_ROW)  {
> sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
> std::cout << sName << std::endl;
> ...
> }
> 
> 
> 
> Michael D. Black
> 
> Senior Scientist
> 
> Advanced Analytics Directorate
> 
> Advanced GEOINT Solutions Operating Unit
> 
> Northrop Grumman Information Systems
> 
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
> behalf of Arbol One [arbol...@gmail.com]
> Sent: Monday, June 25, 2012 8:27 AM
> To: 'General Discussion of SQLite Database'
> Subject: EXT :Re: [sqlite] C++ programming - Extracting data
> 
> Sorry, I forgot to give you a snip of the test-bench code
> 
> getter() {
> string sName;
> string sAddress;
> int age = 0;
> string dbdata = "SELECT * FROM friend";
> 
> rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
> 
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) { ... }
> while ( sqlite3_step(stmt) != SQLITE_ROW)  {
> sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
> std::cout << sName << std::endl;
> ...
>

Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Arbol One
I did what you suggested, you were right, now the exception is gone, but the
program now does not display anything, it just goes to the end of the
method.
Here is a more complete snip of the test bench program. I really hope that
someone here can help resolve this issue.

// TEST BENCH
// 1. Create/Open a database 'db'
// 2. Add a table in the database 'friend'
// 3. add data to table friend
// 4. Extract the data from table friend and display it

OpenDB() {
rc = sqlite3_open_v2(dbName.c_str(),
 , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
 NULL);
if(rc != SQLITE_OK) { /* display error msg */ }

}
CreateTable() {
create_table = "CREATE TABLE friend (name TEXT, address TEXT, age INT)";

rc = sqlite3_prepare_v2( db, create_table.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */ }
sqlite3_finalize(stmt);
}
Setter() {
string Name;
string dbdata = "INSERT INTO friend (name, address, age) VALUES
('Caramba', '490 New Bridge', '49')";
rc = sqlite3_prepare_v2(db, bdata.c_str(),dbdata.length(),,NULL);
if(rc != SQLITE_OK) { /* display error msg */ }
.
rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { /* display error msg */}

sqlite3_finalize(stmt);
}
getter() {
string sName;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
if(rc != SQLITE_OK) { /* display error msg */ }

rc = sqlite3_step(stmt);
if(rc != (SQLITE_DONE) && rc != (SQLITE_ROW)){ ... }
while (sqlite3_step(stmt) == SQLITE_ROW) {
sName = (char*)sqlite3_column_text(stmt, 0);
obj.Display(sName); //<== this is not display
...
}
sqlite3_finalize(stmt);
}
theDestructor() {
sqlite3_close(db);
}


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS)
Sent: Monday, June 25, 2012 9:39 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] C++ programming - Extracting data

You're not doing the right sequencing...so your cout is only executing when
there is NOT a row.



Change

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { ... }
while ( sqlite3_step(stmt) != SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}

To

while ( sqlite3_step(stmt) == SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
behalf of Arbol One [arbol...@gmail.com]
Sent: Monday, June 25, 2012 8:27 AM
To: 'General Discussion of SQLite Database'
Subject: EXT :Re: [sqlite] C++ programming - Extracting data

Sorry, I forgot to give you a snip of the test-bench code

getter() {
string sName;
string sAddress;
int age = 0;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { ... }
while ( sqlite3_step(stmt) != SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}
sqlite3_finalize(stmt);
}



-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 9:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - creating a table

Arbol One  wrote:
> Q: What are you trying to achieve here? What's the supposed purpose of 
> sqlite3_column_type call?
>
> A: What I am trying to do is to display the data in a data table

You run a SELECT statement for that. In any case, what data do you expect
there to be right after CREATE TABLE?
--
Igor Tandetnik

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

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

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


Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Black, Michael (IS)
You're not doing the right sequencing...so your cout is only executing when 
there is NOT a row.



Change

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { ... }
while ( sqlite3_step(stmt) != SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}

To

while ( sqlite3_step(stmt) == SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Arbol One [arbol...@gmail.com]
Sent: Monday, June 25, 2012 8:27 AM
To: 'General Discussion of SQLite Database'
Subject: EXT :Re: [sqlite] C++ programming - Extracting data

Sorry, I forgot to give you a snip of the test-bench code

getter() {
string sName;
string sAddress;
int age = 0;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { ... }
while ( sqlite3_step(stmt) != SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}
sqlite3_finalize(stmt);
}



-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 9:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - creating a table

Arbol One  wrote:
> Q: What are you trying to achieve here? What's the supposed purpose of
> sqlite3_column_type call?
>
> A: What I am trying to do is to display the data in a data table

You run a SELECT statement for that. In any case, what data do you expect
there to be right after CREATE TABLE?
--
Igor Tandetnik

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

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


Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Keith Medcalf
> while ( sqlite3_step(stmt) != SQLITE_ROW)  {
> sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
> std::cout << sName << std::endl;
> ...
> }

You can only access columns when you have a row, not when you don't.

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Arbol One
> Sent: Monday, 25 June, 2012 07:27
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] C++ programming - Extracting data
> 
> Sorry, I forgot to give you a snip of the test-bench code
> 
> getter() {
> string sName;
> string sAddress;
> int age = 0;
> string dbdata = "SELECT * FROM friend";
> 
> rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );
> 
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) { ... }
> while ( sqlite3_step(stmt) != SQLITE_ROW)  {
> sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
> std::cout << sName << std::endl;
> ...
> }
> sqlite3_finalize(stmt);
> }




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


Re: [sqlite] EXT :Re: Can't create empty database

2012-06-25 Thread Niall O'Reilly

On 25 Jun 2012, at 13:24, Black, Michael (IS) wrote:

> Does the shell compile differently for Mac?

Sorry.  I've no idea whether it does.
SQLite comes bundled with OSX and I haven't had a need to build it from 
source.
Besides, I haven't needed either to upgrade (?) to current OSX.  You 
mentioned
a later version of SQLite than the one I have.  I guess that has 
something to 
do with the divergence in behaviour.

Thanks again
/N

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


Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Arbol One
Sorry, I forgot to give you a snip of the test-bench code

getter() {
string sName;
string sAddress;
int age = 0;
string dbdata = "SELECT * FROM friend";

rc = sqlite3_prepare_v2(db, dbdata.c_str(), -1, , NULL );

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { ... }
while ( sqlite3_step(stmt) != SQLITE_ROW)  {
sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault
std::cout << sName << std::endl;
...
}
sqlite3_finalize(stmt);
}



-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 9:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - creating a table

Arbol One  wrote:
> Q: What are you trying to achieve here? What's the supposed purpose of 
> sqlite3_column_type call?
> 
> A: What I am trying to do is to display the data in a data table

You run a SELECT statement for that. In any case, what data do you expect
there to be right after CREATE TABLE?
--
Igor Tandetnik

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

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


Re: [sqlite] EXT :Re: Can't create empty database

2012-06-25 Thread Simon Slavin

On 25 Jun 2012, at 1:24pm, "Black, Michael (IS)"  wrote:

> I'd be surprised if the shell behaves differently on the Mac...that' s just 
> Unix-like under the hood so I'd figure it would act just like Linux.  Does 
> the shell compile differently for Mac?

I can tell you about 3.7.12 on a Mac.  Starting the shell tool with something 
like

sqlite3 ~/Desktop/test.sqlite

and then quitting does not make a file.  Issuing '.tables' makes a file which 
is zero bytes long.  Issuing instead a SELECT command on either sqlite_master 
or any other TABLE (which, of course, doesn't exist) also makes a file which is 
zero bytes long.

I'm not sure about the semantics of making a zero byte file.  It doesn't agree 
with the SQLite documentation in that that states that every file should have 
the header, but it doesn't seem to actually cause any problems if you have 
SQLite to open the database later.

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


Re: [sqlite] C++ programming - creating a table

2012-06-25 Thread Igor Tandetnik
Arbol One  wrote:
> Q: What are you trying to achieve here? What's the supposed purpose of
> sqlite3_column_type call?
> 
> A: What I am trying to do is to display the data in a data table

You run a SELECT statement for that. In any case, what data do you expect there 
to be right after CREATE TABLE?
-- 
Igor Tandetnik

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


Re: [sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread Richard Hipp
On Sun, Jun 24, 2012 at 1:04 PM, Bill Pytlovany  wrote:

> Can the download page include a distributable version without debug
> information or would this require paid support?
> Anyone else thinks this is a bug?
>

A "bug" is when the software gets the wrong answer.  This is not a bug.

Or, rather, it is not a bug in SQLite.  Possibly it is a bug in your
application.  From the sounds of things, you should be using the amalgamated
source code  and compiling SQLite
directly into your application code, using whatever compilation options are
important to your application, and not using a DLL.


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


Re: [sqlite] C++ programming - creating a table

2012-06-25 Thread Arbol One
Q: What are you trying to achieve here? What's the supposed purpose of
sqlite3_column_type call?

A: What I am trying to do is to display the data in a data table, but the
statement

std::cout << (char*)sqlite3_column_text(stmt, 0) << std::endl;

produces a segmentation error.

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Monday, June 25, 2012 12:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - creating a table

Arbol One  wrote:
>create_table = "CREATE TABLE friend (name TEXT, address TEXT, age
INT)";
> 
>std::cout << sqlite3_column_type(stmt,0) << std::endl;

sqlite_column_* functions are only meaningful for queries that produce a
resultset - namely, SELECT and certain PRAGMAs. None of the data definition
statements (of which CREATE TABLE is one), nor INSERT, UPDATE or DELETE
statements, produce a resultset; thus, sqlite3_column_* functions couldn't
be used with them.

What are you trying to achieve here? What's the supposed purpose of
sqlite3_column_type call?
-- 
Igor Tandetnik

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

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


Re: [sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread Igor Tandetnik
Bill Pytlovany  wrote:
> Can the download page include a distributable version without debug
> information or would this require paid support?

You are free (both as in speech and as in beer) to build your own from source, 
using any options you want. It doesn't even have to be a separate DLL - you can 
statically link it directly into your application. You can further reduce the 
size of the binary by omitting features you don't need:

http://sqlite.org/compile.html

-- 
Igor Tandetnik

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


Re: [sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread PA Newsgroups
Having Debug data isn't a concern for me (but maybe for others?), but not
having a version number in SQLite.DLL is a bit of a pain.  It means
installers can't treat the DLL like every other DLL out there and instead
need to rely on file timestamps which is not the greatest.

Doug

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Bill Pytlovany
Sent: Sunday, June 24, 2012 12:05 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] I consider this a bug. Anyone else?

I'm very pleased with sqlite3.dll for Windows and I mainly include it with
my product because one of our features is to help users manage cookies.
Since both Chrome and Firefox use SQLite I'm required to use sqlite3.dll to
access their information. So thank you, thank you!

I've asked this in the form of a question a couple of times but have yet to
spark anyone's interest.
So, let me ask if anyone else like me considers this to be a bug?
 
 
Remove Debug Data
The problem is the SQLite3.dll available online is compiled with all its
debug information included.
This makes the DLL  586 KB.  While that certainly isn't bad,  the main
component of my application is only 400 KB.  One of the main advantages I
have over competitors in the security world is that my program has always
been extremely small and fast for what it does.  SQLite3.dll is the only
file I include in my setup which I don't sign and is developed by a 3rd
party.
Can the download page include a distributable version without debug
information or would this require paid support?
Anyone else thinks this is a bug?

Include Resource Info
Not a bug but something I'd like to see included in SQlite3.dll is minimal
Windows resource information. This would identify the source of SQLite and
could even promote the consortium.  I suspect Hwaci isn't a big fan of
Windows but the standard convention is to include a company name, version
and copyright information in a Windows EXE or DLL's resource block.  Many
programs including mine display this information and something as simple as
not having a company name is often an indication of a suspicious or possible
malware file.  It will make my users more comfortable but you could also use
it as a way to promote your company and SQLite. This is an area you could
include your URL along with company name and version.  Most Windows install
packages access the version info from the resource block as a condition to
install the sqlite3.dll file. Not having this data could cause an old
version of the DLL to be install over top of a newer version.
 
Thanks again,
Bill Pytlovany
 
BillP Studios
32 Sunnyside Rd.
Scotia, NY 12302
 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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


[sqlite] I consider this a bug. Anyone else?

2012-06-25 Thread Bill Pytlovany
I'm very pleased with sqlite3.dll for Windows and I mainly include it with
my product because one of our features is to help users manage cookies.
Since both Chrome and Firefox use SQLite I'm required to use sqlite3.dll to
access their information. So thank you, thank you!

I've asked this in the form of a question a couple of times but have yet to
spark anyone's interest.
So, let me ask if anyone else like me considers this to be a bug?
 
 
Remove Debug Data
The problem is the SQLite3.dll available online is compiled with all its
debug information included.
This makes the DLL  586 KB.  While that certainly isn't bad,  the main
component of my application is only 400 KB.  One of the main advantages I
have over competitors in the security world is that my program has always
been extremely small and fast for what it does.  SQLite3.dll is the only
file I include in my setup which I don't sign and is developed by a 3rd
party.
Can the download page include a distributable version without debug
information or would this require paid support?
Anyone else thinks this is a bug?

Include Resource Info
Not a bug but something I'd like to see included in SQlite3.dll is minimal
Windows resource information. This would identify the source of SQLite and
could even promote the consortium.  I suspect Hwaci isn't a big fan of
Windows but the standard convention is to include a company name, version
and copyright information in a Windows EXE or DLL's resource block.  Many
programs including mine display this information and something as simple as
not having a company name is often an indication of a suspicious or possible
malware file.  It will make my users more comfortable but you could also use
it as a way to promote your company and SQLite. This is an area you could
include your URL along with company name and version.  Most Windows install
packages access the version info from the resource block as a condition to
install the sqlite3.dll file. Not having this data could cause an old
version of the DLL to be install over top of a newer version.
 
Thanks again,
Bill Pytlovany
 
BillP Studios
32 Sunnyside Rd.
Scotia, NY 12302
 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXT :Re: Can't create empty database

2012-06-25 Thread Black, Michael (IS)
I'd be surprised if the shell behaves differently on the Mac...that' s just 
Unix-like under the hood so I'd figure it would act just like Linux.  Does the 
shell compile differently for Mac?

Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems



From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Niall O'Reilly [niall.orei...@ucd.ie]
Sent: Monday, June 25, 2012 7:00 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Can't create empty database



On 25 Jun 2012, at 12:48, Black, Michael (IS) wrote:

> Well...it doesnt' any more on Windows and Linux at least as of 3.7.9
>
> The file doesn't get created until you execute at least one command relevant 
> to it.
>
> So do a .schema or .dump or such and it creates the empty file.
>
> Or just enter a ";" and it will create it too (ergo the "" works from the 
> command line).

I'm sorry.  I live on a Mac with 3.6.12.
Thanks for bringing me up to date.

/Niall

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Valentin Davydov
On Mon, Jun 25, 2012 at 01:01:46AM -0700, L Anderson wrote:
> Googling on how to create a sqlite database (empty one) it appears
> I need only do 'sqlite3 test.db'.  However, when I try that I get:
> 
> ->sqlite3 test.db
> SQLite version 3.7.13 2012-06-11 02:05:22
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite>
> 
> however, no database is created.  What am I doing wrong and what
> do I need to do to create an empty database 'test.db'?

Perhaps you have to fill the database with some of your own data (and later
delete them if you want really empty DB). Otherwise it will not even remember
your PRAGMA settings etc.:

$ rm -f test.db
$ sqlite3 test.db "pragma page_size=512;"
$ wc -c test.db
   0 test.db
$ sqlite3 test.db "pragma page_size;"
1024
$ sqlite3 test.db "pragma page_size=512;
create table t(c);drop table t;vacuum;"
$ wc -c test.db
 512 test.db
$ sqlite3 test.db "pragma page_size;"
512
$

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Niall O'Reilly

On 25 Jun 2012, at 12:48, Black, Michael (IS) wrote:

> Well...it doesnt' any more on Windows and Linux at least as of 3.7.9
> 
> The file doesn't get created until you execute at least one command relevant 
> to it.
> 
> So do a .schema or .dump or such and it creates the empty file.
> 
> Or just enter a ";" and it will create it too (ergo the "" works from the 
> command line).

I'm sorry.  I live on a Mac with 3.6.12.
Thanks for bringing me up to date.

/Niall

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Black, Michael (IS)
Well...it doesnt' any more on Windows and Linux at least as of 3.7.9



The file doesn't get created until you execute at least one command relevant to 
it.



So do a .schema or .dump or such and it creates the empty file.



Or just enter a ";" and it will create it too (ergo the "" works from the 
command line).





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Niall O'Reilly [niall.orei...@ucd.ie]
Sent: Monday, June 25, 2012 6:26 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Can't create empty database


On 25 Jun 2012, at 11:06, L Anderson wrote:

> So then on page 'http://www.sqlite.org/quickstart.html'
> under 'Create A New Database', the first bullet:
>
> 'At a shell or DOS prompt, enter: "sqlite3 test.db". This will create a new 
> database named "test.db". (You can use a different name if you like.)'
>
> is not strictly correct.

It has always worked for me.
/N

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Niall O'Reilly

On 25 Jun 2012, at 11:06, L Anderson wrote:

> So then on page 'http://www.sqlite.org/quickstart.html'
> under 'Create A New Database', the first bullet:
> 
> 'At a shell or DOS prompt, enter: "sqlite3 test.db". This will create a new 
> database named "test.db". (You can use a different name if you like.)'
> 
> is not strictly correct.

It has always worked for me.
/N

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread L Anderson

Oliver Peters wrote:

Am 25.06.2012 10:01, schrieb L Anderson:

Googling on how to create a sqlite database (empty one) it appears
I need only do 'sqlite3 test.db'.  However, when I try that I get:

->sqlite3 test.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

however, no database is created.  What am I doing wrong and what
do I need to do to create an empty database 'test.db'?

Thanks,

LA



read http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html

for instruction how to use the CLI (sqlite3.exe or the Linux binary)

Oliver


Thanks for your reply.  As it turns out, that's the very tutorial I used 
to run my test case.  The tutorial shows:


$ sqlite3 test.db
  SQLite version 3.0.8
  Enter ".help" for instructions
  sqlite> .quit

and I did:

->sqlite3 test.db
  SQLite version 3.7.13 2012-06-11 02:05:22
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite> .q

but did not get an empty file.

As an OP pointed out, I needed 'sqlite3 test.db ""'

I think this thread can now safely die--thanks all.

Regards,

LA

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread L Anderson

Patrik Nilsson wrote:

sqlite3 test.db ""

It creates an empty file, zero bytes long.

Thanks for your quick reply.  So then on page 
'http://www.sqlite.org/quickstart.html'

under 'Create A New Database', the first bullet:

'At a shell or DOS prompt, enter: "sqlite3 test.db". This will create a 
new database named "test.db". (You can use a different name if you like.)'


is not strictly correct.

I guess I was expecting 'sqlite3 test.db' or even 'sqlite3 test.db ""' 
to have created an "empty database" that contained the 100 byte 'SQLite 
format 3' database header structure together with any internal tables 
such as 'sqlite_master' and not just an empty file.


Regards,

LA



On 06/25/2012 10:01 AM, L Anderson wrote:

Googling on how to create a sqlite database (empty one) it appears
I need only do 'sqlite3 test.db'.  However, when I try that I get:

->sqlite3 test.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

however, no database is created.  What am I doing wrong and what
do I need to do to create an empty database 'test.db'?

Thanks,

LA




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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Oliver Peters

Am 25.06.2012 10:01, schrieb L Anderson:

Googling on how to create a sqlite database (empty one) it appears
I need only do 'sqlite3 test.db'.  However, when I try that I get:

->sqlite3 test.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

however, no database is created.  What am I doing wrong and what
do I need to do to create an empty database 'test.db'?

Thanks,

LA



read http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html

for instruction how to use the CLI (sqlite3.exe or the Linux binary)

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


Re: [sqlite] Can't create empty database

2012-06-25 Thread Patrik Nilsson
sqlite3 test.db ""

It creates an empty file, zero bytes long.

On 06/25/2012 10:01 AM, L Anderson wrote:
> Googling on how to create a sqlite database (empty one) it appears
> I need only do 'sqlite3 test.db'.  However, when I try that I get:
> 
> ->sqlite3 test.db
> SQLite version 3.7.13 2012-06-11 02:05:22
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite>
> 
> however, no database is created.  What am I doing wrong and what
> do I need to do to create an empty database 'test.db'?
> 
> Thanks,
> 
> LA
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 

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


[sqlite] Can't create empty database

2012-06-25 Thread L Anderson

Googling on how to create a sqlite database (empty one) it appears
I need only do 'sqlite3 test.db'.  However, when I try that I get:

->sqlite3 test.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

however, no database is created.  What am I doing wrong and what
do I need to do to create an empty database 'test.db'?

Thanks,

LA

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


Re: [sqlite] C++ programming - inserting data in a table

2012-06-25 Thread Simon Slavin

On 25 Jun 2012, at 5:16am, Arbol One  wrote:

> Thanks for the prompt response.
> Here is the same problem when using INSERT.

Read Igor's post again.  The only SQL commands which produce output are SELECT 
and (sometimes) PRAGMA.  Commands which make changes to your database, like 
CREATE TABLE and INSERT simply produce an integer result code which indicate 
whether they executed without error (SQLITE_OK) or had a problem of some kind 
(any other value).

If you want to read values which is in your database you must use a SELECT 
statement.

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