Paul McNett wrote:
> Uwe Grauer wrote:
>> To Paul:
>> Do you need a python-script similar to test_dCursorMixin.py from your
>> sandbox branch?
>> If so, let me know and i try to do it tomorrow.
> 
> Take a look at class Test_dCursorMixin_mysql in test_dCursorMixin.py... 
> basically I need a version of that for firebird. Specifically, we need 
> to create the same schema so that the tests work equally. My schema is 
> very simple as this test is very "lowest common denominator", but I 
> imagine more of the "all fields" schema if/when we add unit testing for 
> the various backend files.
> 
> If that were handed to me on a silver platter like you are offering, I'd 
> be sure to accept it. In the meantime, I'll try to get a firebird server 
> running on my machine for the unit test to connect to, and a firebird 
> client installed on my dev box so I can run the unit tests.
> 
> Thanks, Uwe. Also, thanks Carl.
> 

I took a look at test_dCursorMixin.py.

If you don't want to use a full path to the testdatabase,
you can setup a database alias.
This has to be done in /yourpathtofirebird/aliases.conf
something like:
dabo_unittest = /yourpathtofirebird/dabo_unittest.fdb
Of cause the db has to be writeable by the firebird user.

The way you are creating the tablename by using
self.temp_table_name = "unittest_%s" % getRandomUUID().replace("-", "_")
doesn't work for fb.
Maximum length of tablename for fb is 31 characters.

To limit the number of records for a select use:
"select first 1000 skip 0 * from tablename"

To create the schema:
        def createSchema(self):
                cur = self.cur
                cur.execute("""
create table %s (pk INTEGER NOT NULL, cField CHAR (32), iField INT,
nField DECIMAL (8,2), PRIMARY KEY (pk))
""" % self.temp_table_name)
                cur.execute("""
create generator gen_%s
""" % self.temp_table_name)
                cur.execute("""
create trigger set_%s_pk for %s active
before insert position 0
as
begin
    if (new.pk is null) then
    new.pk = gen_id(gen_%s, 1);
end
""" % self.temp_table_name, self.temp_table_name, self.temp_table_name)

You may need to commit here.

I didn't write a full script, because you have to make some decisions
for yourself and i don't have enough time now.

But i think this is all to get you going.
If there are still some problems, just ask.

Uwe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to