[orm-devel] ORM adapter for Firebird by Werner F. Bruhin

Diedrich Vorberg orm-devel@mailman.tux4web.de
Thu, 20 Feb 2003 18:34:18 +0100


Hi Werner,

pleased to meet you!

>I would like to evaluate ORM (version 0.8) and SQLObjects (managed to 
>get it working with Firebird) for a project,  but want to use it with 
>Firebird.  So, I started putting a ORM-Firebird adapter together - 
>looking at MySql and PostGre adapters you did and copied/pasted and 
>changed a little.
That's great news! Actually there's not much more to do than that to 
create a new adapter.

>Firebird is different to PostGre and MySql in how it handles 
>autoinc/sequence columns.  It has a generator and one can either use a 
>trigger to generate the ID and would then have to do a query to get it 
>(not sure that this can be done in a way which is 100% reliable), 
>another method is to call a stored procedure which returns the ID to be 
>used and insert that into the object before the actual insert is done - 
>I prefer the later method.

>My current problem is that I am not sure how to get to the connection 
>and create a cursor and call the stored procedure.

Each datasource class has a _dbconn() method which returns a valid
DBAPI connection object. The default implementation (inherited from
datasource_base) just returns the _conn attribute of its object.

>Another question, in my test script (see full script below) I have to insert
>
>"from orm.adapters.firebird.columns import * "
>
>to get the firebird columns, should that be automatically loaded by 
>orm.datasources depending on what adapter type one is requesting??

Users are supposed to use lines like these:

  from orm.columns import *
  from orm.adapters.myadapter.columns import *

This way each adaper's custom datatype/column classes are available. 
Also, an adapter's column module could replace datatypes from orm's 
column module this way if that should be necessary.

>Would appreciate any hints/help on this.
Werner, your work is very much appreciated here and I'll be happy to 
answer any question you might have!

I'll put the files you sent into the CVS repository now, so they
should be available shortly. I'll put comments in when I think it
might be helpful.

Also, if you are interested, I can create an account on
c200.tux4web.de for you, so you can check in your changes and keep a
$Log: 000143.html,v $
Revision 1.1  2006/05/12 10:06:28  diedrich
*** empty log message ***
 using CVS. Do you have ssh and cvs installed?

Diedrich

-- 
           _..._                            Diedrich Vorberg
         .'     '.
        /  _   _  \                         http://www.tux4web.de
        | (o)_(o) |                         info@tux4web.de
         \(     ) /            .---.
         //'._.'\ \           /     \       Internet Dienstleistungen
        //   .   \ \          \.@-@./       und 'Consulting'.
       ||   .     \ \         /`\_/`\
       |\   :     / |        //  _  \\      Linux Rules!
       \ `) '   (`  /_      | \     )|_
     _)``".____,.'"` (_    /`\_`>  <_/ \
     )     )'--'(     (    \__/'---'\__/
      '---`      `---`