Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Opening a sqlite db thats inside a starkit or vfs via tclsqlite extension

10 views
Skip to first unread message

Steve Redler IV

unread,
Sep 28, 2004, 10:26:38 AM9/28/04
to
The questions are:
Has anyone done it? Can tclsqlite be easily modified to use tclvfs?

The application is an address book that holds street adresses, names
and phone numbers for easy lookup, but is a self contained starpack.

I realize that there are many advantages to storing the db outside the
application, but another idea I was thinking about would to be able to
open a db file thats located on a remote ftp server.

I also realize the disadvantages, it would be much slower for example.

Steve

Shin The Gin

unread,
Sep 28, 2004, 11:27:25 AM9/28/04
to
Steve Redler IV wrote:

AFAIK you may put the db file into a starkit, mount the starkit and open the
db as usual. You may update that database as long as the starkit is
writeable.

You mentioned "starpack", which cannot be writeable while running under
windows (apart from other OS's). In your case, I'd prefer a "starkit",
containing your software and database and let the runtime module run the
whole thing.

Shin
--
There's one answer to all doubts, certainty!
But I'm not so shure about that ;-)

Michael Schlenker

unread,
Sep 28, 2004, 3:03:34 PM9/28/04
to
Shin The Gin wrote:

> Steve Redler IV wrote:
>
>
>>The questions are:
>>Has anyone done it? Can tclsqlite be easily modified to use tclvfs?
>>
>>The application is an address book that holds street adresses, names
>>and phone numbers for easy lookup, but is a self contained starpack.
>>
>>I realize that there are many advantages to storing the db outside the
>>application, but another idea I was thinking about would to be able to
>>open a db file thats located on a remote ftp server.
>>
>>I also realize the disadvantages, it would be much slower for example.
>>
>>Steve
>
> AFAIK you may put the db file into a starkit, mount the starkit and open the
> db as usual. You may update that database as long as the starkit is
> writeable.

This does only work if the library in question uses the Tcl virtual
filesystem functions to access the db file. I expect sqllite to use the
normal c functions or maybe mmap() which would not work without
modifications to the library.

Michael

Victor Wagner

unread,
Sep 28, 2004, 3:21:27 PM9/28/04
to
Michael Schlenker <sch...@uni-oldenburg.de> wrote:
> Shin The Gin wrote:

>> Steve Redler IV wrote:
>>
>>
>>>The questions are:
>>>Has anyone done it? Can tclsqlite be easily modified to use tclvfs?

Don't think so. It is not tclsqlite , which should be modified, not even
SQLite, but rather low level gdbm library.

Represent your data as Tcl script which would create collection of
arrays, structs and lists which allow easy lookup, and source them into
application.

>>>The application is an address book that holds street adresses, names
>>>and phone numbers for easy lookup, but is a self contained starpack.
>>>
>>>I realize that there are many advantages to storing the db outside the
>>>application, but another idea I was thinking about would to be able to
>>>open a db file thats located on a remote ftp server.

Bad idea. Better to use client-server database or TclSOAP to query
remote database server via web interface.

Typically emulation of filesystem over network, be it ftp, SMB or NFS -
is worst way to access databases.

> This does only work if the library in question uses the Tcl virtual
> filesystem functions to access the db file. I expect sqllite to use the
> normal c functions or maybe mmap() which would not work without
> modifications to the library.

It use gdbm. And all dbm implementations out there rely on sparse files.
Does starkit support sparse files?

--
Perhaps they will have to outlaw sending random lists of words. fee fie
foe foo [sic]
-- Larry Wall in <1997103119...@wall.org>

D. Richard Hipp

unread,
Sep 29, 2004, 6:50:35 AM9/29/04
to
vi...@45.free.net (Victor Wagner) wrote in message news:<cjcdjn$nqu$3...@wagner.wagner.home>...

>
> > This does only work if the library in question uses the Tcl virtual
> > filesystem functions to access the db file. I expect sqllite to use the
> > normal c functions or maybe mmap() which would not work without
> > modifications to the library.
>
> [SQLite] use gdbm. And all dbm implementations out there rely on sparse files.

> Does starkit support sparse files?

SQLite version 1 used gdbm. But that was 4 years ago. We're on
SQLite version 3 now. SQLite abandoned gdbm and began using its
own btree backend in September 2001.

To answer the original question, SQLite uses plain old read() and
write() to get to the database. But you can, in theory, write
a new OS interface that uses the TCL I/O routines instead. There
are already three OS interfaces: os_unix, os_win, and os_test.
Use any or all of these as a model to create os_tcl, if you are
so inclined.

USCode

unread,
Sep 29, 2004, 12:24:30 PM9/29/04
to
"D. Richard Hipp" <d...@hwaci.com> wrote
[snip]

> There
> are already three OS interfaces: os_unix, os_win, and os_test.
> Use any or all of these as a model to create os_tcl, if you are
> so inclined.

Hi Richard,
Are there any plans for an os_mac TCL bindings interface?
Thanks!


Michael A. Cleverly

unread,
Sep 30, 2004, 4:58:03 PM9/30/04
to
On Wed, 29 Sep 2004, USCode wrote:

> "D. Richard Hipp" <d...@hwaci.com> wrote
>

> Hi Richard,
> Are there any plans for an os_mac TCL bindings interface?
> Thanks!

There aren't any precompiled OS X binaries at the www.sqlite.org site (I
imagine Richard doesn't have an OS X machine?), but tclsqlite is included
in the Tcl/Tk Aqua BI distribution at http://tcltkaqua.sourceforge.net.
(Works against SQLite 2.x databases.)

Earlier this week I managed to compy tclsqlite for/with SQLite 3 for
myself. I've put the resulting binaries up at
http://michael.cleverly.com/software/tclsqlite3-osx.tar.gz if anyone else
wants them.

Michael

0 new messages