Re: [sqlite] OS X/PHP5/SQLite Build> fatal error: no input grammar

2004-12-16 Thread D. Richard Hipp
spartian wrote:
  I posted this on the PHP Builder site, but further investigation (and
no replies) seems to   point to SQLite portion of the PHP5 compile
process, but I'm new to this so I may be wrong.  Any hints would be
greatly appreciated.
-Jon
 -
[...] 
  I'm running OS X, 10.3.6, and attempting to compile apache 1.3.33,
php5, and perl5 for the first time. It appears that I've selected
something that interfers with sqlite and bison.

  But then when I run 'sudo make' it seems to have a problem with sqlite
library in php5 listing a whole bunch of problems with bison:
  /usr/local/src/php-5.0.2/ext/sqlite/libsqlite/src/parse.y:887: %type
declaration has no 
In spite of the *.y suffix, the parse.y source file of SQLite is
processed using Lemon, not Bison/Yacc.  Lemon is an LALR(1) parser
generator like Bison/Yacc (hence the similar suffix) but uses a
different input syntax and generates a parser that is more useful
to an embedded database engine.  The complete source code to
Lemon is included in the SQLite source tree.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


[sqlite] OS X/PHP5/SQLite Build> fatal error: no input grammar

2004-12-16 Thread spartian
Hello All,
  I posted this on the PHP Builder site, but further investigation (and
no replies) seems to   point to SQLite portion of the PHP5 compile
process, but I'm new to this so I may be wrong.  Any hints would be
greatly appreciated.
-Jon
 
-

Hello All,
  I will summerize my problem and provide the details at the end.
Besides my compile problem, I have a secondary question.
  I'm running OS X, 10.3.6, and attempting to compile apache 1.3.33,
php5, and perl5 for the first time. It appears that I've selected
something that interfers with sqlite and bison.
  1) Any Idea's? (or where to look for info)
  2) Is there any advantage to loading mod_php to apache statically
besides reducing time to load/start the server?
  Finally, I wanted to use the latest version of Apache, which seems to
force me to compile the rest of the software as many of the precomplied
pachages seem to 'need' the original version of Apache that Apple
supplied with Panther.
  Thanks,
  Jon
  --
  In this process I'm building mod_php from the /usr/local/src/php-5.0.2
directory. My configuration line is as follows:
  sudo ./configure --with-apache=../apache_1.3.33 \
  --with-mysql=/usr/local/mysql --enable-track-vars
  Which seems to run fine. (btw I did download Marc Liyanage's compiled
version of mysql)
  But then when I run 'sudo make' it seems to have a problem with sqlite
library in php5 listing a whole bunch of problems with bison:
  /usr/local/src/php-5.0.2/ext/sqlite/libsqlite/src/parse.y:887: %type
declaration has no 
  /usr/local/src/php-5.0.2/ext/sqlite/libsqlite/src/parse.y:887:
Skipping to next %
  /usr/local/src/php-5.0.2/ext/sqlite/libsqlite/src/parse.y:898: fatal
error: no input grammar
  make: *** [/usr/local/src/php-5.0.2/ext/sqlite/libsqlite/src/parse.c]
Error 1
  Now I did use Fink to install the latest version of Bison 1-35.2, but
I haven't reboot/logout since. Also I've installed Apple's Nov 2004 gcc
updater.



RE: [sqlite] absolute vs. relative path to database on Cygwin

2004-12-16 Thread Reid Thompson
Greg Miller wrote:
> amead wrote:
> 
>> Are you doing this at the Cygwin prompt or Window's command prompt?
>> My installation of Cygwin doesn't recognize DOS style paths at all:
>> 
>> $ ls c:\cygwin
>> ls: c:cygwin: No such file or directory
> 
> You used a backslash, escaping the 'c' character. Notice that the
> error message refers to "c:cygwin" rather than "c:\cygwin", which
> isn't equivalent. 
> 
> Try "ls c:/cygwin" instead.
> 
http://glmiller.blogspot.com/ "If my forgeries looked as bad as the CBS
documents, it would have been 'Catch Me In Two Days'"   -- Frank
Abagnale, Jr. 

try:
mkdir /C
mount -s -x -b C: /C
ls /C

reid


Re: [sqlite] default CURRENT_TIMESTAMP constraint broken

2004-12-16 Thread Jay

I get the same, I think I saw a message that the fix was checked into
revision control but not yet released.

--- Dennis Ryan <[EMAIL PROTECTED]> wrote:

> I have the following table
> 
> create table test
> ( test_id integer not null,
>   last_mod_date default current_timestamp,
>   stuff,
>   primary key(test_id));
> 
> if I run the following insert into test(stuff) values('junk');
> I get the string literal current_timestamp in my last_mod_date
> columns value


=

-

"Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on the walls of 
the ancient tomb of the petrified pharaoh, he vowed there would be no curse on 
him like on that other Lord, unless you count his marriage to Lady Tarlington 
who, when the lost treasure was found, will be dumped faster than that basket 
in the bulrushes."
  Melissa Rhodes
-

The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's 
Call
http://www.lulu.com/content/77264



__ 
Do you Yahoo!? 
Jazz up your holiday email with celebrity designs. Learn more. 
http://celebrity.mail.yahoo.com


[sqlite] default CURRENT_TIMESTAMP constraint broken

2004-12-16 Thread Dennis Ryan
I have the following table

create table test
( test_id integer not null,
  last_mod_date default current_timestamp,
  stuff,
  primary key(test_id));

if I run the following insert into test(stuff) values('junk');
I get the string literal current_timestamp in my last_mod_date columns value
and not the expected current UTC time.  Is this a bug or am I missing
something.  I can use a trigger to emulate the behavior of the default
constraint.  I am using slqlite 3.0.8

Dennis Ryan



RE: [sqlite] Union queries with sub-select tables with limits returns no results

2004-12-16 Thread Bob Dankert
Thanks for the help, Dennis.  I created a bug with ticket number 1035
for anyone interested in following up on this.

Thanks!

Bob 

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 16, 2004 2:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] Union queries with sub-select tables with limits
returns no results

Bob Dankert wrote:
> I am trying to union two queries with each query having a sub-select 
> defining the table, but I consistenly get no results if I try to limit

> the sub-query.  Here is my query, assuming the table a and table 
> contain one column filled with integers.
>
> Select * from (select * from a limit 3) as a;   <-- this returns 3
> results
> Select * from (select * from b limit 3) as b;   <-- this returns 3
> results
>
> Select * from (select * from a limit 3) as a union select * from 
> (select * from b limit 3) as b; <-- this returns 0 results
>
> If I get rid of the limits, everything is returned from both tables as

> it should be:
> Select * from (select * from a) as a union select * from (select * 
> from b) as b;
>
> Unfortunately, I need to limit the results in individual queries which

> are being unioned together.  Since SQLite does not support limiting 
> individual queries in a union, I was hoping to use sub-selects for the

> tables and limit these.  Does anyone have any suggestions as to what I

> can do for this?
>
> Thanks,
>
> Bob Dankert

Bob,

As a work around you can create temp tables from the two sub-selects and
use a union select to combine them, or create a temp table with the
output of the first sub-select and then insert the result of the second
sub-select into the temp table and then dump that table.

create temp table t1 as select * from a limit 3; create temp table t2 as
select * from b limit 3; select * from t1 union select * from t2;

or

create temp table u as select * from a limit 3; insert into u select *
from b limit 3; select * from u;

I hope this helps.


[sqlite] question about explained sql statement

2004-12-16 Thread Charles Mills
I was playing around with the C interface to sqlite3 and I was 
surprised by the results at the bottom of this email.  Mainly:

addr = 8
opcode = MakeRecord
p1 = 3
p2 = 0
p3 = nni   <--- I figured this would be "tti".  Since fname and 
lname are strings.

What am I missing?
-Charlie
$ ./test test.db "explain insert into people values ('fname', 'lname', 
10)"
addr = 0
opcode = Goto
p1 = 0
p2 = 12
p3 =

addr = 1
opcode = Integer
p1 = 0
p2 = 0
p3 =
addr = 2
opcode = OpenWrite
p1 = 0
p2 = 2
p3 =
addr = 3
opcode = SetNumColumns
p1 = 0
p2 = 3
p3 =
addr = 4
opcode = NewRecno
p1 = 0
p2 = 0
p3 =
addr = 5
opcode = String8
p1 = 0
p2 = 0
p3 = fname
addr = 6
opcode = String8
p1 = 0
p2 = 0
p3 = lname
addr = 7
opcode = Integer
p1 = 10
p2 = 0
p3 =
addr = 8
opcode = MakeRecord
p1 = 3
p2 = 0
p3 = nni
addr = 9
opcode = PutIntKey
p1 = 0
p2 = 3
p3 =
addr = 10
opcode = Close
p1 = 0
p2 = 0
p3 =
addr = 11
opcode = Halt
p1 = 0
p2 = 0
p3 =
addr = 12
opcode = Transaction
p1 = 0
p2 = 1
p3 =
addr = 13
opcode = VerifyCookie
p1 = 0
p2 = 2
p3 =
addr = 14
opcode = Goto
p1 = 0
p2 = 1
p3 =
addr = 15
opcode = Noop
p1 = 0
p2 = 0
p3 =


Re: [sqlite] Union queries with sub-select tables with limits returns no results

2004-12-16 Thread Dennis Cote
Bob Dankert wrote:
> I am trying to union two queries with each query having a sub-select
> defining the table, but I consistenly get no results if I try to limit
> the sub-query.  Here is my query, assuming the table a and table
> contain one column filled with integers.
>
> Select * from (select * from a limit 3) as a;   <-- this returns 3
> results
> Select * from (select * from b limit 3) as b;   <-- this returns 3
> results
>
> Select * from (select * from a limit 3) as a union select * from
> (select * from b limit 3) as b; <-- this returns 0 results
>
> If I get rid of the limits, everything is returned from both tables as
> it should be:
> Select * from (select * from a) as a union select * from (select *
> from b) as b;
>
> Unfortunately, I need to limit the results in individual queries which
> are being unioned together.  Since SQLite does not support limiting
> individual queries in a union, I was hoping to use sub-selects for the
> tables and limit these.  Does anyone have any suggestions as to what I
> can do for this?
>
> Thanks,
>
> Bob Dankert

Bob,

As a work around you can create temp tables from the two sub-selects and use
a union select to combine them, or create a temp table with the output of
the first sub-select and then insert the result of the second sub-select
into the temp table and then dump that table.

create temp table t1 as select * from a limit 3;
create temp table t2 as select * from b limit 3;
select * from t1 union select * from t2;

or

create temp table u as select * from a limit 3;
insert into u select * from b limit 3;
select * from u;

I hope this helps.



Re: [sqlite] Union queries with sub-select tables with limits returns no results

2004-12-16 Thread Dennis Cote
Bob Dankert wrote:
> I am trying to union two queries with each query having a sub-select
> defining the table, but I consistenly get no results if I try to limit
> the sub-query.  Here is my query, assuming the table a and table
> contain one column filled with integers.
>
> Select * from (select * from a limit 3) as a;   <-- this returns 3
> results
> Select * from (select * from b limit 3) as b;   <-- this returns 3
> results
>
> Select * from (select * from a limit 3) as a union select * from
> (select * from b limit 3) as b; <-- this returns 0 results
>
> If I get rid of the limits, everything is returned from both tables as
> it should be:
> Select * from (select * from a) as a union select * from (select *
> from b) as b;
>
> Unfortunately, I need to limit the results in individual queries which
> are being unioned together.  Since SQLite does not support limiting
> individual queries in a union, I was hoping to use sub-selects for the
> tables and limit these.  Does anyone have any suggestions as to what I
> can do for this?
>
> Thanks,
>
> Bob Dankert

Bob,

It looks like you have found a bug in SQLite. :-)

The explain output below shows how SQLite will execute your query.

sqlite> explain select * from (select * from t limit 3) union select * from
(sel
ect * from tt limit 3);
addr  opcodep1  p2  p3
    --  --  
---
0 OpenTemp  0   0   keyinfo(2,BINARY,BINARY)
1 KeyAsData 0   1
2 SetNumColumn  0   2
3 Integer   -3  0
4 MemStore  0   1
5 Goto  0   40
6 Integer   0   0
7 OpenRead  2   2
8 SetNumColumn  2   2
9 Rewind2   17
10MemIncr   0   17
11Column2   0
12Column2   1
13MakeRecord2   0
14String8   0   0
15PutStrKey 0   0
16Next  2   10
17Close 2   0
18Integer   -3  0
19MemStore  1   1
20Integer   0   0
21OpenRead  4   3
22SetNumColumn  4   2
23Rewind4   31
24MemIncr   1   31
25Column4   0
26Column4   1
27MakeRecord2   0
28String8   0   0
29PutStrKey 0   0
30Next  4   24
31Close 4   0
32Rewind0   38
33MemIncr   1   38
34Column0   0
35Column0   1
36Callback  2   0
37Next  0   33
38Close 0   0
39Halt  0   0
40Transaction   0   0
41VerifyCookie  0   2
42Goto  0   6
43Noop  0   0
sqlite>

The problem is at line 33 where it does an increment and test on memory
location 1. This test shouldn't be there! It fails immediately because the
limit clause on the second sub-select has counted memory location 1 up to
zero already (at line 24). So the query generates the correct result set and
then skips the loop with the Callback opcode, so it doesn't return any
results to you.

It looks like SQLite's compiler is getting confused by the limit clauses on
the sub-selects and adds a limit test to the outter select when it
shouldn't.

You should report this bug.


[sqlite] sqlite rpm spec on AMD64

2004-12-16 Thread Dan Nuffer
I had to make the following changes to get the rpm to build on Fedora
Core 3, AMD64 arch.  The reason is that %{_libdir} is /usr/lib64, and
not /usr/lib as the spec assumes.  Also on the make install, DESTDIR
should be set, not prefix, since the prefix is set during configure, and
the Makefiles use DESTDIR to relocate the installation.

--- spec.template   2004-07-19 17:16:19.0 -0600
+++ rpmbuild/SPECS/sqlite.spec  2004-12-16 11:28:29.964168966 -0700
@@ -33,17 +33,17 @@
 %setup -q -n %{name}

 %build
-CFLAGS="%optflags -DNDEBUG=1" CXXFLAGS="%optflags -DNDEBUG=1"
./configure --prefix=%{_prefix}
+CFLAGS="%optflags -DNDEBUG=1" CXXFLAGS="%optflags -DNDEBUG=1"
./configure --prefix=%{_prefix} --libdir=%{_libdir}

 make
 make doc

 %install
 install -d $RPM_BUILD_ROOT/%{_prefix}
 install -d $RPM_BUILD_ROOT/%{_prefix}/bin
 install -d $RPM_BUILD_ROOT/%{_prefix}/include
-install -d $RPM_BUILD_ROOT/%{_prefix}/lib
-make install prefix=$RPM_BUILD_ROOT/%{_prefix}
+install -d $RPM_BUILD_ROOT/%{_libdir}
+make install DESTDIR=$RPM_BUILD_ROOT

 %clean
 rm -fr $RPM_BUILD_ROOT

-- 
Dan Nuffer
Vintela, Inc. http://vintela.com/



RE: [sqlite] db admin tool

2004-12-16 Thread Griggs, Donald
Sten, 

Regarding: Is there any free or commercial DB admin tool that works with
sqlite 3.08 and runs under Windows.

I posted this 1 Dec, but in case you didn't find this:

--
Regarding: Are there any tools like sqliteplus that work with version 3?

Not sure what platform you need, but SqliteExplorer
http://www.sqlite.org/contrib

And SqliteCC (Control Center)
http://home.student.uu.se/frax0795/
Look for sqlitecc-api3-exe.zip and you must also have it's DLL along
with
  MSVCP71.DLL, msvcr71.dll

Are nice, open utilities.


Donald Griggs

Opinions are not necessarily those of Misys Healthcare Systems nor its board
of directors.



[sqlite] Union queries with sub-select tables with limits returns no results

2004-12-16 Thread Bob Dankert
I am trying to union two queries with each query having a sub-select
defining the table, but I consistenly get no results if I try to limit
the sub-query.  Here is my query, assuming the table a and table contain
one column filled with integers.

Select * from (select * from a limit 3) as a;   <-- this returns 3
results
Select * from (select * from b limit 3) as b;   <-- this returns 3
results

Select * from (select * from a limit 3) as a union select * from (select
* from b limit 3) as b; <-- this returns 0 results

If I get rid of the limits, everything is returned from both tables as
it should be:
Select * from (select * from a) as a union select * from (select * from
b) as b;

Unfortunately, I need to limit the results in individual queries which
are being unioned together.  Since SQLite does not support limiting
individual queries in a union, I was hoping to use sub-selects for the
tables and limit these.  Does anyone have any suggestions as to what I
can do for this?

Thanks,

Bob Dankert

-Original Message-
From: George Ionescu [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 16, 2004 1:00 AM
To: SQLite Forum
Subject: Re: [sqlite] db admin tool

Hello sten,

you could try SQLiteDb Query Analyzer from
http://www.terrainformatica.com/sqlitedb
(it's included in the SQLiteDb install package).

It's not much right now but it's going to be improved alot in the next
weeks.

Best regards,
George Ionescu