Re: [sqlite] where to find an examples of writing a extension?

2010-06-20 Thread Liam Healy
See extension-functions.c in http://sqlite.org/contrib.

On Sat, Jun 19, 2010 at 10:52 PM, Sam Carleton
 wrote:
> I need to add a new where clause to my query, one that checks to see
> if the file actually exits.  I am thinking the correct solution is a
> user defined function, something like:
>
> bool DoesFilesReallyExist(char* rootPath, char* relativePath, char* filename)
>
> Where I could do a query like this:
>
> Select relativePath, filename, DoesFilesReallyExist("some path",
> relativePath, filename) as exists from table where exists = 1
>
> Where might I find some examples of creating user defined functions in SQLite?
>
> Sam
> ___
> 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] load_extension() and extension-functions.c

2010-02-06 Thread Liam Healy
Thank you for the Windows compilation instructions.  I have updated
the file http://sqlite.org/contrib/download/extension-functions.c?get=25
to include them, along with a small fix to the assert for squareFunc.

Liam

On Tue, Jan 19, 2010 at 4:14 AM, Oliver Peters <oliver@web.de> wrote:
> Liam Healy <l...@...> writes:
>
> [...]
>>
>> >
>> >
>> > s2: extension-functions.c
>> > -
>> > add compilation instructions for windows
>>
>> I don't know how to compile in windows; if you or
>> someone has some instructions, I'll add them.
>
>
> compile instructions for Windows:
> 
>
> 1. Install MinGW (http://www.mingw.org/) and you will get the gcc (gnu 
> compiler
> collection)
>
> 2. add the path to your path variable (isn't done during the installation!)
>
> 3. compile this way:
>
> gcc -shared -I "path" -o libsqlitefunctions.so extension-functions.c
>
> (path = path of sqlite3ext.h; i.e. C:\programs\sqlite)
>
>
> greetings
> Oliver
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] load_extension() and extension-functions.c

2010-01-18 Thread Liam Healy
On Mon, Jan 18, 2010 at 5:18 AM, Oliver Peters  wrote:
> Hello out there,
>
> I just wanted to say "thank you" for this wonderful feature (load_extension) 
> and
> the work invested into these very useful extra functions 
> (extension-functions.c).

Thanks!  The real work on extension-functions was done by Mikey C and his
coworkers.  I packaged it up and added documentation.

>
>
> From the view of a non programmer (only heavy user) I've 2 suggestions and 1
> question.
>
...

>
>
> s2: extension-functions.c
> -
> add compilation instructions for windows

I don't know how to compile in windows; if you or
someone has some instructions, I'll add them.

>
>
> q1:
> 
> I used gcc version 3.4.5 (mingw-vista special r3) to compile
> "extension-functions.c" with the following options
>
> gcc -shared -fPIC -I "c:\Programme\SQLite" -o libsqlitefunctions.so
> extension-functions.c
> (I copied sqlite3ext.h before to "c:\Programme\SQLite")
>
> and got the following error message:
>
> extension-functions.c:1: warning: -fPIC ignored for target (all code is 
> position
> independent)
>
> Where's my mistake?
>

As someone else said, that's a warning, not an error.  Just ignore it,
or remove the -fPIC if it bothers you.

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


Re: [sqlite] "extension-functions.c" in windows mobile

2009-04-11 Thread Liam Healy
On Fri, Apr 10, 2009 at 3:40 AM, Jay A. Kreibich  wrote:
> On Thu, Apr 09, 2009 at 04:34:53PM +0200, Thibaut Gheysen scratched on the 
> wall:
>
>> I have found the "extension-functions.c" in the
>> contrib page of the SQLite website but I'm not able to build it for windows
>> ce. Anybody can help me ?
>
>  What specific problems are you having?  I was able to compile this
>  file into a DLL and load it into sqlite3 without problems under
>  MinGW/MSYS for XP.
>
>   -j
>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >

Jay,

Would you mind posting the steps you used?  I will add them to the
instructions at the top of the file.  This question gets asked before,
and I'm not a Windows user, so I don't know what to say.  For those
that know how to compile it would be helpful to have the specific
commands needed, as I have done for Linux and OSX.

Thank you.

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


Re: [sqlite] SQL POSITION function?

2008-09-02 Thread Liam Healy
I think charindex in extension functions might do what you want; see
extension-functions.c in http://sqlite.org/contrib.

Liam

On Tue, Sep 2, 2008 at 6:20 PM, Jim Dodgen <[EMAIL PROTECTED]> wrote:
> Any plans on adding a string matching function like the SQL99
> (E021-11) "POSITION"
>
> --
> Jim Dodgen
> [EMAIL PROTECTED]
> ___
> 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] Math Functions

2008-06-13 Thread Liam Healy
This all makes eminently good sense; thank you for the explanation.
I have updated the comments
at the head of the file and uploaded a new version, which is now at
http://www.sqlite.org/contrib/download/extension-functions.c?get=25.
Nothing in the code has changed, so there's no reason to download
the new version if you already have the old file.

Liam

On Fri, Jun 13, 2008 at 10:31 AM, Jay A. Kreibich <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 13, 2008 at 09:43:51AM -0400, Liam Healy scratched on the wall:
>
>> Interesting; I tried it on Debian sid (unstable) and it worked as
>> well.  I guess the statement in
>> http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions that the
>> extensions loading mechanism being turned off by default doesn't apply
>> to Debian.
>
>  It isn't a compile-time flag (unless you omit the whole thing), it is
>  something you turn on and off in code-- and the default start-up
>  state FOR THE LIBRARY is off.
>
>  More recent versions of the "sqlite3" command-line tool are nice
>  enough to enable to feature every time they open a database, however.
>  So the default behavior for the sqlite3 interface is for the feature
>  to be enabled.
>
>
>  If you understand the security concerns behind having the loading system
>  off by default and the specific threat it is trying to protect against,
>  this all makes sense: basically if you're in a position to turn the
>  feature on via code, you're already in a position to do whatever you
>  could do with the extension system.
>
>  On the other hand, if you can get at the raw database file (with
>  sqlite3 or any other tool you've custom compiled) you can pretty much
>  do anything you want, so there isn't a huge need to protect against that.
>
>> I've revised the instructions to include -lm for Linux and
>> to indicate the possibility that the program as compiled by some
>> distributions will work.  Does anyone know if -lm is need on Mac OS X
>> as well?
>
>  No, it is not.  In both 10.4 and 10.5 (and perhaps earlier) the math
>  lib is associated with the core libSystem run-time lib, so the math
>  library (and all symbols) are always available.
>
>   -j
>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "'People who live in bamboo houses should not throw pandas.' Jesus said that."
>   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Math Functions

2008-06-13 Thread Liam Healy
On Fri, Jun 13, 2008 at 4:31 AM, Alexey Pechnikov <[EMAIL PROTECTED]> wrote:
>>   The extension-functions file doesn't actually implement any of the
>>   math functinos, it simply acts as a glue layer between SQLite and the
>>   system math library.  In this case, it looks like the run-time linker
>>   that loads the extension can't resolve the call for log() from the
>>   extension into the math library, resulting in an unresolved link.
>>
>>   On many systems the math library is part of the standard set of libs
>>   that are imported by the linker for all applications.  There are a
>>   few systems, however, where the math library is not part of the
>>   standard lib set.  On those systems, you need to explicitly tell the
>>   linker you want the math library made avaliable.  You can do that
>>   by compiling the lib with -lm to import the math library.  The math
>>   lib won't be pulled into the .so, but it will be noted that if the
>>   run-time linker pulls in the extension, it will also need to pull in
>>   the math library before it attepts to resolve all the symbols.
>>
>>   At least, in theory.
>
> Thanks for coherent explanation. I am compiling library with switch -lm and
> now it's work.
>
> $ gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
> $ sqlite3 :memory:
> sqlite> SELECT load_extension('./libsqlitefunctions.so');
>
> sqlite> select sqrt(16);
> 4.0
> sqlite>
>
>>
>>   What OS are you trying this on?
>
> Linux Debian Etch (sqlite pakage backported from Debian Lenny).
>

Interesting; I tried it on Debian sid (unstable) and it worked as
well.  I guess the statement in
http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions that the
extensions loading mechanism being turned off by default doesn't apply
to Debian.  I've revised the instructions to include -lm for Linux and
to indicate the possibility that the program as compiled by some
distributions will work.  Does anyone know if -lm is need on Mac OS X
as well?

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


Re: [sqlite] Math Functions

2008-06-12 Thread Liam Healy
In the file you have downloaded, there is the following statement:

Note: You cannot use these functions from the sqlite3 program, you
must write your own program using the sqlite3 API, and call
sqlite3_enable_load_extension.  See "Security Considerations" in
http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.

When I try your load from the command line, I get a similar
(but not the same) error.
 sqlite> SELECT load_extension('./libsqlitefunctions.so');
 SQL error: ./libsqlitefunctions.so: undefined symbol: sqrt
and I certainly have a sqrt function and use these extensions
without problems.  So I guess it's a symptom of the security feature
in sqlite that prohibits loading extensions.

On the chance that log is not defined for your environment.
I recommend you change the line
#define HAVE_LOG10 1
to
#define HAVE_LOG10 0
and try again.

Liam

On Thu, Jun 12, 2008 at 8:26 AM, Alexey Pechnikov <[EMAIL PROTECTED]> wrote:
> В сообщении от Friday 06 June 2008 03:51:38 P Kishor написал(а):
>> http://sqlite.org/contrib/download/extension-functions.c?get=22
>
> $ wget http://sqlite.org/contrib/download/extension-functions.c?get=22
> $ mv extension-functions.c?get=22 extension-functions.c
> $ gcc -fPIC -shared extension-functions.c -o libsqlitefunctions.so
> $ sqlite3 :memory:
> SQLite version 3.5.9
> Enter ".help" for instructions
> sqlite> SELECT load_extension('./libsqlitefunctions.so');
> SQL error: ./libsqlitefunctions.so: undefined symbol: log
>
> What can I do?
> ___
> 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] BCD representation of floats

2008-03-29 Thread Liam Healy
John,

I'm not sure what you mean.  What do 64-bit SQLite integers do for me?
Oracle 8 uses the BCD, and I'm trying to temporarily match that.
I'm not looking for sufficient precision, I'm looking for the exact same
64 bit floating point number as from Oracle.

Liam

On Wed, Mar 26, 2008 at 9:25 PM, John Stanton <[EMAIL PROTECTED]> wrote:
> We actually added this type of capability to Sqlite (actually fixed
>  point display format numbers), but it may be unnecessary in your case.
>  Instead of representing integers as BCD how about using the 64 bit
>  Sqlite integers?  You may have sufficient precision.  The COBOL-style
>  COMP3 integers are pretty much obsolete these days.
>
>
>
>  Liam Healy wrote:
>  > I am porting a numerical application from Oracle to SQLite.  For the
>  > most part, I have been successful, but there are slight disagreements
>  > in the floating point number results.  I have traced this back and
>  > found a problem.  According to
>  > http://articles.techrepublic.com.com/5100-22_11-5224536.html, Oracle
>  > by default stores floats as binary-coded decimal (BCD), and not
>  > IEEE754 binary.  SQLite on the other hand does
>  > http://www.sqlite.org/datatype3.html: "REAL. The value is a floating
>  > point value, stored as an 8-byte IEEE floating point number."  For the
>  > results of the application, it makes no difference how the numbers are
>  > stored -- the differences in the 15th significant figure are
>  > irrelevant.  However, I would like to insure that there no
>  > disagreements in the way the two applications operate (other than the
>  > storage of floating point numbers), and for that I temporarily need
>  > exact agreement on input numbers.  I cannot change the Oracle
>  > application, so I'm wondering if there's a wrapper or something I can
>  > put around sqlite calls (or better, a mode that I can put sqlite in)
>  > that will reproduce exactly the BCD format of Oracle.
>  >
>  > Thanks for any guidance.
>  >
>  > Liam
>
>
> > ___
>  > 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] BCD representation of floats

2008-03-29 Thread Liam Healy
Ken,

Thanks for your detailed response.   I thought of your remedies, but I
perhaps didn't explain myself well enough.
The Oracle we are using is Oracle 8, yes, ancient I know, but a fact
of life.  It has no binary_double type; that was introduced for Oracle
10 evidently.  Second, I know there is a deviation, and I even know
what it is in some cases, so a deviation check won't help me much.
Following the extraction from the database, there is a sequence of
complex numerical calculations.  The end result is a fairly
substantial discrepancy in the numerical result.   Since we ported
this entire piece of software, not just changing the database but
other things as well, we'd like to know if it's all attributable to
the database, or if there is some other source of the disagreement.
It's not likely that a disagreement in the 14th significant figure
from Oracle/sqlite could propagate to the 6th significant figure, but
having dealt with numerics, you know this is possible.

Therefore my dilemma is this: are the observed differences in output
due solely to the difference from the databases, or is there something
else going on?  The most straightforward way to ascertain this is to
make sure the numbers coming out of the database are identical.  I've
done this in a limited way.  With some painstaking digging into gdb
and dbx, I found out how to read and set the integer (hex)
representations of the doubles.   Where I saw some important numbers
differing slightly coming out of sqlite, I manually set them to what
the Oracle result was, and let the computation proceed.  At the end,
the results were essentially the same as the unmodified sqlite
application, so I know now that that discrepancy was insignificant.
However, there are other numbers coming from other tables that haven't
been checked in the same way.  I was seeking one blanket way of
temporarily having all the numbers extracted emulate the exact form of
the Oracle numbers.  It's not that this is the only way to proceed,
but if such a method exists, it would make things much faster.

Liam


On Wed, Mar 26, 2008 at 1:02 PM, Ken <[EMAIL PROTECTED]> wrote:
> Liam,
>
>  I know a great deal about oracle internals, Oracle stores "numbers" as you 
> indicate in a bcd format. But It can be up to 22 bytes long. But usage in 
> oracle proc/proc++/sql/plsql is really dependent upon your native conversion 
> to host datatype.
>
>  The number storage formats betweend Sqlite and Oracle are totally different. 
> I don't think there is much your going to be able to do since the storage is 
> different, most likely the precision is also going to be different and hence 
> the outputs.
>
>  Maybe you could implement a deviation check in your sqlite code. If the 
> number produced fromsqlite matches oracle within a range +/- some number. 
> Then it is considered equal.
>
>  Also as your article implies you could modify the oracle data type to be a 
> binary_float or binary_double which would store the value in a "native" ieee 
> format instead of the NUMBER (which is more accurate).
>
>  Another thought: Role your own NUMBER data type !!! Create a function inside 
> sqlite that would basically implement an oracle Number representation. This 
> should then produce exact match to oracle (in theory). You could use a text 
> field or blob field to store the number datatype. Then apply your conversion 
> function to it!
>
>  HTH,
>  Ken
>
>
>
>  Liam Healy <[EMAIL PROTECTED]> wrote: I am porting a numerical application 
> from Oracle to SQLite.  For the
>
>
> most part, I have been successful, but there are slight disagreements
>  in the floating point number results.  I have traced this back and
>  found a problem.  According to
>  http://articles.techrepublic.com.com/5100-22_11-5224536.html, Oracle
>  by default stores floats as binary-coded decimal (BCD), and not
>  IEEE754 binary.  SQLite on the other hand does
>  http://www.sqlite.org/datatype3.html: "REAL. The value is a floating
>  point value, stored as an 8-byte IEEE floating point number."  For the
>  results of the application, it makes no difference how the numbers are
>  stored -- the differences in the 15th significant figure are
>  irrelevant.  However, I would like to insure that there no
>  disagreements in the way the two applications operate (other than the
>  storage of floating point numbers), and for that I temporarily need
>  exact agreement on input numbers.  I cannot change the Oracle
>  application, so I'm wondering if there's a wrapper or something I can
>  put around sqlite calls (or better, a mode that I can put sqlite in)
>  that will reproduce exactly the BCD format of Oracle.
>
>  Thanks for any guidance.
>
>  Liam
>  ___
>  sqlite-users mail

[sqlite] BCD representation of floats

2008-03-26 Thread Liam Healy
I am porting a numerical application from Oracle to SQLite.  For the
most part, I have been successful, but there are slight disagreements
in the floating point number results.  I have traced this back and
found a problem.  According to
http://articles.techrepublic.com.com/5100-22_11-5224536.html, Oracle
by default stores floats as binary-coded decimal (BCD), and not
IEEE754 binary.  SQLite on the other hand does
http://www.sqlite.org/datatype3.html: "REAL. The value is a floating
point value, stored as an 8-byte IEEE floating point number."  For the
results of the application, it makes no difference how the numbers are
stored -- the differences in the 15th significant figure are
irrelevant.  However, I would like to insure that there no
disagreements in the way the two applications operate (other than the
storage of floating point numbers), and for that I temporarily need
exact agreement on input numbers.  I cannot change the Oracle
application, so I'm wondering if there's a wrapper or something I can
put around sqlite calls (or better, a mode that I can put sqlite in)
that will reproduce exactly the BCD format of Oracle.

Thanks for any guidance.

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


[sqlite] Contrib on home page

2008-01-12 Thread Liam Healy
With the reorganization of the sqlite.org home page, it seems that
"contrib" has been lost.  The page still exists; sqlite.org/contrib
comes up fine, but I can't find a link to it from the home page.  Can
this be restored somewhere either on the home page in something linked
from there?  Thank you.

Liam

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Suggests for improving the SQLite website

2007-11-08 Thread Liam Healy
I think the documentation section needs to be organized.  I count over
two dozen links in a simple list with no apparent organization.  Some
(like "copyright") might be best under some other heading, like
downloading.  Some are minor topics, or of transient interest, such as
moving from 3.4 to 3.5.  Some, like v2 docs, are obsolete but still
needed somewhere.  The "5 minutes or less" probably deserves to be a
big button on the front page --- that's the programmer's equivalent of
eye candy.  Overall, I find that the most important docs (the v3 API
and API reference) are buried.

I suppose the best way to approach organizing this is to look at what
other free software sites do.  Just to pick the first on your list,
http://www.postgresql.org/docs/ looks like a reasonable way to go.
Each version has its own heading.  Manuals are separated from What's
New, FAQs,  etc., user documentation (API) separated from internals,
etc.  Maybe that's a good template for organization.

Liam



Liam

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Having issues Loading an external (extension-functions.c)

2007-09-29 Thread Liam Healy
Makes sense.  I've applied the patch and posted the new version.

Liam

On 9/28/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > Can you explain why you would want it to not compile as a
> > loadable module? (i.e. under what circumstances you would not define
> > COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE).
>
> When you don't want the overhead/hassle of using shared libraries
> and you just want the external functions every time.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Having issues Loading an external (extension-functions.c)

2007-09-28 Thread Liam Healy
Can you explain why you would want it to not compile as a
loadable module? (i.e. under what circumstances you would not define
COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE).

On 9/28/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > Thanks.  I have included your changes in extension-functions.c so now
> > sqlite3_load_extension is usable.  I had been using
> > sqlite3RegisterExtraFunctions which is not the official interface, and
> > that is why I never encountered this problem.  Also, I have improved
> > the Mac OSX instructions for those that use Macs.
> >
> > The new version has been uploaded to sqlite.org/contrib.
>
> The following patch allows extension-functions.c to be compiled as
> either as a standalone shared library extension module, or statically
> (against the sqlite3.h/sqlite3.c amalgamation) depending on whether
> COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE is #defined.
>
> I tested it against
>
>  http://www.sqlite.org/contrib/download/extension-functions.c?get=22
>
> from 2007-09-28 16:25:46 and it seems to work.
>
>
> --- extension-functions.c-orig  2007-09-28 12:52:13.0 -0400
> +++ extension-functions.c   2007-09-28 12:52:13.0 -0400
> @@ -87,8 +87,12 @@
>
>  //#if SQLITE_WITH_EXTRA_FUNCTIONS
>
> +#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
>  #include "sqlite3ext.h"
>  SQLITE_EXTENSION_INIT1
> +#else
> +#include "sqlite3.h"
> +#endif
>
>  #include 
>  /* relicoder */
> @@ -1618,8 +1622,7 @@
>  ** functions.  This should be the only routine in this file with
>  ** external linkage.
>  */
> -int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const 
> sqlite3_api_routines *pApi){
> -  SQLITE_EXTENSION_INIT2(pApi);
> +int RegisterExtensionFunctions(sqlite3 *db){
>static const struct FuncDef {
>   char *zName;
>   signed char nArg;
> @@ -1748,6 +1751,15 @@
>return 0;
>  }
>
> +#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
> +int sqlite3_extension_init(
> +sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
> +  SQLITE_EXTENSION_INIT2(pApi);
> +  RegisterExtensionFunctions(db);
> +  return 0;
> +}
> +#endif /* COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */
> +
>  //#endif
>
>  map map_make(cmp_func cmp){
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Having issues Loading an external (extension-functions.c)

2007-09-28 Thread Liam Healy
Thanks.  I have included your changes in extension-functions.c so now
sqlite3_load_extension is usable.  I had been using
sqlite3RegisterExtraFunctions which is not the official interface, and
that is why I never encountered this problem.  Also, I have improved
the Mac OSX instructions for those that use Macs.

The new version has been uploaded to sqlite.org/contrib.

Liam

On 9/25/07, eric higashino <[EMAIL PROTECTED]> wrote:
> Here is the file again it was too big
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite3_open_v2 and SQLITE_OPEN_READONLY

2007-09-20 Thread Liam Healy
No, I meant like in http://sqlite.org/capi3ref.html#sqlite3_open,
adding a small logo  or box "new in 3.5.0" adjacent to the description
of _v2.  Then it is clear what version(s) support the feature.

On 9/20/07, Kees Nuyt <[EMAIL PROTECTED]> wrote:
>
> On Thu, 20 Sep 2007 13:57:58 -0400, Liam wrote:
>
> > It would be nice if the documentation gave a
> > brief indication when a feature is added
> > ("new in 3.5.0" unobtrusively somewhere).
>
> Like in http://www.sqlite.org/34to35.html ?
> --
>   (  Kees Nuyt
>   )
> c[_]
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite3_open_v2 and SQLITE_OPEN_READONLY

2007-09-20 Thread Liam Healy
OK thanks, I'll upgrade when it hits Debian unstable which I expect
will be fairly soon.  It would be nice if the documentation gave a
brief indication when a feature is added ("new in 3.5.0" unobtrusively
somewhere).

Liam

On 9/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> "Liam Healy" <[EMAIL PROTECTED]> wrote:
> > I tried to use sqlite3_open_v2 and SQLITE_OPEN_READONLY as described in
> > http://sqlite.org/capi3ref.html#sqlite3_open, but the symbol
> > SQLITE_OPEN_READONLY is unknown, even though I have included
> > sqlite3.h.  I am using version 3.4.2.  Was this symbol not added until
> > a later version, or am I supposed to use the definition given on the
> > web page?
> >
>
> Sqlite3_open_v2() and SQLITE_OPEN_READONLY and a whole bunch
> of other stuff is all new to 3.5.0.  Version 3.5.0 is stable.
> It has lots of cool stuff.  Older versions are not supported
> (except for paying customers) - by which we mean that if any
> bugs are discovered they will be fixed in 3.5.0 only, not
> in branches.  You (and a lot of other people) really need
> to upgrade.
> --
> D. Richard Hipp <[EMAIL PROTECTED]>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] sqlite3_open_v2 and SQLITE_OPEN_READONLY

2007-09-20 Thread Liam Healy
I tried to use sqlite3_open_v2 and SQLITE_OPEN_READONLY as described in
http://sqlite.org/capi3ref.html#sqlite3_open, but the symbol
SQLITE_OPEN_READONLY is unknown, even though I have included
sqlite3.h.  I am using version 3.4.2.  Was this symbol not added until
a later version, or am I supposed to use the definition given on the
web page?

Thanks

Liam

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-17 Thread Liam Healy
Thank you Nuno and Joe for your help.  I have posted a new version, now
called extension-functions.c, which works on external interfaces only and
therefore does not require the sqlite3 source code.  I have made everything
a single C file with instructions as a comment at the top, hence no need for
a tarball.  I made some revisions so that it will compile without warnings
under Mac OS X, which is fussier about unsigned vs. signed chars.

Liam

On 9/15/07, Nuno Lucas <[EMAIL PROTECTED]> wrote:
>
> On 9/14/07, Liam Healy <[EMAIL PROTECTED]> wrote:
> > I tried eliminating sqliteInt.h and replacing with explicit declarations
> > of i64 and u8.   That part worked fine, but func_ext.c also uses
> > sqliteMalloc
>
> void *sqlite3_malloc(int);
> void *sqlite3_realloc(void*, int);
> void sqlite3_free(void*);
>
> are the right functions to use (they are in sqlite3.h).
>
> > which is also defined in sqliteInt.h which led me down a rabbit hole of
> > pulling
> > more and more from sqliteInt.h, and I still can't eliminate the errors
> and
> > warnings.  As a reminder, I didn't write the original source code, and I
> > have
> > only the vaguest sense of the meaning and need for these functions.  So,
> if
> > anyone has any insight on how to accomplish the same goal without using
> > internal definitions, I'd appreciate hearing about it.
>
> I attached a patch with the required changes just to compile using
> only .
> Used the current source code of the extensions on the contrib page.
>
> This is not enough to create a sqlite module, but at least it compiles
> without using the private sqlite headers.
>
>
> Regards,
> ~Nuno Lucas
>
> >
> > Liam
>
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-14 Thread Liam Healy
I tried eliminating sqliteInt.h and replacing with explicit declarations
of i64 and u8.   That part worked fine, but func_ext.c also uses
sqliteMalloc
which is also defined in sqliteInt.h which led me down a rabbit hole of
pulling
more and more from sqliteInt.h, and I still can't eliminate the errors and
warnings.  As a reminder, I didn't write the original source code, and I
have
only the vaguest sense of the meaning and need for these functions.  So, if
anyone has any insight on how to accomplish the same goal without using
internal definitions, I'd appreciate hearing about it.

Liam

On 9/11/07, Nuno Lucas <[EMAIL PROTECTED]> wrote:
>
> On 9/10/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> > --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > > Thanks for the tip Joe.  With sqlite3.h included, I can eliminate os.hand
> > > vdbeInt.h, but not sqliteInt.h.  Apparently sqliteInt.h is not
> included by
> > > sqlite3.h, and there are typedefs there that are needed.
> >
> > It would be nice if people could use the extension functions with
> > the amalgamation, consisting of just sqlite3.h and sqlite3.c.
> > If you use sqliteInt.h, they can't do that.
> >
> > Why not just repeat the typdefs for u8, etc, in your module?
>
> Don't know current compiler standard compliance, but maybe including
> the "new"  header file and using uint8_t, uint16_t, etc.
> could be better yet (instead of every library having it's own typedef
> section for basic types).
>
>
> Regards,
> ~Nuno Lucas
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] Compiling/installing extension-functions on Mac OS X

2007-09-12 Thread Liam Healy
I'm not an OSX expert but I do know the flags need to be different for gcc
 gcc -Isqlite -Isqlite/src -dynamiclib func_ext.c map.c -o
libsqlitefunctions.so
might work better.

Liam

On 9/12/07, Jared Haworth <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Has anyone successfully compiled and installed Liam's extension-
> functions (for math-based operations) in Mac OS?  I'm using Tiger
> (10.4.10) and I can't seem to get it to work properly.  I'm thrown a
> variety of errors relating to creating a shared library.
>
> Any tips are appreciated!
>
> Thanks,
>
> - Jared
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-10 Thread Liam Healy
Thanks for the tip Joe.  With sqlite3.h included, I can eliminate os.h and
vdbeInt.h, but not sqliteInt.h.  Apparently sqliteInt.h is not included by
sqlite3.h, and there are typedefs there that are needed.

Liam

On 9/5/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> Hi Liam,
>
> In func_ext.c and map.h you're including private sqlite3 header
> files: sqliteInt.h, os.h and vdbeInt.h, which change from release
> to release.
>
> If you only use the public sqlite3.h header file instead, it has
> a greater chance of being compatible with new releases.
>
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > OK I have posted a new version of extension-functions.tgz on
> > sqlite.org/contrib.  This version includes definitions for READ_UTF8,
> > sqlite3ReadUtf8, SKIP_UTF8, sqlite3utf8CharLen, xtra_utf8_bytes,
> > xtra_utf8_bits, utf_mask taken from the 3.3.13 source code, so it should
> > continue to work in sqlite 3.4.
> 
>
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-05 Thread Liam Healy
OK I have posted a new version of extension-functions.tgz on
sqlite.org/contrib.  This version includes definitions for READ_UTF8,
sqlite3ReadUtf8, SKIP_UTF8, sqlite3utf8CharLen, xtra_utf8_bytes,
xtra_utf8_bits, utf_mask taken from the 3.3.13 source code, so it should
continue to work in sqlite 3.4.

Liam

On 9/1/07, Liam Healy <[EMAIL PROTECTED]> wrote:
>
> Good point.  I guess my intent is this: I'd like to use the external
> API completely if possible.  If not, I'm not sure whether to include
> source
> or use the current library (I can see advantages to each).  I guess there
> aren't external API calls that do the needed tasks, so I'll have to figure
> out what to do.
>
> Liam
>
>
> On 9/1/07, Joe Wilson < [EMAIL PROTECTED]> wrote:
> >
> > --- Liam Healy < [EMAIL PROTECTED]> wrote:
> > > Thanks.  I have  changed the use of sqlite3CreateFunc to
> > > sqlite3_create_function.  I did not need to include the source code
> > for
> > > sqlite3utf8CharLen because there's a sqlite3Utf8CharLen (note
> > different
> > > capitalization) in the library.  However, the definition
> >
> > How you intend to integrate your new SQL extension functions into
> > sqlite?
> > As a loadable module or as an sqlite3 source code patch?
> >
> > You can't use sqlite3 internal functions such as sqlite3Utf8CharLen
> > if you're making an external loadable module, which is why it was
> > suggested
> > to copy the function into your code statically. You can only use the
> > published sqlite3 external API in this case. But your library will
> > survive
> > without modifications over new sqlite3 releases.
> >
> > If you're not making an external loable module and are making an sqlite3
> > source patch, just use the script provided earlier in this thread to
> > change
> > the old extension sources to be compatible with the 3.4.x sqlite3.c
> > amalgamation. Mind you, if you're doing the patch approach you may have
> > to
> > keep updating it with every new sqlite release.
> >
> > > of sqlite3ReadUtf8 and needed definitions READ_UTF8, xtra_utf8_bytes,
> > > xtra_utf8_bits, utf_mask are not in 3.4.2, so I needed to
> > > salvage from 3.3.13 source.  This compiles and loads OK, but I'm
> > wondering
> > > if there is a 3.4 way of doing what sqlite3ReadUtf8 did
> > > so that I don't have to carry the definitions.   If anyone has a
> > suggestion
> > > I'd appreciate hearing about it.
> > >
> > > Liam
> > >
> > >
> > > On 8/31/07, Joe Wilson < [EMAIL PROTECTED]> wrote:
> > > >
> > > > --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > > > > I was the one who packaged up extension-functions.tgz and posted
> > on
> > > > > contrib.  I didn't author the original code but I'd like to fix
> > this up.
> > > > > I'm not clear on what needs to be changed.  I gather that
> > > > sqlite3utf8CharLen
> > > > > and sqlite3CreateFunc shouldn't be used.  I'm not sure how to
> > convert to
> > > > use
> > > > > the external API.  Anyone have a pointer?
> > > >
> > > > See:
> > > >
> > > >   http://www.sqlite.org/capi3ref.html#sqlite3_create_function
> > > >
> > > >   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions
> > > >
> > > > And include this statically in your code, if you require it:
> > > >
> > > > #define SQLITE_SKIP_UTF8(zIn) {\
> > > >   if( (*(zIn++))>=0xc0 ){  \
> > > > while( (*zIn & 0xc0)==0x80 ){ zIn++; } \
> > > >   }\
> > > > }
> > > >
> > > > int sqlite3Utf8CharLen(const char *zIn, int nByte){
> > > >   int r = 0;
> > > >   const u8 *z = (const u8*)zIn;
> > > >   const u8 *zTerm;
> > > >   if( nByte>=0 ){
> > > > zTerm = [nByte];
> > > >   }else{
> > > > zTerm = (const u8*)(-1);
> > > >   }
> > > >   assert( z<=zTerm );
> > > >   while( *z!=0 && z > > > SQLITE_SKIP_UTF8(z);
> > > > r++;
> > > >   }
> > > >   return r;
> > > > }
>
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-01 Thread Liam Healy
Good point.  I guess my intent is this: I'd like to use the external
API completely if possible.  If not, I'm not sure whether to include source
or use the current library (I can see advantages to each).  I guess there
aren't external API calls that do the needed tasks, so I'll have to figure
out what to do.

Liam


On 9/1/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > Thanks.  I have  changed the use of sqlite3CreateFunc to
> > sqlite3_create_function.  I did not need to include the source code for
> > sqlite3utf8CharLen because there's a sqlite3Utf8CharLen (note different
> > capitalization) in the library.  However, the definition
>
> How you intend to integrate your new SQL extension functions into sqlite?
> As a loadable module or as an sqlite3 source code patch?
>
> You can't use sqlite3 internal functions such as sqlite3Utf8CharLen
> if you're making an external loadable module, which is why it was
> suggested
> to copy the function into your code statically. You can only use the
> published sqlite3 external API in this case. But your library will survive
> without modifications over new sqlite3 releases.
>
> If you're not making an external loable module and are making an sqlite3
> source patch, just use the script provided earlier in this thread to
> change
> the old extension sources to be compatible with the 3.4.x sqlite3.c
> amalgamation. Mind you, if you're doing the patch approach you may have to
> keep updating it with every new sqlite release.
>
> > of sqlite3ReadUtf8 and needed definitions READ_UTF8, xtra_utf8_bytes,
> > xtra_utf8_bits, utf_mask are not in 3.4.2, so I needed to
> > salvage from 3.3.13 source.  This compiles and loads OK, but I'm
> wondering
> > if there is a 3.4 way of doing what sqlite3ReadUtf8 did
> > so that I don't have to carry the definitions.   If anyone has a
> suggestion
> > I'd appreciate hearing about it.
> >
> > Liam
> >
> >
> > On 8/31/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> > >
> > > --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > > > I was the one who packaged up extension-functions.tgz and posted on
> > > > contrib.  I didn't author the original code but I'd like to fix this
> up.
> > > > I'm not clear on what needs to be changed.  I gather that
> > > sqlite3utf8CharLen
> > > > and sqlite3CreateFunc shouldn't be used.  I'm not sure how to
> convert to
> > > use
> > > > the external API.  Anyone have a pointer?
> > >
> > > See:
> > >
> > >   http://www.sqlite.org/capi3ref.html#sqlite3_create_function
> > >
> > >   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions
> > >
> > > And include this statically in your code, if you require it:
> > >
> > > #define SQLITE_SKIP_UTF8(zIn) {\
> > >   if( (*(zIn++))>=0xc0 ){  \
> > > while( (*zIn & 0xc0)==0x80 ){ zIn++; } \
> > >   }\
> > > }
> > >
> > > int sqlite3Utf8CharLen(const char *zIn, int nByte){
> > >   int r = 0;
> > >   const u8 *z = (const u8*)zIn;
> > >   const u8 *zTerm;
> > >   if( nByte>=0 ){
> > > zTerm = [nByte];
> > >   }else{
> > > zTerm = (const u8*)(-1);
> > >   }
> > >   assert( z<=zTerm );
> > >   while( *z!=0 && z > > SQLITE_SKIP_UTF8(z);
> > > r++;
> > >   }
> > >   return r;
> > > }
>
>
>
>
>
> 
> Yahoo! oneSearch: Finally, mobile search
> that gives answers, not web links.
> http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-08-31 Thread Liam Healy
Thanks.  I have  changed the use of sqlite3CreateFunc to
sqlite3_create_function.  I did not need to include the source code for
sqlite3utf8CharLen because there's a sqlite3Utf8CharLen (note different
capitalization) in the library.  However, the definition
of sqlite3ReadUtf8 and needed definitions READ_UTF8, xtra_utf8_bytes,
xtra_utf8_bits, utf_mask are not in 3.4.2, so I needed to
salvage from 3.3.13 source.  This compiles and loads OK, but I'm wondering
if there is a 3.4 way of doing what sqlite3ReadUtf8 did
so that I don't have to carry the definitions.   If anyone has a suggestion
I'd appreciate hearing about it.

Liam


On 8/31/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > I was the one who packaged up extension-functions.tgz and posted on
> > contrib.  I didn't author the original code but I'd like to fix this up.
> > I'm not clear on what needs to be changed.  I gather that
> sqlite3utf8CharLen
> > and sqlite3CreateFunc shouldn't be used.  I'm not sure how to convert to
> use
> > the external API.  Anyone have a pointer?
>
> See:
>
>   http://www.sqlite.org/capi3ref.html#sqlite3_create_function
>
>   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions
>
> And include this statically in your code, if you require it:
>
> #define SQLITE_SKIP_UTF8(zIn) {\
>   if( (*(zIn++))>=0xc0 ){  \
> while( (*zIn & 0xc0)==0x80 ){ zIn++; } \
>   }\
> }
>
> int sqlite3Utf8CharLen(const char *zIn, int nByte){
>   int r = 0;
>   const u8 *z = (const u8*)zIn;
>   const u8 *zTerm;
>   if( nByte>=0 ){
> zTerm = [nByte];
>   }else{
> zTerm = (const u8*)(-1);
>   }
>   assert( z<=zTerm );
>   while( *z!=0 && z SQLITE_SKIP_UTF8(z);
> r++;
>   }
>   return r;
> }
>
>


Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-08-31 Thread Liam Healy
I was the one who packaged up extension-functions.tgz and posted on
contrib.  I didn't author the original code but I'd like to fix this up.
I'm not clear on what needs to be changed.  I gather that sqlite3utf8CharLen
and sqlite3CreateFunc shouldn't be used.  I'm not sure how to convert to use
the external API.  Anyone have a pointer?

Thanks.
Liam


On 8/2/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> --- Paul Harris <[EMAIL PROTECTED]> wrote:
> > I wanted to get a LOG10() function in sqlite3, and I found the
> > extension-functions.tgz file in http://sqlite.org/contrib
> >
> > I am using the all-in-one sqlite3.h/c version of sqlite3, and the
> > extension-functions files don't seem to fit at all.
> >
> > For example, it wants to call a function called sqlite3CreateFunc(),
> > which seems to have been renamed to sqlite3_create_function()
> >
> > Should I even bother trying to hack these files into shape, or has
> > sqlite3 changed so much that these files will only serve to introduce
> > bugs?
>
> The extension is somewhat out of date, but still usable.
>
> sqlite3CreateFunc is an internal sqlite function to register
> the extension functions, making it incompatible with a seperately
> compiled sqlite3.c. sqlite3utf8CharLen is another internal
> function used by the extension.
>
> You could convert all the registration functions to use the external
> API, or drop this file into sqlite/src and update the standard makefile.
>
> If you want to live on the edge, put map.h, map.c, func_ext.c,
> sqlite3.c and sqlite3.h in the same directory and run this:
>
> sed 's/sqlite3RegisterBuiltinFunctions(db);/& {extern void
> sqlite3RegisterExtraFunctions(sqlite3
> *db); sqlite3RegisterExtraFunctions(db);};/' sqlite3.c > sqlite3f.c
> echo "" >> sqlite3f.c
> echo "#include " >> sqlite3f.c
> echo "" >> sqlite3f.c
> sed 's/#include.*//' map.h map.c func_ext.c | \
>   sed 's/sqlite3utf8CharLen/sqlite3Utf8CharLen/' >> sqlite3f.c
>
> Then use sqlite3f.c instead of sqlite3.c to build your program.
>
> If you're on Windows, download and install Cygwin or MSYS to get these
> UNIX commands to build sqlite3f.c.
>
> # optional: build sqlite3 command-line shell.
> # shell.c must be in current directory.
> gcc sqlite3f.c shell.c -o sqlite3f
>
>
>
>
>
> 
> Pinpoint customers who are looking for what you sell.
> http://searchmarketing.yahoo.com/
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>


Re: [sqlite] How to obtain the integer part of a result

2007-05-06 Thread Liam Healy

See the "floor" function (largest integer value not greater than argument)
in
http://sqlite.org/contrib/download/extension-functions.tgz?get=17

On 5/6/07, A.J.Millan <[EMAIL PROTECTED]> wrote:


Hi all:

I would like to know if there are a way to obtain a result without
decimals
(the integer part) in this query:

SELECT  round(julianday('now')-Dat) FROM SomeTable WHERE ...;

Obviously Dat contain a Julian Date (nnn.nnn) and I want the difference in
days from today.

None the above, neither

SELECT  round(julianday('now')-Dat, 0) FROM SomeTable WHERE ...;

Produces the desired result.  I always get  xxx.0 (1 decimal).

A.J.Millan
ZATOR Systems




-
To unsubscribe, send email to [EMAIL PROTECTED]

-




[sqlite] Import quoted and NULL values with .import

2007-04-26 Thread Liam Healy

I am trying to import (with .import) into SQLite3 some tables that are
currently in an Oracle instance.  To do this I am using an Oracle script (a
nice one I found at
http://www.tek-tips.com/viewthread.cfm?qid=1250849=8) .  This script
produces another script which is then executed.  The result is almost what I
want, but there are a couple of minor issues.  The first is that every value
is surrounded by double quotes.  This is OK except that SQLite keeps the
quotes.  So for instance in the file I might have "5.4", which sqlite
evidently keeps as a string instead of the number 5.4 (the column is
declared numeric).   I can fix that problem by removing the quotes from the
produced script, but I wondered if there was a way for sqlite to interpret a
value depending on the type of the column.  The second issue is null
values.  With the quotes removed, null values come out as nothing beteween
the delimiters, e.g.
2007-06-08,70,70,5,70,70,5
ends with eight null values.  Sqlite interprets each as the empty string "",
which is not the same thing.  I presume if it said NULL it would be right,
but I can't figure out how to make the script output NULL instead of nothing
(and Oracle's NVL doesn't do the right thing for me).  So is there a way to
have SQLite interpet a missing value as NULL?

Thanks,
Liam


Re: [sqlite] Submitting patches?

2007-04-23 Thread Liam Healy

On 4/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:



(drh makes a mental note to improve the formatting of
the contributed code section.  The original table format
seems a bit cluttered...)



As long as you may be making a change, may I request a feature if it's not
too much trouble?  It would nice to be able to revise the description and/or
file without resetting the date and counter (or at least add a new date onto
the old).  I like seeing the cumulative total but I'd like to do some minor
fixes in the description.  If it's too much like turning it into a CMS
though, it's not worth it.

Thanks.

Liam


Re: [sqlite] Fortran 95 Language Bindings

2007-04-23 Thread Liam Healy

Arjen,

Thank you for attentive maintenance and development on this valuable
interface.

On 4/23/07, Arjen Markus <[EMAIL PROTECTED]> wrote:


Liam Healy wrote:

> Arjen,
>
> I've taken another look at these bindings, and at my project.  For a
> variety
> of reasons, most not related to the sqlite3 Fortran bindings, I have
> decided
> to proceed in a different direction.  However, on closer examination
> of the
> Fortran bindings and other language bindings to sqlite3 (C and Common
> Lisp
> via CLSQL), I notice that there is no equivalent of
> sqlite3_get_table.  This
> would make my use of a Fortran interface considerably more
difficult.  At
> first I thought there was no equivalent of sqlite3_exec but on closer
> examination it appears that sqlite3_do performs that role.
>
Liam,

I added the subroutine sqlite3_get_table to the Fortran bindings. You will
need to use the CVS repository to get it (I have not released a new
version of the flibs stuff yet), but it works as simple as you might
expect -  see csvdata.f90 in the tests/sqlite directory.

Regards,

Arjen


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Fortran 95 Language Bindings

2007-04-18 Thread Liam Healy

Arjen,

I've taken another look at these bindings, and at my project.  For a variety
of reasons, most not related to the sqlite3 Fortran bindings, I have decided
to proceed in a different direction.  However, on closer examination of the
Fortran bindings and other language bindings to sqlite3 (C and Common Lisp
via CLSQL), I notice that there is no equivalent of sqlite3_get_table.  This
would make my use of a Fortran interface considerably more difficult.  At
first I thought there was no equivalent of sqlite3_exec but on closer
examination it appears that sqlite3_do performs that role.

Liam

On 4/17/07, Arjen Markus <[EMAIL PROTECTED]> wrote:


I managed to extend the documentation on the interface last night - see
http://flibs.sf.net -
actually it took me an embarrassingly small amount of time to fill in
the big gap I had left there.
If there is anything unclear about it, let me know and I will try to fix
it. Also, if you see any obvious
omissions from the full SQLite API, let me know.

The best way forward would be a "real" project, rather than any of the
toys I have dabbled with.

Regards,

Arjen


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] trim available ??

2007-04-16 Thread Liam Healy

An option for versions that do not have trim is
http://sqlite.org/contrib//download/extension-functions.tgz?get=17

On 4/16/07, Stef Mientki <[EMAIL PROTECTED]> wrote:



> The TRIM function was added on 2007-03-17 17:52:42.
>
Thanks,
that explains ..
cheers,
Stef
> --
> D. Richard Hipp <[EMAIL PROTECTED]>
>
>
>

Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber of
Commerce - trade register 41055629




-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Fortran 95 Language Bindings

2007-04-16 Thread Liam Healy

Arjen,

The project I was working on was part of a larger effort to port a suite of
software which included Fortran programs that connect to Oracle (using
Pro*Fortran).  Some of it we ported earlier by rewriting the database access
portions in C.  One of the alternatives to sqlite3 bindings for Fortran was
to do this again.  Another was to separate the db access parts out and read
and write files, then use a script to do the db access.  So I had to weigh
the amount of work for each; I made a brief investigation of each approach
to estimate how much work was involved.  Looking at notes I made in October
for the Fortran/sqlite direct connection, it seems I could not extract from
the examples and documentation the way to do what I wanted to accomplish.  I
was able to do some small examples.   At that point I put aside the effort
entirely, coming to no conclusion on how to proceed, because there were
other things to work on with higher priority.   That's really all the detail
that I have.

Since this is now bubbling up again in priority, I can take a fresh look at
how to do this.When questions come up, I will post them.
Thanks for your effort and interest in developing this interface.

Liam

On 4/16/07, Arjen Markus <[EMAIL PROTECTED]> wrote:



Liam,

could you explain in some detail what you find inadequate? I know I
should add more documentation, but
the functions as implemented ought to be useful enough. I have not much
experience with building extensive
database applications, so that may show in the implementation. But I
welcome comments and will revive
the work on this interface.

Regards,

Arjen



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] Fortran 95 Language Bindings

2007-04-15 Thread Liam Healy

I am very interested in this for a project of increasing urgency.  A few
months ago
I found the two links that the other emails mentioned, but found both of
them
inadequate and not well documented.  I think a  complete, documented
F95 API would be very useful.  I am willing to help and critique as time
allows;
I would be using gfortran on linux/amd64 if that makes a difference.

On 4/14/07, Gary Scott <[EMAIL PROTECTED]> wrote:


Hi, this is my first post, so please excuse any etiquette goofs.  I'm
researching incorporation of SQLite into a project.  It would appear
relatively straightforward to develop an F95 language binding, however
it is likely to be compiler specific (extensions required to adapt
calling syntax to C).  Is this a suitable place to ask basic C-oriented
questions relative to the existing API?  Also, it would be my desire to
not only map the existing API exactly (as public), but to also create a
small additional layer atop the existing API with a slightly higher
abstraction level to hide some of the low levelness of the API
(pointers, handle passing, etc.).  Would anybody be interested in
helping or critiquing as I progress?  (I haven't decided to do this yet,
I'm awaiting corporate approval to use public domain software in my
project, which they have refused in the past.  This part of the project
would be on my own time so as to not involve company ownership issues).

--

Gary Scott
mailto:[EMAIL PROTECTED] dot net

Fortran Library:  http://www.fortranlib.com

Support the Original G95 Project:  http://www.g95.org
-OR-
Support the GNU GFortran Project:  http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




[sqlite] Re: sqlite3 extensions; was: Re: Bug#404242: closed by Laszlo Boszormenyi (GCS) <[EMAIL PROTECTED]> (Bug#404242: fixed in sqlite3 3.3.14-1)

2007-04-06 Thread Liam Healy

As far as I know, they've always been experimental, so I'm not sure
what changed between 3.3.8 and 3.3.14.  And yes, I really need it.
I have never compiled sqlite, only used the Debian compiled version, so
I am not sure what needs to be done here.  I am ccing the sqlite mailing
list in hopes that someone can provide this information.

Liam


On 4/6/07, Laszlo Boszormenyi <[EMAIL PROTECTED]> wrote:


Hi Liam!

On Thu, 2007-04-05 at 17:04 -0400, Liam Healy wrote:
> There is now in 3.3.14 a new and more serious problem related to the
> extensions: while the
> header file is present, the functions have disappeared from the .so
> library:
> nm -D  /usr/lib/libsqlite3.so.0.8.6 | grep extension
> now yields nothing.  In 3.3.8, this library had
> 00028e10 T sqlite3_auto_extension
> 00028cb0 T sqlite3_enable_load_extension
> 00028cd0 T sqlite3_load_extension
> 00028dd0 T sqlite3_reset_auto_extension
Well, yes. These are marked experimental and not enabled by default
anymore. There is no configure options for them even. I can hack and
enable it by default; but do you really need a just added and
experimental function set?

Regards,
Laszlo/GCS




Re: [sqlite] Math functions

2007-04-04 Thread Liam Healy

Please see http://sqlite.org/contrib under extension-functions.tgz.

On 4/4/07, Nathan Biggs <[EMAIL PROTECTED]> wrote:


Does anyone know if there is a floor function in sqlite, or of a way to
implement it.



Re: [sqlite] Transferring the oracle databse to sqlite database

2007-03-28 Thread Liam Healy

I made the same transition last year.  Below is a sample script that I used
successfully
to have Oracle generate a file of SQL statements which can be read in to
sqlite with
.read.  Obviously, this needs to be tailored to each table dumped.
If this script is called oracle-dump.sql, then run
sqlplus user/pass @oracle-dump.sql
and you will have a new file fromoracle.sql which can be imported into
sqlite.

-- create a CSV report
   -- Use this to suppress page headers, titles and all formatting
set pagesize 0
   -- Don't list the SQL text before/after any variable substitution
set verify off
-- Set line size, make this as big as you like because the next line
set lines 700
 -- deletes any blank spaces at the end of each spooled line
set trimspool on
 -- Don't display number of lines returned by the query
set feedback off
 -- Don't display any SELECT output to your screen
set termout off
   -- Separate each column by a comma character (CSV output)
   -- this is not useful, because it produces a comma at the beginning and
end
--set colsep ','
-- column emp_date format A8
   -- Make sure the date field is the width you want it
   -- to be otherwise  Oracle will make this column very
   -- wide when output
column satnum format 9
column intldesig format a8
column epochj2000 format 999.999
column mmd format  0.
column mmdd format 0.
column bstar format 999.
column elementno format 9
column inclination format 990.
column raan format 990.
column eccentricity format 0.
column arg_perigee format 990.
column mean_anomaly format 990.
column mean_motion format 90.
column rev_epoch format 99

-- Put the SELECT output into a file
spool fromoracle.sql
select 'insert into nscels values
(',satnum,',''',intldesig,''',''',to_char(catdate,'-MM-DD
hh24:mi:ss'),''',''',
   to_char(epoch,'-MM-DD hh24:mi:ss'),''',', epochj2000,',',
   mmd,',', mmdd,',', bstar,',', elementno,',',
   inclination,',', raan,',', eccentricity,',', arg_perigee,',',
   mean_anomaly,',', mean_motion,',', rev_epoch, ');'
   from nscels
   where catdate between '2005-01-01 00:00:00' and '2005-12-31 23:59:59';
spool off
exit

Best of luck.
Liam



On 3/28/07, Amarjeet Kumar (RBIN/ECM4) <[EMAIL PROTECTED]> wrote:


Hi,

I wanted to use the sqlite database. Currently I am using the oracle
database.

Is there any way to import the oracle database to sqlite database?
If so plz. tell me.

Thanks in advance.

With warm regards,
Amar






Re: [sqlite] Extension functions for SQLite in C for free

2007-03-27 Thread Liam Healy

I want to express my appreciation for this valuable contribution.

I have taken the liberty of simplifying this source code to three files:
func_ext.c, map.c, and map.h.  Otherwise, all that's needed is the SQLite
source code.   Because config.h doesn't seem to be created in the
configuration process anymore, I have included the HAVE_* #defines at the
top of func_ext.c.  I did a little cleanup and a bug fix on this code.  This
was mainly letting errno flag errors encountered in the math library and
checking the result, rather than pre-checking.  This fixes a bug in power
that would cause an error if any non-positive number was raised to any
power.

Please see http://sqlite.org/contrib, under extension-functions.tgz.   A
README is included.

Liam

On 2/7/07, Mikey C <[EMAIL PROTECTED]> wrote:



No problem, attached is the raw source code, no binaries.



Ralf Junker wrote:
>
> Hello Mikey C,
>
>>If anyone is having problems downloading the file (which is large as it
>>contains debug & release binaries and all the obj files), please email
me
at
>>[EMAIL PROTECTED] and I'll email just the raw source code only.
>
> Would it be possible to upload just the raw source code as a separate
> archive?
>
> Ralf
>
>
>
-
> To unsubscribe, send email to [EMAIL PROTECTED]
>
-
>
>
>
http://www.nabble.com/file/6303/SQLite.zip SQLite.zip
--
View this message in context:
http://www.nabble.com/Extension-functions-for-SQLite-in-C-for-free-tf3182921.html#a8854150
Sent from the SQLite mailing list archive at Nabble.com.



-
To unsubscribe, send email to [EMAIL PROTECTED]

-