> But even with MySQL, how do you get the field information for derived
> fields. Given the query:
>
> select customers.cname,
>         invoices.cnumber,
>         concat(customers.cname, "-", invoices.cnumber) as test
>    from customers
>   inner join invoices
>      on invoices.custid = customers.id
>   where ...
>
> How do we find out, *from MySQL*, the datatype of the test result
> column, when the query happens to return zero records? I know that the
> result column should be char, but currently our dCursor has no idea.

What about doing a "create temporary table dabo_temp (select statement) limit 1"
I think that should work for MySQL. It doesn't apper than SQLite has
that ability though.


Back to the inserting problem, I had the exact same problem with MySQL
as SQLite. Then I added "mybiz.requery()" in. That stoped me from
getting the errors. However, it still doesn't insert. I also manually
added some data to the table(I used MySQL Query Browser, anyone know
anything better, with less bugs, and free?). That didn't change the
result though. Also, according to getDataSet(), it is setting the new
theid like this, '5', instead of just 5. The theid it says it uses
goes up every time.
Here is the updated code:

        class testbiz(biz.dBizobj):
                def initProperties(self):
                        self.Caption = "mytesttable"
                        self.DataSource = "mytesttable"
                        self.KeyField = "theid"
                        self.RequeryOnLoad = False
                        self.Encoding = "latin-1"
                        
                def afterInit(self):
                        self.setBaseSQL()
                        
                def setBaseSQL(self):
                        self.addFrom("mytesttable")
                        self.addField("mytesttable.theid as theid")
                        self.addField("mytesttable.first_name as first_name")
                        self.addField("mytesttable.last_name as last_name")
                        self.addField("mytesttable.amount_owes as amount_owes")
        
        mybiz = testbiz(conn)
        mybiz.requery()
        print mybiz.getDataSet() #prints out the info for the row that is in
the database
        
        mybiz.new()
        mybiz.first_name = "Brandon"
        mybiz.last_name = "Singer"
        mybiz.amount_owes = 1234.01
        mybiz.save()

        print mybiz.getDataSet() #prints out the info for the row that is in
the database + the row that it should have added but didn't

--
-Echo

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

Reply via email to