Re: [sqlite] [sqlite-lemon] Lemon Parser Generator Tutorial

2004-08-18 Thread Serge Semashko
[EMAIL PROTECTED] wrote:
Freshmeat has a tutorial on the Lemon Parser Generator.
  http://freshmeat.net/articles/view/1270/
This tutorial walks you through a simple calculator.
It would be also interesting to have an example of using Lemon + RE2C 
(http://re2c.sf.net). I think RE2C lexer works better with Lemon than 
Flex and produces faster scanners, it suits quite well Lemon input model 
(lexer calls parser).



[sqlite] FileLocks - help requied

2004-08-18 Thread sankara . narayanan
Hi,

I am currently porting sqlite 3.0 into my device application. The device 
is running on an ARM7TDMI processor. The filesystem available on device is 
Nucleus file system. 

For this file system I am not sure whether I have the file locking 
mechanisms as provided in Sqlite 3.0. But the advantageous situation I 
have is only one thread in the application will be accessing SQLite all 
time (all the sqlite interfaces are protected using semaphores and there 
will be no two threads simultaenously accessing sqlite at any time). 

For this requirement how do I implement my OS functions sqlite3OsLock and 
sqlite3OsUnlock? Is it possible to work with no locking mechanism? I find 
that the lock utilisation (in pager.c) is not available with switches. 
Please advice me on how I could modify the sqlite code accordingly.

Regards,
Sankara Narayanan B


[sqlite] New SQL Function.

2004-08-18 Thread Federico Granata
Sorry for my english.

I try to add a new SQL function (sqrt) as described at 
http://www.hwaci.com/sw/sqlite/c_interface.html#cfunc

If I try (for understanding pourpose only) to return the same value I give to 
the function it's all ok, then (for a little experiment) I try to return the 
abs and it's ok again, but when I try to return the sqrt I obtain a compile 
error:

./libtool --mode=link gcc -g -O2 -DTHREADSAFE=1 -DOS_UNIX=1 -DOS_WIN=0 
-DHAVE_USLEEP=1 -I. -I../sqlite/src -DHAVE_READLINE=0  -o 
sqlite ../sqlite/src/shell.c \
libsqlite.la
gcc -g -O2 -DTHREADSAFE=1 -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 -I. 
-I../sqlite/src -DHAVE_READLINE=0 
-o .libs/sqlite ../sqlite/src/shell.c  ./.libs/libsqlite.so
./.libs/libsqlite.so: undefined reference to `sqrt'
collect2: ld returned 1 exit status
make: *** [sqlite] Error 1

I have add this :
/*
** Implementation of sqrt by Edo
*/
static void sqrtFunc(sqlite_func *context, int argc, const char **argv){
  assert( argc==1 );
  sqlite_set_result_double(context,sqrt(sqliteAtoF(argv[0],0)));
}

and ...
  } aFuncs[] = {
{ sqrt,   1, SQLITE_NUMERIC, 0, sqrtFunc   }, // ... this row
{ min,   -1, SQLITE_ARGS,0, minmaxFunc },

Someone can help me ? (sorry again for my english).
 

 

 --

 Email.it, the professional e-mail, gratis per te: http://www.email.it/f

 

 Sponsor:

 Da 1.500 a 10.000 Euro per realizzare i tuoi desideri con sicurezza e semplicità, 
clicca e richiedi il tuo prestito

 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1964d=18-8


Re: [sqlite] New SQL Function.

2004-08-18 Thread Doug Currie

Wednesday, August 18, 2004, 1:45:43 PM, Federico  wrote:

 [...]

 gcc -g -O2 -DTHREADSAFE=1 -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 -I.
 -I../sqlite/src -DHAVE_READLINE=0 
 -o .libs/sqlite ../sqlite/src/shell.c  ./.libs/libsqlite.so
 ./.libs/libsqlite.so: undefined reference to `sqrt'
 collect2: ld returned 1 exit status
 make: *** [sqlite] Error 1

You must link with a math library that includes sqrt.

Perhaps adding -lm (assuming you have libm.a and it has sqrt) to the
end of the TCC or LTLINK lines in the Makefile will help.

e




Re: [sqlite] New SQL Function.

2004-08-18 Thread Raymond Irving

Is there some form of documentation that should all
the functions allowed inside an SQL statement? For
example: DATE(), CASE, etc

__
Raymond Irving

--- Doug Currie [EMAIL PROTECTED] wrote:

 
 Wednesday, August 18, 2004, 1:45:43 PM, Federico 
 wrote:
 
  [...]
 
  gcc -g -O2 -DTHREADSAFE=1 -DOS_UNIX=1 -DOS_WIN=0
 -DHAVE_USLEEP=1 -I.
  -I../sqlite/src -DHAVE_READLINE=0 
  -o .libs/sqlite ../sqlite/src/shell.c 
 ./.libs/libsqlite.so
  ./.libs/libsqlite.so: undefined reference to
 `sqrt'
  collect2: ld returned 1 exit status
  make: *** [sqlite] Error 1
 
 You must link with a math library that includes
 sqrt.
 
 Perhaps adding -lm (assuming you have libm.a and it
 has sqrt) to the
 end of the TCC or LTLINK lines in the Makefile will
 help.
 
 e
 
 
 



Re: [sqlite] Rowid in VIEWs?

2004-08-18 Thread Dennis Cote
Keith Herold wrote:
 The short question:  do (temporary) VIEW's have rowid's in SQLITE?

The short answer: no.

You don't say how you are accessing the database, but if you are using C,
then you can simply use the precompiled query interface to perform your
lookup and return your result in small blocks.

You will need a getdata function that takes a query and returns up to N
results. The first time the function is called it can compile the query and
save a pointer to the vm produced. Then it steps the vm until it has
retreived N results or the vm is done. If the vm is done it can finalize the
vm and clear the vm pointer. In either case it returns the results it
retrieved.

This will let you get results in small blocks but only perform your complex
query once.

I hope this helps.


RE: [sqlite] Rowid in VIEWs?

2004-08-18 Thread Keith Herold
Heh.  Didn't think about precompiled queries at all.  Have to look into
that.  The description you give is what I am already writing to handle
it from the C++ side, so it looks like I'm half-way there .

Thanks for the help.

--Keith

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 18, 2004 11:29 AM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] Rowid in VIEWs?


Keith Herold wrote:
 The short question:  do (temporary) VIEW's have rowid's in SQLITE?

The short answer: no.

You don't say how you are accessing the database, but if you are using
C, then you can simply use the precompiled query interface to perform
your lookup and return your result in small blocks.

You will need a getdata function that takes a query and returns up to N
results. The first time the function is called it can compile the query
and save a pointer to the vm produced. Then it steps the vm until it has
retreived N results or the vm is done. If the vm is done it can finalize
the vm and clear the vm pointer. In either case it returns the results
it retrieved.

This will let you get results in small blocks but only perform your
complex query once.

I hope this helps.



[sqlite] locking via windows nfs client

2004-08-18 Thread Ara.T.Howard
has anyone out there used sqlite from a windows machine when the db resided on
an nfs filesystem mounted using the windows nfs client?  if so, does it work?
have you attempted concurrent access from other windows machines?  other *nix
machines?
i'm considering an application where process from both linux and window
machines may access an sqlite db located on a shared nfs fs.
comments?
-a
--
===
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. 
|   --Dogen
===


[sqlite] Novice Inserting TEXT/BLOB question

2004-08-18 Thread Chris Rudolph
Hi all,
I'm new to sqlite and was having problems inserting quoted text. I 
figured out the ' ' andrequirements and it resolved my issues, 
however I'm curious to know if there are other characters that also 
require this form of escaping? Is there a list somewhere?

Thanks,
Chris.
--
Chris Rudolph
[EMAIL PROTECTED]