Re: [sqlite] how to get the sqlite test case?

2010-02-22 Thread Jay A. Kreibich
On Tue, Feb 23, 2010 at 08:55:31AM +0800, xuecaili scratched on the wall:
> Hello!
> I'm a sqlite user and I want to use sqlite to develop a 
> software.  But at first, I'd like to test sqlite. It is declared in the 
> official web site that how sqlite is tested. I want to get the test case 
> you test the sqlite, especially 7.2 million queries run with the SQL 
> TEST LOGIC which is a test harness described in the web site. Can you 
> provide these 7.2 million queries?  I'll appreciate it!  Thank you very 
> much!

  If you're looking at this page:

  http://www.sqlite.org/sqllogictest/doc/tip/about.wiki

  Click "files" at the top.  This is a Fossil repository for the
  sqllogictest package.  See: http://www.fossil-scm.org/

-j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how to get the sqlite test case?

2010-02-22 Thread xuecaili
Hello!
I'm a sqlite user and I want to use sqlite to develop a 
software.  But at first, I'd like to test sqlite. It is declared in the 
official web site that how sqlite is tested. I want to get the test case 
you test the sqlite, especially 7.2 million queries run with the SQL 
TEST LOGIC which is a test harness described in the web site. Can you 
provide these 7.2 million queries?  I'll appreciate it!  Thank you very 
much!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Bug in porter stemmer

2010-02-22 Thread James Berry
I'm writing to report a bug in the porter-stemmer algorithm supplied as part of 
the FTS3 implementation.

The stemmer has an inverted logic error that prevents it from properly stemming 
words of the following form:

dry -> dri
cry -> cri

This means, for instance, that the following words don't stem the same:

dried -> dri   -doesn't match-   dry
cried -> cry   -doesn't match-   cry

The bug seems to have been introduced as a simple logic error by whoever wrote 
the stemmer code. The original description of step 1c is here: 
http://snowball.tartarus.org/algorithms/english/stemmer.html

Step 1c:
replace suffix y or Y by i if preceded by a non-vowel which is 
not the first letter of the word (so cry -> cri, by -> by, say -> say)

But the code in sqlite reads like this:

  /* Step 1c */
  if( z[0]=='y' && hasVowel(z+1) ){
z[0] = 'i';
  }

In other words, sqlite turns the y into an i only if it is preceded by a vowel 
(say -> sai), while the algorithm intends this to be done if it is _not_ 
preceded by a vowel.

But there are two other problems in that same line of code:

(1) hasVowel checks whether a vowel exists anywhere in the string, not 
just in the next character, which is incorrect, and goes against the step 1c 
directions above. (amplify would not be properly stemmed to amplifi, for 
instance)

(2) The check for the first letter is not performed (for words like 
"by", etc)

I've fixed both of those errors in the patch below:

   /* Step 1c */
-  if( z[0]=='y' && hasVowel(z+1) ){
+ if( z[0]=='y' && isConsonant(z+1) && z[2] ){
 z[0] = 'i';
   }

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


Re: [sqlite] Query plan of MAX (id) versus MAX (id) + 1 in a range

2010-02-22 Thread Pavel Ivanov
> Did you try something like:
>
> SELECT  id + 1 FROM foo WHERE id>= 100 AND id<  200 and id = MAX (id);

Probably you meant

SELECT  id + 1 FROM foo WHERE id>= 100 AND id<  200
ORDER BY id DESC LIMIT 1;

Otherwise it's incorrect SQL.


Pavel

On Mon, Feb 22, 2010 at 5:27 PM, Jim Morris  wrote:
> Did you try something like:
>
> SELECT  id + 1 FROM foo WHERE id>= 100 AND id<  200 and id = MAX (id);
>
>
>
> On 02/22/2010 7:02 AM, ArtemGr wrote:
>> Simon Slavin  writes:
>>
>>> Just out of interest, and I know that theoretically this is not an optimal
>>> statement, but have you compared
>>> this with the results of putting the '+1' in the brackets ?
>>>
>> Thanks for the pointer, Simon.
>>
>> Looking back to my analizys, I see that it was wrong.
>>   SELECT MAX (id) FROM foo WHERE id>= 100 AND id<  200;
>> actually jumps to Close directly after AggStep,
>> it would only read a single row to produce the result.
>>
>> No suck luck for
>>   SELECT MAX (id) + 1 FROM foo WHERE id>= 100 AND id<  200;
>> which goes thru the whole range.
>>
>>
>> As for MAX (id) + 1 versus MAX (id + 1),
>>
>> SELECT MAX (id) + 1 FROM foo WHERE id>= 100 AND id<  200;
>> calculates MAX (id) in a cycle, then it adds 1 outside of the cycle,
>> before submitting ResultRow.
>>
>> SELECT MAX (id + 1) FROM foo WHERE id>= 100 AND id<  200;
>> increments id in every iteration of the cycle and passes the result to max.
>>
>> MAX (id + 1) is clearly less optimizable than MAX (id) + 1.
>> Obvioulsy, SQLite already have a special case optimization for MAX (id),
>> but optimization breaks with MAX (id) + 1, making it impractical for use in
>> INSERT SELECT.
>>
>> ___
>> 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] Query plan of MAX (id) versus MAX (id) + 1 in a range

2010-02-22 Thread Jim Morris
Did you try something like:

SELECT  id + 1 FROM foo WHERE id>= 100 AND id<  200 and id = MAX (id);



On 02/22/2010 7:02 AM, ArtemGr wrote:
> Simon Slavin  writes:
>
>> Just out of interest, and I know that theoretically this is not an optimal
>> statement, but have you compared
>> this with the results of putting the '+1' in the brackets ?
>>  
> Thanks for the pointer, Simon.
>
> Looking back to my analizys, I see that it was wrong.
>   SELECT MAX (id) FROM foo WHERE id>= 100 AND id<  200;
> actually jumps to Close directly after AggStep,
> it would only read a single row to produce the result.
>
> No suck luck for
>   SELECT MAX (id) + 1 FROM foo WHERE id>= 100 AND id<  200;
> which goes thru the whole range.
>
>
> As for MAX (id) + 1 versus MAX (id + 1),
>
> SELECT MAX (id) + 1 FROM foo WHERE id>= 100 AND id<  200;
> calculates MAX (id) in a cycle, then it adds 1 outside of the cycle,
> before submitting ResultRow.
>
> SELECT MAX (id + 1) FROM foo WHERE id>= 100 AND id<  200;
> increments id in every iteration of the cycle and passes the result to max.
>
> MAX (id + 1) is clearly less optimizable than MAX (id) + 1.
> Obvioulsy, SQLite already have a special case optimization for MAX (id),
> but optimization breaks with MAX (id) + 1, making it impractical for use in
> INSERT SELECT.
>
> ___
> 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] Database is locked error

2010-02-22 Thread Pavel Ivanov
> Does that seem correct?

Yes.

> If so, my options are:
>
> 1)  rollback/commit one of the transactions
>
> 2)  use begin exclusive

That's correct, but it's better to be 'begin immediate' than 'exclusive'.

> I don't think the second one will work, since I need nested transactions
> and the savepoint syntax doesn't seem to support the exclusive option.

You can easily check if transaction is already started (see
http://www.sqlite.org/c3ref/get_autocommit.html). If it is then you'll
use savepoint syntax otherwise you'll use 'begin immediate' syntax.
When you need to commit (nested) transaction you'll need to use
'release savepoint' syntax if you used savepoint at the beginning and
'commit' if you used 'begin'.


Pavel

On Mon, Feb 22, 2010 at 4:59 PM, Trainor, Chris
 wrote:
> Thanks for the response Pavel.  The order that the events were getting
> logged wasn't accurate enough so I increased the timing precision for my
> logging.  I didn't leave anything out, but some commands were logged
> slightly out of order.
>
>
>
> Thread1 is doing reads and writes for a while, with Thread2 attempting
> to insert.  Thread2 ends up in the BusyHandler for a while and then the
> following occurs in this order:
>
>
>
> Thread      Command                       Lock        Step
>
> 1                  RELEASE SAVEPOINT Thread1        None            1
>
> 2                              INSERT INTO TableA
> Exclusive       2
>
> 2                  RELEASE SAVEPOINT Thread2        None            3
>
> 2                  SAVEPOINT Thread2                      None
> 4
>
> 2                              INSERT INTO TableA
> Exclusive       5
>
> 1                  SAVEPOINT Thread1                     None
> 6
>
> 2                  RELEASE SAVEPOINT Thread2        None            7
>
> 1                              SELECT FROM TableA
> Shared          8
>
> 2                  SAVEPOINT Thread2                      None
> 9
>
> 1                              SELECT FROM TableB
> Shared          10
>
> 2                              INSERT INTO TableA
> Reserved?     11
>
> 1                              INSERT INTO TableB
> *           12
>
>
>
>
>
> Step 1 - The transaction is closed on thread1, so it no longer has a
> lock.
>
> Step 2 - This is the insert that was failing, with Thread2 ending up in
> the busyhandler.  When thread2 first tried to insert, it obtained a
> reserved lock.  Now that thread1 released its lock, thread2 gets an
> exclusive lock and the insert finally succeeds at this point.
>
>
>
> I think what is going wrong is this:
>
> Step 11 - Thread2 tries to do an insert.  Since Thread1 has a shared
> lock, thread2 acquires a reserved lock but it cannot be promoted to
> Exclusive.
>
> Step 12 - BusyHandler is not called.  Database is locked error is
> returned.  Thread1's shared lock cannot be promoted to a reserved lock,
> since Thread2 already has one.
>
>
>
> Does that seem correct?
>
>
>
> If so, my options are:
>
> 1)  rollback/commit one of the transactions
>
> 2)  use begin exclusive
>
>
>
> I don't think the second one will work, since I need nested transactions
> and the savepoint syntax doesn't seem to support the exclusive option.
>
>
>
> Thanks,
>
> Chris
>
>
>
>
>
> The information contained in this email message and its attachments
> is intended
> only for the private and confidential use of the recipient(s) named
> above, unless the sender expressly agrees otherwise. Transmission
> of email over the Internet
>  is not a secure communications medium. If you are requesting or
> have requested
> the transmittal of personal data, as defined in applicable privacy
> laws by means
>  of email or in an attachment to email you must select a more
> secure alternate means of transmittal that supports your
> obligations to protect such personal data. If the reader of this
> message is not the intended recipient and/or you have received this
> email in error, you must take no action based on the information in
> this email and you are hereby notified that any dissemination,
> misuse, copying, or disclosure of this communication is strictly
> prohibited. If you have received
> this communication in error, please notify us immediately by email
> and delete the original message.
> ___
> 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] Database is locked error

2010-02-22 Thread Trainor, Chris
Thanks for the response Pavel.  The order that the events were getting
logged wasn't accurate enough so I increased the timing precision for my
logging.  I didn't leave anything out, but some commands were logged
slightly out of order.

 

Thread1 is doing reads and writes for a while, with Thread2 attempting
to insert.  Thread2 ends up in the BusyHandler for a while and then the
following occurs in this order:

 

Thread  Command   LockStep

1  RELEASE SAVEPOINT Thread1None1

2  INSERT INTO TableA
Exclusive   2

2  RELEASE SAVEPOINT Thread2None3

2  SAVEPOINT Thread2  None
4

2  INSERT INTO TableA
Exclusive   5

1  SAVEPOINT Thread1 None
6

2  RELEASE SAVEPOINT Thread2None7

1  SELECT FROM TableA
Shared  8

2  SAVEPOINT Thread2  None
9

1  SELECT FROM TableB
Shared  10

2  INSERT INTO TableA
Reserved? 11

1  INSERT INTO TableB
*   12

  

 

Step 1 - The transaction is closed on thread1, so it no longer has a
lock.

Step 2 - This is the insert that was failing, with Thread2 ending up in
the busyhandler.  When thread2 first tried to insert, it obtained a
reserved lock.  Now that thread1 released its lock, thread2 gets an
exclusive lock and the insert finally succeeds at this point.

 

I think what is going wrong is this:

Step 11 - Thread2 tries to do an insert.  Since Thread1 has a shared
lock, thread2 acquires a reserved lock but it cannot be promoted to
Exclusive.

Step 12 - BusyHandler is not called.  Database is locked error is
returned.  Thread1's shared lock cannot be promoted to a reserved lock,
since Thread2 already has one.

 

Does that seem correct?

 

If so, my options are:

1)  rollback/commit one of the transactions

2)  use begin exclusive

 

I don't think the second one will work, since I need nested transactions
and the savepoint syntax doesn't seem to support the exclusive option.

 

Thanks,

Chris

 



The information contained in this email message and its attachments
is intended
only for the private and confidential use of the recipient(s) named
above, unless the sender expressly agrees otherwise. Transmission
of email over the Internet
 is not a secure communications medium. If you are requesting or
have requested
the transmittal of personal data, as defined in applicable privacy
laws by means
 of email or in an attachment to email you must select a more
secure alternate means of transmittal that supports your
obligations to protect such personal data. If the reader of this
message is not the intended recipient and/or you have received this
email in error, you must take no action based on the information in
this email and you are hereby notified that any dissemination,
misuse, copying, or disclosure of this communication is strictly
prohibited. If you have received
this communication in error, please notify us immediately by email
and delete the original message.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Order of triggers

2010-02-22 Thread Pavel Ivanov
I cannot find right now details on this in SQLite documentation but
AFAIK order of triggers execution is undefined and you cannot rely on
any of them.


Pavel

On Mon, Feb 22, 2010 at 3:15 PM, Jens Frøkjær  wrote:
> Hi,
>
> I was wondering in what order triggers are executed. I'm using the after
> update, and have both "column-based" and "row-based" triggers. By
> column-based, i simply mean triggers that only fire if a specific column is
> updated.
>
> I did a bit of googling myself, and came up with [1]. It is pretty clear,
> triggers should be executed alphabetically. That actually seemes like a
> great idea, because, then I have full control. I also did my own testing,
> which turned up reverse-creating ordering. That means, the newest created
> trigger is called first.
>
> Is the order actually fixed, or can it be "any order"? And if it is fixed,
> can I, to some degree, trust that it will not change in future relases?
>
> [1]: http://code.google.com/p/sqlite-fk-triggers/wiki/TriggerOrder
>
> Best regards,
> Jens F!
> ___
> 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] Order of triggers

2010-02-22 Thread Jens Frøkjær
Hi,

I was wondering in what order triggers are executed. I'm using the after
update, and have both "column-based" and "row-based" triggers. By
column-based, i simply mean triggers that only fire if a specific column is
updated.

I did a bit of googling myself, and came up with [1]. It is pretty clear,
triggers should be executed alphabetically. That actually seemes like a
great idea, because, then I have full control. I also did my own testing,
which turned up reverse-creating ordering. That means, the newest created
trigger is called first.

Is the order actually fixed, or can it be "any order"? And if it is fixed,
can I, to some degree, trust that it will not change in future relases?

[1]: http://code.google.com/p/sqlite-fk-triggers/wiki/TriggerOrder

Best regards,
Jens F!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Questions regarding Lemon

2010-02-22 Thread Wilson, Ronald
> > %type course_plot { std::vector* }
> >
> > course_plot(V) ::= COURSE_PLOT_BEG course_plot_sector(A) .
> > {
> >
> The issue is more what V is when the vector isn't created.
> 
> 
>  Igmar

lemon is not going to initialize anything for you.  You need to design
your parser such that you can control the creation and deletion of your
own objects.

*** untested pseudo-c code ***

%type assigments { struct llist *}
main ::= zero_or_more_statments.
zero_or_more_statements ::= .
zero_or_more_statements ::= zero_or_more_statements one_statement.
one_statement ::= assignments(L). { dostuff(*L); free(L); }
assignments(A) ::= ASSIGNMENT_BEGIN assignment(B). { A = malloc(...);
A->add(B); }
assignments(A) ::= assignments(L) assignment(B). { A = L; A->add(B); }

RW

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division
assuredcommunications(tm)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Query plan of MAX (id) versus MAX (id) + 1 in a range

2010-02-22 Thread Pavel Ivanov
> Obvioulsy, SQLite already have a special case optimization for MAX (id),
> but optimization breaks with MAX (id) + 1, making it impractical for use in
> INSERT SELECT.

Even not all kind of MAX(id) queries are optimized:
http://www.sqlite.org/optoverview.html#minmax


Pavel

On Mon, Feb 22, 2010 at 10:02 AM, ArtemGr  wrote:
> Simon Slavin  writes:
>> Just out of interest, and I know that theoretically this is not an optimal
>> statement, but have you compared
>> this with the results of putting the '+1' in the brackets ?
>
> Thanks for the pointer, Simon.
>
> Looking back to my analizys, I see that it was wrong.
>  SELECT MAX (id) FROM foo WHERE id >= 100 AND id < 200;
> actually jumps to Close directly after AggStep,
> it would only read a single row to produce the result.
>
> No suck luck for
>  SELECT MAX (id) + 1 FROM foo WHERE id >= 100 AND id < 200;
> which goes thru the whole range.
>
>
> As for MAX (id) + 1 versus MAX (id + 1),
>
> SELECT MAX (id) + 1 FROM foo WHERE id >= 100 AND id < 200;
> calculates MAX (id) in a cycle, then it adds 1 outside of the cycle,
> before submitting ResultRow.
>
> SELECT MAX (id + 1) FROM foo WHERE id >= 100 AND id < 200;
> increments id in every iteration of the cycle and passes the result to max.
>
> MAX (id + 1) is clearly less optimizable than MAX (id) + 1.
> Obvioulsy, SQLite already have a special case optimization for MAX (id),
> but optimization breaks with MAX (id) + 1, making it impractical for use in
> INSERT SELECT.
>
> ___
> 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] Query plan of MAX (id) versus MAX (id) + 1 in a range

2010-02-22 Thread ArtemGr
Simon Slavin  writes:
> Just out of interest, and I know that theoretically this is not an optimal
> statement, but have you compared
> this with the results of putting the '+1' in the brackets ?

Thanks for the pointer, Simon.

Looking back to my analizys, I see that it was wrong.
 SELECT MAX (id) FROM foo WHERE id >= 100 AND id < 200;
actually jumps to Close directly after AggStep,
it would only read a single row to produce the result.

No suck luck for 
 SELECT MAX (id) + 1 FROM foo WHERE id >= 100 AND id < 200;
which goes thru the whole range.


As for MAX (id) + 1 versus MAX (id + 1),

SELECT MAX (id) + 1 FROM foo WHERE id >= 100 AND id < 200;
calculates MAX (id) in a cycle, then it adds 1 outside of the cycle,
before submitting ResultRow.

SELECT MAX (id + 1) FROM foo WHERE id >= 100 AND id < 200;
increments id in every iteration of the cycle and passes the result to max.

MAX (id + 1) is clearly less optimizable than MAX (id) + 1.
Obvioulsy, SQLite already have a special case optimization for MAX (id),
but optimization breaks with MAX (id) + 1, making it impractical for use in
INSERT SELECT.

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


Re: [sqlite] SQLite BUSY error - single-threaded app

2010-02-22 Thread Pavel Ivanov
> All of the archive content on SQLITE_BUSY appears to assume multi-threaded
> database access; I have only a primary thread.

There's also multi-process access. Is there any chance that there're
several instances of your application running at the same time? What
is your test case exactly? Is it your application doing a cycle 300
times and hitting an error eventually? Do you try to access the same
database with some tool to see what is stored inside it at the moment?


Pavel

On Fri, Feb 19, 2010 at 11:53 AM, Alan Thomas  wrote:
> I'm currently working with version 3.6.14 on Windows XP/SP4 (32-bit).  The
> application is coded for Unicode.
>
> I wrote all of the application (MS C++ native code) excluding SQLite, so I'm
> confident that it is a single-threaded app.  Threads have never been part of
> its design.
>
> The failure occurs in a common service routine called perhaps 300 times
> before this error is reported.
>
> The failure occurs every time I run the program and always occurs in the
> same place.
>
> While executing the following set BEGIN/DELETE/COMMIT/BEGIN/INSERT/COMMIT
> commands approximately once per second, SQLite is returning 0x05 (BUSY) on
> the first COMMIT in the second iteration of the loop.  A journal file does
> exist when the BUSY condition is returned.
>
> Because this is a single-threaded app, waiting for the lock to clear doesn't
> work.
>
> In the following source code, "SQLiteError ( )" is a common services routine
> that provides a message box and logging in the event of an error.
>
> Source code:
>
>  SqlDB   = NULL ;
>
>  SqlStmt = NULL ;
>
>  SqlStatus = sqlite3_open16 ( db_loc_string
>
>                             , 
>
>                             ) ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    SQLiteError ( NULL
>
>                , L"sqlite3_open16 ( )"
>
>                ) ;
>
>    sqlite3_close ( SqlDB ) ; SqlDB = NULL ;
>
>    return DATASTORE_UNAVAILABLE ;
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_open16 ( SqlDB
>
>                                   , L"BEGIN TRANSACTION"
>
>                                   , 36
>
>                                   , 
>
>                                   , NULL
>
>                                   ) ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    SQLiteError ( L"BEGIN TRANSACTION 1"
>
>                , L"sqlite3_prepare16_V2 ( )"
>
>                ) ;
>
>    sqlite3_close ( SqlDB ) ; SqlDB = NULL ;
>
>    return SQL_PREP_ERROR ;
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_prepare16_v2 ( SqlDB
>
>                                   , L"BEGIN TRANSACTION"
>
>                                   , 36
>
>                                   , 
>
>                                   , NULL
>
>                                   ) ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    SQLiteError ( L"BEGIN TRANSACTION 1"
>
>                , L"sqlite3_prepare16_V2 ( )"
>
>                ) ;
>
>    sqlite3_close ( SqlDB ) ; SqlDB = NULL ;
>
>    return SQL_PREP_ERROR ;
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_step ( SqlStmt ) ;
>
>  if ( SQLITE_DONE != SqlStatus )
>
>  {
>
>    SQLiteError ( L"BEGIN TRANSACTION 1"
>
>                , L"sqlite3_step ( )"
>
>                ) ;
>
>    sqlite3_finalize ( SqlStmt ) ; SqlStmt = NULL ;
>
>    sqlite3_close    ( SqlDB   ) ; SqlDB   = NULL ;
>
>    return TXN_BEGIN_FAILED ;
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_finalize ( SqlStmt ) ; SqlStmt = NULL ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    SQLiteError ( L"BEGIN TRANSACTION 1"
>
>                , L"sqlite3_finalize ( )"
>
>                ) ;
>
>    sqlite3_close ( SqlDB ) ; SqlDB = NULL ;
>
>    return SQL_FNLZ_ERROR ;
>
>  }
>
>
>
>
>
>  swprintf_s ( (PXID_CHAR)sql_statement
>
>             , sizeof ( sql_statement ) / sizeof ( XID_CHAR )
>
>             ,   L"DELETE"
>
>                  L" FROM RSPNS"
>
>                 L" WHERE . . .
>
>             ) ;
>
>  SqlStatus = sqlite3_prepare16_v2 ( SqlDB
>
>                                   , sql_statement
>
>                                   , ( lstrlen ( sql_statement ) + 1 ) *
> sizeof ( XID_CHAR )
>
>                                   , 
>
>                                   , NULL
>
>                                   ) ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    SQLiteError ( sql_statement
>
>                , L"sqlite3_prepare16_v2 ( )"
>
>                ) ;
>
>    sqlite3_close ( SqlDB ) ; SqlDB = NULL ;
>
>    return SQL_PREP_ERROR ;  //  IMPLICIT DATA BASE ROLLBACK
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_step ( SqlStmt ) ;
>
>  if ( SQLITE_DONE != SqlStatus )
>
>  {
>
>    SQLiteError ( sql_statement
>
>                , L"sqlite3_step ( )"
>
>                ) ;
>
>    sqlite3_finalize ( SqlStmt ) ; SqlStmt = NULL ;
>
>    sqlite3_close    ( SqlDB   ) ; SqlDB   = NULL ;
>
>    return SQL_DLET_ERROR ;
>
>  }
>
>
>
>
>
>  SqlStatus = sqlite3_finalize ( SqlStmt ) ; SqlStmt = NULL ;
>
>  if ( SQLITE_OK != SqlStatus )
>
>  {
>
>    

Re: [sqlite] Getting Full Readline Support on Mac OS X

2010-02-22 Thread P Kishor
On Mon, Feb 22, 2010 at 9:31 AM, Simon de Bernard  wrote:
> I stumbled onto this this week end and I eventually got it working by
> providing the proper location of include and library files to the
> CPPFLAGS and LDFLAGS environment variables (by default sqlite will
> find the Mac OS X version of readline -- which is old -- and stick to
> it...)
>
> e.g: If you installed in /usr/local:
> CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
>

I wish there were a canonical answer for this, but, fwiw, I have never
had to do any of the above. I just straight ahead do a ./configure,
make, make install, and everything just works... readline and all.
What am I doing right? I really would like to know.


> Simon.
>
> Le 22 févr. 10 à 16:15, Jeffrey Thompson a écrit :
>
>> I'm compiling and installing sqlite-3.6.22 on Mac OS X and am
>> failing to get
>> the full readline capabilities (emacs editing and primarily reverse
>> search
>> for previous commands).  I have installed the readline-6.1.tar.gz
>> library
>> and it appeared the standard config and make install used it but I
>> still
>> don't have the full readline support.  Can someone give me a few
>> pointers to
>> get full command line editing to work on the mac?
>>
>> Thanks!
>>
>> Jeffrey Thompson
>> JANOAH, INC.
>> jeff...@janoah.net




-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---
Assertions are politics; backing up assertions with evidence is science
===
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite 2.1 -> 3 migration

2010-02-22 Thread Filip Navara
On Wed, Feb 17, 2010 at 11:51 PM, Andreas Weller
 wrote:
> Hi.
> Unfortunately my Webhosting provider ceased sqlite 2 support. I
> downloaded the database file using FTP and tried to dump it on a debian
> PC with sqlite 2.8.17
>
> This resulted in the following error message:
>> andr...@notebook:~/db$ sqlite ./database.db ".dump"
>> Unable to open database ./database.db
>
> I had a look into it with hexdump:
>
>> 2a 2a 20 54 68 69 73 20  66 69 6c 65 20 63 6f 6e  |** This file con|
>>  74 61 69 6e 73 20 61 6e  20 53 51 4c 69 74 65 20  |tains an SQLite |
>>  32 2e 31 20 64 61 74 61  62 61 73 65 20 2a 2a 00  |2.1 database **.|
>>  28 75 e3 da 0f 08 00 00  01 00 00 00 23 00 00 00  |(u..#...|
>>  04 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
>>  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
>
> Is there any known problem with using sqlite 2.1 files with 2.8 version?
>
> How to convert this version to sqlite 3?
>
> Thank you!
>
>
> Regards,
>  Andreas Weller
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

Hi,

this may be a stupid question, but have you used the BINARY mode when
downloading the file from the FTP?

Best regards,
Filip Navara
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Getting Full Readline Support on Mac OS X

2010-02-22 Thread Simon de Bernard
I stumbled onto this this week end and I eventually got it working by  
providing the proper location of include and library files to the  
CPPFLAGS and LDFLAGS environment variables (by default sqlite will  
find the Mac OS X version of readline -- which is old -- and stick to  
it...)

e.g: If you installed in /usr/local:
CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure

Simon.

Le 22 févr. 10 à 16:15, Jeffrey Thompson a écrit :

> I'm compiling and installing sqlite-3.6.22 on Mac OS X and am  
> failing to get
> the full readline capabilities (emacs editing and primarily reverse  
> search
> for previous commands).  I have installed the readline-6.1.tar.gz  
> library
> and it appeared the standard config and make install used it but I  
> still
> don't have the full readline support.  Can someone give me a few  
> pointers to
> get full command line editing to work on the mac?
>
> Thanks!
>
> Jeffrey Thompson
> JANOAH, INC.
> jeff...@janoah.net
> ___
> 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] [Lemon] Jump to %syntax_error

2010-02-22 Thread Igmar Palsenberg
Hi,

Can I somehow simulate a syntax error from within a rule action ? This 
parser looks up the token it receives, and I want to abort futher 
parsing in case that the lookup fails. as if there was a syntax error in 
the grammar.


Regards,


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


Re: [sqlite] Questions regarding Lemon

2010-02-22 Thread Igmar Palsenberg

> %type course_plot { std::vector* }
>
> course_plot(V) ::= COURSE_PLOT_BEG course_plot_sector(A) .
>   {
>
The issue is more what V is when the vector isn't created.


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


Re: [sqlite] Getting Full Readline Support on Mac OS X

2010-02-22 Thread Jeffrey Thompson
I'm compiling and installing sqlite-3.6.22 on Mac OS X and am failing to get
the full readline capabilities (emacs editing and primarily reverse search
for previous commands).  I have installed the readline-6.1.tar.gz library
and it appeared the standard config and make install used it but I still
don't have the full readline support.  Can someone give me a few pointers to
get full command line editing to work on the mac?

Thanks!

Jeffrey Thompson
JANOAH, INC.
jeff...@janoah.net
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Questions regarding Lemon

2010-02-22 Thread Wilson, Ronald
You have to initialize the variable yourself, e.g.

%type course_plot { std::vector* } 

course_plot(V) ::= COURSE_PLOT_BEG course_plot_sector(A) .
{
V = new std::vector;
V->push_back(A);
}
course_plot(V) ::= course_plot(L) COURSE_PLOT_GT course_plot_sector(A) .
{
V = L;
V->push_back(A);
}

And yes, I parse TradeWars 2002 with lemon.  /bow

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division 
assuredcommunications(tm)


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Igmar Palsenberg
> Sent: Monday, February 22, 2010 7:39 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Questions regarding Lemon
> 
> 
> Hi,
> 
> After a decode or so I've begun to program in C again. I've writing a
> parser, and Lemon seems like the right tool for the job. SQLite itself
> is an excellent read when starting with lemon.
> However, a few questions remain unanswered :
> 
> - How do variables get initialized ? For example :
> 
> %type assigments { struct llist *}
> 
> assignments(A) ::= assignments assignment(B). { /* . */ }
> assignments(A) ::= assignment(B). {/*  */ }
> 
> Can I assume that A, when the rule is executed the first time, is NULL ?
> 
> - What is the meaning of @ in an assignment ? From the sqlite parse.y
> source :
> 
> transtype(A) ::= DEFERRED(X).  {A = @X;}
> 
> Thanx in advance for all the hints :)
> 
> 
> Regards,
> 
> 
>  Igmar
> 
> ___
> 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] Questions regarding Lemon

2010-02-22 Thread Igmar Palsenberg
Hi,

After a decode or so I've begun to program in C again. I've writing a 
parser, and Lemon seems like the right tool for the job. SQLite itself 
is an excellent read when starting with lemon.
However, a few questions remain unanswered :

- How do variables get initialized ? For example :

%type assigments { struct llist *}

assignments(A) ::= assignments assignment(B). { /* . */ }
assignments(A) ::= assignment(B). {/*  */ }

Can I assume that A, when the rule is executed the first time, is NULL ?

- What is the meaning of @ in an assignment ? From the sqlite parse.y 
source :

transtype(A) ::= DEFERRED(X).  {A = @X;}

Thanx in advance for all the hints :)


Regards,


 Igmar

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