Re: GNOME Database kit



On Wed, Aug 05, 1998 at 11:05:18AM -0500, Adam Keys wrote:
> I've seen various database utilities floating around, like the one Dr.
> Mike of RHAD is working on.  I'm into the database stuff and want to
> write a really cool database library for GNOME.  I want it to be
> portable, abstracted, and powerful.
> I'm looking for other database gurus and some gtk gurus to create the
> widgets needed to logically interact with a database.  Attacted is a
> little white paper scrap I wrote up outlining the intent of the kit.

As some already said ODBC is something to look at... I dunno if they meant
looking at ADO too? Active Data Objects is a very powerfull intuitive way
to access a database. Check out the ado part of the microsoft site...

I've been working with it for a while now and well... the concept is the
best I've ever seen. It's object oriented-ish.

It works on the following objects:

a connection object (you can configure global settings on this
object+transactions stuff like it)

a command object - used to store preset commands. (stored procedures)
a recordset object - used to store recordsets in it static/dynamic (with
                     cursors). You can create them in several practical ways.



an error object - used for error handling... (i'm less impressed with that
                  object.. not logical.. imho)

I've got a tentative tcl module faking this for a part with mysql lying
around.

A small sample in VBscript... (don't flame me on that one ;) ) Syntax is
not completely correct i think... Doing this from a linux box without the
docu near =) (and it's a while back since I coded using it)

Set con = Server.CreateObject("ADODB.Connection")
con.ConnectionTimeout = 30
con.CommandTimeout = 10
con.Open ConnectionString, User, Password

Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = con
rs.Execute "SELECT name, address FROM addressdb", RS_STATIC, <some other stuff>

; Now the fun part...

while not rs.eof do
	if rs(name) = "The boss" then
	   print "he's the boss:" & rs(name)
	end if
	rs.next
wend

rs.Close
con.Close

As you can see you can address the column of a row in a recordset with the
name it is selected. Alternative syntaxes are also allowed...

rs(0)    - first column
rs(name) - column that corresponds with 'name' in the select the rs was
           created with
rs("name") - ditto...

The fact you can address the column with a symbolic name is really *it*.
You can make little changes to the db without having to check 100% of your
code.

My 2cts.

Ric
--
-----+++++*****************************************************+++++++++-------
- Ric Klaren - ia_ric@cs.utwente.nl ------- klaren@cs.utwente.nl --------------
-----+++++*****************************************************+++++++++-------
'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
 of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
   goes round the back and ... er ... prods it with his foot. But in a
    technical way,' he added. --- From: Hogfather by Terry Pratchett.
-------------------------------------------------------------------------------

PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]