Re: Standard Database Interface?
- From: Sean Woods <yoda@xxxxxxxxxx>
- Date: Tue, 23 Oct 2007 01:14:18 -0700
On Oct 22, 12:27 pm, "thelf...@xxxxxxxxx" <thelf...@xxxxxxxxx> wrote:
quote <but a live Oracle system is a teensy bit more of a pain to set
up>
Note much of a pain at all. Oracle XE (free) is an RPM setup on Linux
and is an installable executable on windows.
OraTcl works just fine with Oracle XE.
When the community adopts a common DB API. I will write wrappers to
OraTcl to make it work.
-Todd
That's good to know.
There are a couple of "flexibities" that sqlite has that other
db interfaces cannot share by virtue of the fact it lives in the
same memory as the interpreter. This is not insurmountable, but
I'm thinking operations like evaluating a result to a script would
require a bit of caching by the interpreter.
Perhaps one approach would be to cheat and use sqlite as a cache
for other database engines?
I also know that the MySql API seems to care if a statement will
return a value or not. Running an update as a query will lock up
the db connection handle, so they have seperate "query" and
"command" hooks. I'm digging through the C code now for MySqlTcl
to see if I can make heads or tails of why.
Nice part is that this is a standard for extensions. We can
pretty much say what we want it to be, because it doesn't require
mucking around with the Core.
Here's my API in a nutshell:
driverCommand object {connect info as a key/value list}
object query stmt - Evaluate a statement, and return the values
as one result per line
foo query "select name,rank,serial from pows"
{Percy Capt 234123} {Clancy PFC 141511}
object query_flat stmt - Evaluated a statement and return the
values as a flat list
foo query_flat "select name,rank,serial from pows"
Percy Capt 234123 Clancy PFC 141511
object cmnd stmt - Evaluate a statement that doesn't return a
value (though it would be nice if it returned
something, like rows matched and rows changed
doesn't now)
object describe table - Returns a dict describing a table:
foo describe weatherReports
{index dates {
type index columns {dateReported zipCode}
}
columns {
reportId {type int autoincrement 1}
dateReports {type datetime}
zipcode {type char length 10}
humidity {type int max 100 min 0}
barometer {type real}
temperature {type real}
clouds {type string length 255}
details {type text}
}
primary_key reportId
}
object create_table dict - Create a table based on the
tcl API standard template
object tables - Return a list of tables
One I'd like to add from Sqlite is:
object eval stmt {body} - Evaluate body for every result in stmt
with a variable for each column, filled with the value
for that row.
object roweval stmt body -
like eval, but put the values in a key/value list
named "row" instead of as local variables
object arrayeval stmt body -
like eval, but put the values in an array named "row"
instead of as local variables. List of columns is
stored in element (*) just like in sqlite's implementationn
.
- Follow-Ups:
- Standard DBI Proposal (was: Re: Standard Database Interface?)
- From: Donal K. Fellows
- Standard DBI Proposal (was: Re: Standard Database Interface?)
- References:
- Standard Database Interface?
- From: tcltkdev
- Re: Standard Database Interface?
- From: Sean Woods
- Re: Standard Database Interface?
- From: tcltkdev
- Re: Standard Database Interface?
- From: Sean Woods
- Re: Standard Database Interface?
- From: thelfter@xxxxxxxxx
- Standard Database Interface?
- Prev by Date: Re: Android on Linux
- Next by Date: Re: lambda... again
- Previous by thread: Re: Standard Database Interface?
- Next by thread: Standard DBI Proposal (was: Re: Standard Database Interface?)
- Index(es):
Relevant Pages
|