Uwe Grauer schrieb:
> A ACID database system isn't something like sqlite.
> It has to be maintened in some way.
> 

Of course. Which means more work, if you only want to try out something,
and lots of advantages for the real thing.

> Can't you just create a dabotest.fdb?
> Just provide a DDL script from flamerobin and the parameters for
> database creation (version, charset, ...).
> As i already am running the final kinterbasdb 3.3.0, i am able to look
> into the problem.
> I'm using FB 2.0.4 SS under opensuse 11.0 currently.
> 

Ok, if that's acceptable for you or anybody else using Firebird, then
there's no problem.

Here is the ddl. My Firebird version is FB 2.1.2 SS (snapshot RPM) under
opensuse 11.1. But I think that shouldn't make a difference.

#########################################################
/*
 * Table definition taken from the employee database,
 * just for trying out working with text blob fields.
 */

set names ISO8859_1;

create database 'localhost:blobtest'
  user 'sysdba' password 'masterkey'
  default character set ISO8859_1;

/*
 *  Shortened version of table project
 *  Project id, project name, description
 *  Project description is a text blob.
 */
CREATE TABLE project
(
    proj_id         CHAR(5) NOT NULL CHECK (proj_id = UPPER (proj_id))
PRIMARY KEY,
    proj_name       VARCHAR(20) NOT NULL UNIQUE,
    proj_desc       BLOB SUB_TYPE TEXT
);
#########################################################

And some records:
####################################################################
INSERT INTO PROJECT (PROJ_ID, PROJ_NAME, PROJ_DESC) VALUES ('VBASE',
'Video database', 'Videos systematisch geordnet verzeichnen');
INSERT INTO PROJECT (PROJ_ID, PROJ_NAME, PROJ_DESC) VALUES ('DGPII',
'DigiPizza', 'Digitaler Pizzabäcker');
INSERT INTO PROJECT (PROJ_ID, PROJ_NAME, PROJ_DESC) VALUES ('GUIDE',
'AutoMap', 'Führer durch die größten Städte Österreichs');
INSERT INTO PROJECT (PROJ_ID, PROJ_NAME, PROJ_DESC) VALUES ('MAPDB',
'MapBrowser port', NULL);
####################################################################


And a script showing the problem:

####################################################################
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# fb_blobtest.py

import dabo
from dabo.dLocalize import _
dabo.ui.loadUI("wx")

class ugApp(dabo.dApp):

   def getConnectionByName(self, connName):
       """Given the name of a connection, returns the actual
       connection. Stores the connection so that multiple requests
       for the same named connection will not open multiple
       connections. If the name doesn't exist in self.dbConnectionDefs,
       then None is returned.
       """
       if not self.dbConnections.has_key(connName):
           if self.dbConnectionDefs.has_key(connName):
               ci = self.dbConnectionDefs[connName]
               if self.Charset == None:
                   self.dbConnections[connName] = dabo.db.dConnection(ci)
               else:
                   self.dbConnections[connName] = dabo.db.dConnection(ci,
                       charset=self.Charset)
       try:
           ret = self.dbConnections[connName]
       except KeyError:
           ret = None
       return ret

   def _getCharset(self):
       try:
           return self._charset
       except AttributeError:
           return None

   def _setCharset(self, value):
       self._charset = value

   Charset = property(_getCharset, _setCharset, None,
                      _("Connection charset to be used (string)") )

class BizProject(dabo.biz.dBizobj):

    def initProperties(self):
        self.DataSource = 'project'
        self.KeyField = 'proj_id'
        self.AutoPopulatePK = False
        self.UserSQL = 'SELECT proj_id, proj_name, proj_desc FROM project'

class TestForm(dabo.ui.dForm):

    def afterInit(self):
        self.Sizer = vs = dabo.ui.dSizer('v')
        pn = dabo.ui.dPanel(self)
        vs.append1x(pn)
        pn.Sizer = vsp = dabo.ui.dSizer('v')
        vsp.append(dabo.ui.dTextBox(pn, DataSource='project',
DataField='proj_id',
                                    ReadOnly=True))
        vsp.append(dabo.ui.dTextBox(pn, DataSource='project',
DataField='proj_name'), 'x')
        vsp.append1x(dabo.ui.dEditBox(pn, DataSource='project',
DataField='proj_desc'))
        hs = dabo.ui.dSizer('h')
        hs.append(dabo.ui.dButton(pn, Caption='|<<', OnHit=self.onFirst))
        hs.append(dabo.ui.dButton(pn, Caption='<', OnHit=self.onPrior))
        hs.append(dabo.ui.dButton(pn, Caption='>', OnHit=self.onNext))
        hs.append(dabo.ui.dButton(pn, Caption='>>|', OnHit=self.onLast))
        vsp.append(hs, 0, 'x')
        self.layout()

    def afterInitAll(self):
        self.requery()

    def createBizobjs(self):
        self.Application.addConnectFile('fb_blobtest.cnxml')
        self.Connection = self.Application.getConnectionByName('blobtest')
        biz = BizProject(self.Connection)
        self.addBizobj(biz)

if __name__ == '__main__':
    app = ugApp()
    app.Charset = 'UTF8'
    app.MainFormClass = TestForm
    app.start()





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to