[sqlite] lemon problem with two versions of lempar.c

2015-04-16 Thread Neo Anderson
I am utilizing lemon in one of my Apple Store Apps. My parser works fine with 
the 'old' lempar.c found in source tree TRUNK/tool/.I also found a 
newer version in TRUNK/src, but when I compile myparser.c generated using this 
lempar.c, I got compilation errors:test.c:376:7: error: use of 
undeclared identifier 'NEVER' if( NEVER(pParser-yyidx0) ) 
return 0;How can I solve this error? BTW, does this newer lempar.c 
benefit my parser more than the old one?



Re: [sqlite] Multi-thread mode question

2015-02-08 Thread Neo Anderson
Thanks for your clarification.


> From: h...@scigames.at
> To: sqlite-users@sqlite.org
> Date: Mon, 9 Feb 2015 07:18:29 +
> Subject: Re: [sqlite] Multi-thread mode question
>
> In serialized mode, SQLite will acquire the mutex when it detects you are 
> "starting to use" the database handle (somewhere between entering 
> sqlite3_prepare and the first sqlite3_step) and then HANG ON TO IT, NOT 
> LETTING GO until the calling thread is "finished" (like when sqlite3_step 
> returns SQLITE_DONE or the thread calls sqlite3_reset or sqlite3_finalize).
>
> In multithread mode, you are taking over this responsibility; if you take 
> care, you may nest several selects from different threads into a single 
> transaction, but need to be aware of the fact that they will all commit or 
> rollback together.
>
> -Ursprüngliche Nachricht-
> Von: Neo Anderson [mailto:neo_in_mat...@msn.com]
> Gesendet: Montag, 09. Februar 2015 06:34
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Multi-thread mode question
>
>> Does the application work if you configure SQLite to serialized mode?
> Yes. But I am confused why serialized mode works while multi-thread mode 
> always cause crashes because I also wrap calls around statement handle.
>
>> even if you wrap the sqlite3_ calls... you'll need to wrap the entire
>> lifetime of the statment...
> Do I need to do this in serialized mode (suppose I use a single connection 
> across multiple threads)?
>
> 
>> Date: Sun, 8 Feb 2015 03:31:46 -0800
>> From: d3c...@gmail.com
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] Multi-thread mode question
>>
>> it's better to use a connection per thread... the connection resource
>> isn't very big...
>> even if you wrap the sqlite3_ calls... you'll need to wrap the entire
>> lifetime of the statment... if you do a execute and then start
>> stepping and getting values while another thread starts another
>> statement... that's 3 individual locks, but it doesn't lock the
>> context of the statement being used... it will lead to bizarre crashes
>> in the database; similar to double-releasing memory or delayed
>> reference of memory that has been released.
>>
>> On Sun, Feb 8, 2015 at 3:00 AM, Dan Kennedy <danielk1...@gmail.com> wrote:
>>
>>> On 02/08/2015 04:30 PM, Neo Anderson wrote:
>>>
>>>> The doc says:
>>>>
>>>> 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.
>>>>
>>>> I have a scenario that every sqlite3_calls around a single database
>>>> connection is protected by a recursive mutex, but I have very
>>>> strange runtime error in sqlite3.c and each time the error occurs at
>>>> a different place.
>>>>
>>>> Does this mean the following statement is true:
>>>>
>>>> In muti-thead mode, a single database connection cannot be shared
>>>> among threads even if any activity around the connection is protected by a 
>>>> mutex.
>>>>
>>>
>>> Not true.
>>>
>>> The only difference between multi-threaded and serialized mode is
>>> that, internally, every sqlite3_xxx() API call grabs a recursive
>>> mutex to prevent two threads from simultaneously accessing the database 
>>> handle structure.
>>> i.e. the same thing your code is doing externally.
>>>
>>> Note that calls on statement handles (i.e. sqlite3_step(),
>>> sqlite3_column_text() etc.) count as calls on the database handle
>>> that created them. So you need to protect them with the same mutex.
>>>
>>> Does the application work if you configure SQLite to serialized mode?
>>>
>>> Dan.
>>>
>>>
>>>
>>> ___
>>> 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] Multi-thread mode question

2015-02-08 Thread Neo Anderson
> Does the application work if you configure SQLite to serialized mode?
Yes. But I am confused why serialized mode works while multi-thread mode always 
cause crashes because I also wrap calls around statement handle.

> even if you wrap the sqlite3_ calls... you'll need to wrap the entire
> lifetime of the statment...
Do I need to do this in serialized mode (suppose I use a single connection 
across multiple threads)?


> Date: Sun, 8 Feb 2015 03:31:46 -0800
> From: d3c...@gmail.com
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Multi-thread mode question
>
> it's better to use a connection per thread... the connection resource isn't
> very big...
> even if you wrap the sqlite3_ calls... you'll need to wrap the entire
> lifetime of the statment... if you do a execute and then start stepping and
> getting values while another thread starts another statement... that's 3
> individual locks, but it doesn't lock the context of the statement being
> used... it will lead to bizarre crashes in the database; similar to
> double-releasing memory or delayed reference of memory that has been
> released.
>
> On Sun, Feb 8, 2015 at 3:00 AM, Dan Kennedy <danielk1...@gmail.com> wrote:
>
>> On 02/08/2015 04:30 PM, Neo Anderson wrote:
>>
>>> The doc says:
>>>
>>> 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.
>>>
>>> I have a scenario that every sqlite3_calls around a single database
>>> connection is protected by a recursive mutex, but I have very strange
>>> runtime error in sqlite3.c and each time the error occurs at a different
>>> place.
>>>
>>> Does this mean the following statement is true:
>>>
>>> In muti-thead mode, a single database connection cannot be shared among
>>> threads even if any activity around the connection is protected by a mutex.
>>>
>>
>> Not true.
>>
>> The only difference between multi-threaded and serialized mode is that,
>> internally, every sqlite3_xxx() API call grabs a recursive mutex to prevent
>> two threads from simultaneously accessing the database handle structure.
>> i.e. the same thing your code is doing externally.
>>
>> Note that calls on statement handles (i.e. sqlite3_step(),
>> sqlite3_column_text() etc.) count as calls on the database handle that
>> created them. So you need to protect them with the same mutex.
>>
>> Does the application work if you configure SQLite to serialized mode?
>>
>> Dan.
>>
>>
>>
>> ___
>> 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] Multi-thread mode question

2015-02-08 Thread Neo Anderson
The doc says:

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.

I have a scenario that every sqlite3_calls around a single database connection 
is protected by a recursive mutex, but I have very strange runtime error in 
sqlite3.c and each time the error occurs at a different place.

Does this mean the following statement is true:

In muti-thead mode, a single database connection cannot be shared among threads 
even if any activity around the connection is protected by a mutex.

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


Re: [sqlite] Error: database disk image is malformed

2015-01-05 Thread Neo Anderson
> Are you using the same sqlite3 binary for both operations?
>
> If a database has a table definition that an older version of SQLite does not 
> understand, it will sometimes give this error. If you’re using a newer 
> version of SQLite to dump/load the files, there will be no error.
>

Yes, I am using the latest sqlite3 binary (version 3.8.7.4) for both 
operations.  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Error: database disk image is malformed

2015-01-05 Thread Neo Anderson
I have a customer database which appears corrupt. When I run sqlite3 mydb and 
PRAGMA integrity_check I got (literally, no other lines):

Error: database disk image is malformed

However, I can .dump and .read to create a new database. The new database works 
fine and the most surprising result is the old and new database files are 
exactly of the same size. But running cmp old.db new.db gave me:

differ: char 27, line 1

My question is why .dump works but sqlite3 thinks the file is corrupt. Attached 
please find old.db and new.db in a zip package. Hope this can help improve 
sqlite.___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLITE_THREADSAFE question

2014-09-04 Thread Neo Anderson

Understood. Thanks!


> From: d...@sqlite.org
> Date: Thu, 4 Sep 2014 11:42:52 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SQLITE_THREADSAFE question
>
> On Thu, Sep 4, 2014 at 11:32 AM, Neo Anderson <neo_in_mat...@msn.com> wrote:
>
>> Got confused. if I have SQLITE_THREADSAFE=2, do I need to implement mutex
>> proection around this function call?
>>
>
> No.
> --
> 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] SQLITE_THREADSAFE question

2014-09-04 Thread Neo Anderson
Got confused. if I have SQLITE_THREADSAFE=2, do I need to implement mutex 
proection around this function call?


> From: d...@sqlite.org
> Date: Thu, 4 Sep 2014 10:18:29 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SQLITE_THREADSAFE question
>
> On Thu, Sep 4, 2014 at 10:14 AM, Neo Anderson <neo_in_mat...@msn.com> wrote:
>
>>
>> 2. Fuctions that do not use sqlite3* and sqite3_stmt* such as
>> sqlite3_mprintf do not need mutex protection.
>>
>
> No. sqlite3_mprintf() does require mutex protection. If you disable
> mutexes using SQLITE_THREADSAFE=0 and then try to use sqlite3_mprintf()
> from multiple threads, you will encounter problems.
>
> --
> 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] SQLITE_THREADSAFE question

2014-09-04 Thread Neo Anderson

Understood. I want to more sure of the following assumptions:

1. Trivial fucntions such as sqlite3_close, sqite3_errcode also need mutex 
protection even they seem so simple.
2. Fuctions that do not use sqlite3* and sqite3_stmt* such as sqlite3_mprintf 
do not need mutex protection.

Thanks.


> From: d...@sqlite.org
> Date: Thu, 4 Sep 2014 10:07:02 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SQLITE_THREADSAFE question
>
> On Thu, Sep 4, 2014 at 9:59 AM, Neo Anderson <neo_in_mat...@msn.com> wrote:
>
>> I'm building a custom library wrapper for Cocoa. I want to handle database
>> threading issue myself.
>>
>> From http://sqlite.org/compile.html#threadsafe:
>>
>> [quote]
>> When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a
>> multithreaded program so long as no two threads attempt to use the
>> same database connection (or any prepared statements derived from that
>> database connection) at the same time.
>> [/quote]
>>
>> I have two questions:
>>
>> 1. Does SQLITE_THREADSAFE only and solely affects struct sqlite3* and
>> sqlite3_stmt* related API calls?
>>
>
> The difference between SQLITE_THREADSAFE=1 and SQLITE_THREADSAFE=2 is only
> for sqlite3 and sqlite3_stmt related API calls. But SQLITE_THREADSAFE=0
> affects *all* APIs.
>
>
>
>> 2. Are sqlite3_config(SQLITE_CONFIG_MULTITHREAD) and SQLITE_OPEN_NOMUTEX
>> does the same thing as SQLITE_THREADSAFE=2 define?
>>
>
> Yes, as long as you do not compile with SQLITE_THREADSAFE=0. When you
> compilewith SQLITE_THREADSAFE=0, all mutex logic is omitting from the
> build, and so you can never, ever, safely use the resulting library in a
> multi-threaded program, regardless of how you open your connections.
>
>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> 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


[sqlite] SQLITE_THREADSAFE question

2014-09-04 Thread Neo Anderson
I'm building a custom library wrapper for Cocoa. I want to handle database 
threading issue myself.

>From http://sqlite.org/compile.html#threadsafe:

[quote]
When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a multithreaded 
program so long as no two threads attempt to use the same database connection 
(or any prepared statements derived from that database connection) at the same 
time.
[/quote]

I have two questions:

1. Does SQLITE_THREADSAFE only and solely affects struct sqlite3* and 
sqlite3_stmt* related API calls?
2. Are sqlite3_config(SQLITE_CONFIG_MULTITHREAD) and SQLITE_OPEN_NOMUTEX does 
the same thing as SQLITE_THREADSAFE=2 define?

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


[sqlite] Who can explain the xCodec API?

2013-05-07 Thread Neo Anderson
I'm trying to implement a encryption VFS, but it turned out it's too tedious 
and error prone. The main cause is that my simple VFS does not handle locking 
well (or not at all). This leads to database file corruption when inserting 
thousands of records (I believe).

Then I turned to the commercial SEE (http://www.hwaci.com/sw/sqlite/see.html). 
But it does not mention how it is implemented.

I searched the Internet and it seems that sqlite.c source file has this macro:

SQLITE_HAS_CODEC

But there is no documentation on this API.

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


Re: [sqlite] demovfs question

2013-03-20 Thread Neo Anderson
Thanks.


> From: d...@sqlite.org
> Date: Wed, 20 Mar 2013 12:48:45 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] demovfs question
>
> On Wed, Mar 20, 2013 at 12:45 PM, Neo Anderson <neo_in_mat...@msn.com>wrote:
>
> > Thanks for your detailed explanation. I think I've got my answers for my 2
> > questions.
> >
> > But I've got another question:
> >
> > What happens if there is a power failure when the VFS is in middle of
> > writing journal data to disk but has not yet finished?
> >
> > Let's say the VFS has finished writing a half of integer field and now
> > power is down. Can sqlite handle this?
> >
>
> Yes. See http://www.sqlite.org/testing.html#crashtesting and
> http://www.sqlite.org/atomiccommit.html for further insight into how this
> works.
>
>
> --
> 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] demovfs question

2013-03-20 Thread Neo Anderson
Thanks for your detailed explanation. I think I've got my answers for my 2 
questions.

But I've got another question:

What happens if there is a power failure when the VFS is in middle of writing 
journal data to disk but has not yet finished?

Let's say the VFS has finished writing a half of integer field and now power is 
down. Can sqlite handle this?


> From: slav...@bigfraud.org
> Date: Wed, 20 Mar 2013 14:02:53 +
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] demovfs question
>
>
> On 20 Mar 2013, at 10:17am, Neo Anderson <neo_in_mat...@msn.com> wrote:
>
> > Sorry, what do you mean on question 2?
> >
> > Can I use the buffered fopen family functions or not?
>
> I believe Dan is concerned about some issues with ACID and crash-recovery 
> which will be introduced if you add an extra level of buffering.
>
> To ensure data integrity is is vital that the bits on the disk are a perfect 
> reflection of the data in the database. This ensures that two processes 
> trying to access the same data agree on what the data is, and also that if a 
> process crashes while it's writing data to the database, the files on the 
> disk (which are what's going to be found when the database is next opened) 
> correctly reflect the history of committed transactions and are as up-to-date 
> as possible.
>
> By buffering file operations you are introducing a set of delays to your 
> operations. Consequently some of the 'state' of your data is neither 
> committed nor uncommitted, but stuck somewhere in buffers. A DBMS which takes 
> great pains to be as much ACID
>
> <http://en.wikipedia.org/wiki/ACID>
>
> as possible is one place where you would want to avoid buffering.
>
> So yes, technically, SQLite won't throw a fit if you use buffered calls. But 
> using them will break ACID in cases of simultaneous access and recovery from 
> crashes, power loss, broken cables, etc.. So it shouldn't be used in anything 
> except conditions where the programmers knows everything about where their 
> program will be used -- perhaps a one-off program which will only ever be run 
> on the programmers own personal hardware.
>
> If you have written unbuffered code and it is /too/ slow to be useful, by all 
> means get back to us and we can suggest things to tackle. But if rather than 
> /too/ slow, it is just a bit slower than you think it could be, then 
> buffering is not one of the best things to look at.
>
> Simon.
> ___
> 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] demovfs question

2013-03-20 Thread Neo Anderson
Sorry, what do you mean on question 2?

Can I use the buffered fopen family functions or not?


> Date: Wed, 20 Mar 2013 17:13:26 +0700
> From: danielk1...@gmail.com
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] demovfs question
>
> On 03/20/2013 05:00 PM, Neo Anderson wrote:
> > I'm studying the demovfs listed on http://www.sqlite.org/vfs.html.
> >
> > I've got a few questions:
> >
> > 1. By reading the comments, it seems that file read/write operations
> > must be buffered if it is a journal file. Is this required by sqlite
> > design?
>
> No. Not required.
>
> > 2. The demo uses nonbuffered open/read/write function to talk with
> > OS. Can I use the buffered fopen/fread/fwrite functions and thus I
> > don't bother with buffering management?
>
> The user-space buffering seems quite likely to introduce confusing
> bugs. Probably easiest not to.
> ___
> 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] demovfs question

2013-03-20 Thread Neo Anderson
I'm studying the demovfs listed on http://www.sqlite.org/vfs.html.

I've got a few questions:

1. By reading the comments, it seems that file read/write operations must be 
buffered if it is a journal file. Is this required by sqlite design?

2. The demo uses nonbuffered open/read/write function to talk with OS. Can I 
use the buffered fopen/fread/fwrite functions and thus I don't bother with 
buffering management? 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLITE_OPEN_MAIN_JOURNAL question

2013-03-17 Thread Neo Anderson
I'm trying to implement a VFS with encryption. I cannot find any detailed 
documentation about some flags listed on http://www.sqlite.org/c3ref/vfs.html.  
For example:

SQLITE_OPEN_MAIN_JOURNAL
SQLITE_OPEN_MASTER_JOURNAL
SQLITE_OPEN_SUBJOURNAL

There is a minimal mention of these flags in source code, but no detailed 
explanation what should implementation take care of them.

Where can I find detailed documentation about these flags?  
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Command history not working in sqlite3 tool for MAC OS

2012-05-11 Thread Neo Anderson

Yes, I installed the latest version myself.

> Date: Fri, 11 May 2012 07:46:16 +0100
> From: amit.k.chaudh...@gmail.com
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Command history not working in sqlite3 tool for MAC OS
> 
> My Mac is running system provided sqlite3 (3.6.12) and up arrow returns
> last command as expected.  Did you install 3.7.11 your self, if so I wonder
> if you missed a component (e.g. one which provides the cmd line
> functionality).
> 
> On Fri, May 11, 2012 at 6:33 AM, Neo Anderson <neo_in_mat...@msn.com> wrote:
> 
> >
> > The UP/DOWN arrow keys do not work in sqlite3 for MAC OS X.
> > For example, I start sqlite3 and hit UP key, then I get:
> >
> > $ sqlite3 Documents/test.db
> > SQLite version 3.7.11 2012-03-20 11:35:50
> > Enter ".help" for instructions
> > Enter SQL statements terminated with a ";"
> > sqlite> ^[[A
> >
> > Is this a known problem?
> >
> > ___
> > 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] Handle multiple results using sqlite3_step

2012-03-25 Thread Neo Anderson

It's just that the two resultsets are not related. What I thought was that I 
could gain some performance by combining two SELECT into one statement and 
execute it via one prepare/step.

> From: petite.abei...@gmail.com
> Date: Sun, 25 Mar 2012 21:40:40 +0200
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Handle multiple results using sqlite3_step
> 
> 
> On Mar 25, 2012, at 9:36 PM, Neo Anderson wrote:
> 
> > And I do not want to use big union.
> 
> Out of curiosity, why is that? SQLite goes to great length to support  
> relational operations. Why not use them?
> 
> ___
> 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] Handle multiple results using sqlite3_step

2012-03-25 Thread Neo Anderson

Do not be confused by the sample SQL statement. What I really wanted to do is 
return two different resultsets in one statement and wanted an API to handle 
the two resultsets. For example:

select * form table1;
select * from table2;

And I do not want to use big union.

By reading other replies I think it's actually not practical to do this.

> To: sqlite-users@sqlite.org
> From: itandet...@mvps.org
> Date: Sun, 25 Mar 2012 08:42:11 -0400
> Subject: Re: [sqlite] Handle multiple results using sqlite3_step
> 
> Neo Anderson <neo_in_mat...@msn.com> wrote:
> > Is it possible to handle multiple results using sqlite3_step or any other 
> > API calls?
> > 
> > I want to execute the following SQL in one statement and want to get the 
> > two resultsets.
> > 
> > select 1 a; select 2 b;
> 
> No. In SQLite, each sqlite3_stmt* handle represents one resultset. If you 
> want two separate resultsets, you need two separate statements.
> 
> For this particular example, you can produce one row with two columns instead:
> 
> select 1 a, 2 b;
> 
> or two rows with one column:
> 
> select 1 a union all select 2 a;
> 
> Why do you want two resultsets? What is the actual problem you are trying to 
> solve?
> -- 
> 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] Handle multiple results using sqlite3_step

2012-03-25 Thread Neo Anderson

Is it possible to handle multiple results using sqlite3_step or any other API 
calls?

I want to execute the following SQL in one statement and want to get the two 
resultsets.

select 1 a; select 2 b;
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Possible bug? Primary key not created for CREATE TABLE(id INTEGER primary key);

2012-03-25 Thread Neo Anderson

See the following result:

sqlite> select * from sqlite_master order by type;
type|name|tbl_name|rootpage|sql
index|sqlite_autoindex_t_1|t|4|
index|sqlite_autoindex_t3_1|t3|7|
table|t|t|2|CREATE TABLE t(id int primary key, key, value)
table|t2|t2|5|CREATE TABLE t2(id INTEGER primary key, key, value)
table|t3|t3|6|CREATE TABLE t3(id not null primary key, key, value)
table|t4|t4|8|CREATE TABLE t4(id INTEGER primary key, key, value)

No indexes created for t2 and t4. Or it is just a illusion?


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


Re: [sqlite] sqlite3_open() problem

2008-10-14 Thread Neo
I run sqlite3.exe under Windows 95 like this:
C:\sqlite3 test
sqlite>create table t(id);

Then sqlite3 crashes.

Leandro dos Santos Ribeiro wrote:
> Leandro dos Santos Ribeiro wrote:
>   
>> D. Richard Hipp wrote:
>>   
>> 
>>> On Oct 10, 2008, at 4:59 PM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED] 
>>>  > wrote:
>>>
>>>   
>>> 
>>>   
 Hello Team.

 I have a problem with running SQLite.
 I am running linux 2.6.17 on *ARM* and basically problem is that my
 application
 is crushing on *sqlite3_open*()  function while the sqlite3 command
 shell is
 running without problems.
 
   
 
>>> The command-line shell uses sqlite3_open() too.  So if it works there,  
>>> I do not understand why it is not working in your program.  Have you  
>>> run your program in a debugger to see exactly where it is crashing?
>>>
>>>
>>>
>>> D. Richard Hipp
>>> [EMAIL PROTECTED]
>>>
>>>
>>>
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>>   
>>> 
>>>   
>> Hello D. Richard Hipp,
>>
>> Yes, I did run the program in a debugger and it is crashing when the 
>> program tries to execute the sqlite3_open() function.
>> It seems that I'm not the only one with that problem, but I didn't find 
>> the answer yet.
>> Thanks .
>>
>>  
>>  Best regards.
>>  
>>   Leandro S. Ribeiro
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>   
>> 
> Hello everybody,
>
> I found the problem with the sqlite3_open() crashing.
> To solve it I just added the libs  libpthread and libdl to my project.
> Thanks to all.
>
>  Best regards
>  Leandro S. Ribeiro
> ___
> 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] sqlite3_open() problem

2008-10-11 Thread Neo
I also had crashing problem on Windows 95 (yes, old Windows 95). I 
posted a mail to this list, but was doing it on another email account so 
it did not appear in list. I was wondering there might be some subtle 
problems in sqlite3_open.

[EMAIL PROTECTED] wrote:
> Hello Team.
>
> I have a problem with running SQLite.
> I am running linux 2.6.17 on *ARM* and basically problem is that my 
> application
> is crushing on *sqlite3_open*()  function while the sqlite3 command 
> shell is
> running without problems.
> I added the sqlite3.h file to my project.
> /**/
> #include 
> #include "sqlite3.h"
>
> static int callback(void *NotUsed, int argc, char **argv, char
> **azColName){
>   int i;
>   for(i=0; i printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
>   }
>   printf("\n");
>   return 0;
> }
>
> int main(int argc, char **argv){
>   sqlite3 *db;
>   char *zErrMsg = 0;
>   int rc;
>
>   printf("Before Opened");
>   rc = sqlite3_open("mydatabase.db", );
>   printf("Opened");
>
>   if( rc ){
> fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
> sqlite3_close(db);
> exit(1);
>   }
>
>   rc = sqlite3_exec(db, "select *from Artists;", callback, 0, );
>   if( rc!=SQLITE_OK ){
> fprintf(stderr, "SQL error: %s\n", zErrMsg);
> sqlite3_free(zErrMsg);
>   }
>   sqlite3_close(db);
>   return 0;
> }
> /**/
> NOTE: the same appplication compiled for linux PC is working fine.
>
> Best regards
> Leandro
>
>
> ___
> 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