Re: [sqlite] New SQL Function.

2004-08-19 Thread Federico Granata
Alle 20:04, mercoledì 18 agosto 2004, Doug Currie ha scritto:
>
> 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.

Thanks, now it's ok.




 --

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



 Sponsor:

 Digitalpix stampa le tue migliori foto digitali

* su vera carta fotografica professionale.

 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid32-8


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] 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




[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=1964=18-8