Welcome to Macrobject Community Login | Register | Faq  

    Macrobject Community
  Macrobject Software Knowledge Management and Collaboration Platform
Search    
   

MySQL Support
Started by wasuplee123 at 06-04-2008 4:20 AM. Topic has 5 replies.

Print Search « Previous Thread Next Thread »
  06-04-2008, 4:20 AM
wasuplee123 is not online. Last active: 9/9/2008 9:31:45 AM wasuplee123

Top 25 Posts
Joined on 06-04-2008
Posts 8
MySQL Support
Reply Quote
Hi,

This is a great product, and I would buy it in a second if it supported MySQL on Delphi7. The main issue seems to be that it doesn't produce valid SQL code. Is there any chance that MySQL will be supported as a provider?

Thanks.
   Report 
  06-04-2008, 5:38 AM
David is not online. Last active: 11/17/2011 8:07:51 AM David

Top 10 Posts
Joined on 01-26-2008
Posts 193
Re: MySQL Support
Reply Quote
Yes, you could write a sub-class TMySQLDataProvider from TDataProvider like this:
  TMySQLDataProvider = class(TDataProvider)
  protected
    function CreateSqlBuilder: TSqlBuilder; override;
  end;

function TMySQLDataProvider.CreateSqlBuilder: TSqlBuilder;
begin
  Result := TMySQLSqlBuilder.Create(_UseParams, _FormatSql);
end;

And write a sub-class TMySQLSqlBuilder from TSqlBuilder:
  TMySQLSqlBuilder = class(TSqlBuilder)
  protected
    function DQ(const value: string): string; override;
  end;

function TMySQLSqlBuilder.DQ(const value: string): string;
begin
  Result := '`' + value + '`';
end;

   Report 
  06-04-2008, 5:41 AM
David is not online. Last active: 11/17/2011 8:07:51 AM David

Top 10 Posts
Joined on 01-26-2008
Posts 193
Re: MySQL Support
Reply Quote
You could override the virtual methods of TDataProvider and TSqlBuilder to realize your special requirement.
Any questions please feel free to contact us [supports@macrobject.com], thanks.
   Report 
  06-16-2008, 9:51 PM
David is not online. Last active: 11/17/2011 8:07:51 AM David

Top 10 Posts
Joined on 01-26-2008
Posts 193
New version of MySQL Connector/ODBC
Reply Quote
MySQL Connector/ODBC 5.1.4, download it from:
  http://dev.mysql.com/downloads/connector/odbc/5.1.html

   Report 
  07-21-2008, 9:01 PM
wasuplee123 is not online. Last active: 9/9/2008 9:31:45 AM wasuplee123

Top 25 Posts
Joined on 06-04-2008
Posts 8
Re: New version of MySQL Connector/ODBC
Reply Quote
Thanks for all your help so far, here and in the emails.

We're using MySQLDAC (http://www.microolap.com/products/connectivity/mysqldac/) as our data provider in Delphi instead of ODBC. However in Code Auto, we are still using ODBC.

We noticed a problem with auto increment fields...

1) In Code Auto it doesn't show anything checked in the "AutoInc" field, even though the primary key field in our table is defined as autoincrement. (This is not really important, because I know how to modify the code generator and make all my primary key fields also be autoincrement in the "Info" file that is generated.)

2) Whenever I create a new ORM object and save it, it doesn't load the autoincrement field that was generated. For example:

---
Order = TOrder.Create(ObjectManager);
Order.Name = "Test";
Order.Save;

// Here Order.ID should not be 0, but it is
Assert(not (Order.ID = 0));
---

I tried calling Order.Refresh() but it also doesn't work. I have a function that will give me the value of the last inserted ID in MySQL, but I don't know where I should call that function in our Data Provider so that auto increment fields will get updated after saving. Thank you.
   Report 
  07-22-2008, 1:16 AM
Bill is not online. Last active: 12/18/2009 11:43:49 PM Bill

Top 10 Posts
Joined on 06-28-2008
Posts 15
Re: New version of MySQL Connector/ODBC
Reply Quote
Thanks for your information. DObject is updated to supports auto increment fields in MySQL.
CodeAuto is updated and you can modify the "AutoInc" field in the UI manually.

Download link: http://www.macrobject.com/en/dobject/download.htm
   Report 
Post
Macrobject Comm... » Developing Tool... » DObject O/R Map... » MySQL Support

Powered by Community Server, by Telligent Systems