Page 1 of 1

MySQL tables with related Oracle tables

PostPosted: Mon Jan 19, 2009 1:25 am
by Jean
Hi Steve,
I am building an app where I get data from different sources. My main data in in MySQL tables but I have to display some static fields from various related data sources (Oracle, LDAP, Access...).
I plan to use delegate classes to add a %field%__pullValue to display this data in the page.
Do you have any better solution for this kind of challenge ?
Thank you
Jean :)

PostPosted: Mon Jan 19, 2009 12:17 pm
by shannah
%field%__pullValue() is more for preparing a value for use in a form. If these values are coming from outside the MySQL database perhaps it is better to define a calculated field.

i.e.
field__%myfieldname%() for these items. The up side of this is that programatically you'll be able to use the field as if it was any other field. The down side is that these fields won't show up by default in the view tab or the edit tab, unless you explicitly implement a block displaying the field.

Another option is to define a dummy grafted field in the __sql__ directive of the fields.ini file, then use %fieldname%__display() to override how this field is displayed (i.e. get the data from the actual source). The up-side of this option is that it will display in your list and view tabs by default. The down side (as with the previous approach) is that you'll be making a database call to your external data source for each field and record... this could result in a lot of database calls per request).

Another approach is to actually import the entire result set of relevant data into a mysql table, and periodically refresh it. Then you can just use the __sql__ directive in the fields.ini file to graft the appropriate fields onto the end of your table. A clever implementation of this strategy would probably give you the best results, as then you would be able to search on these fields as well.

-Steve

PostPosted: Tue Jan 20, 2009 1:06 am
by Jean
Thank you Steve for your solutions. I think I will mix up the two last solutions.
I have some tables from Oracle and some fields in some tables.

In ApplicationDelegate.php, I check up the entries number in the entire tables and if there is an addition I will build a query to add it int the MySQL table.
For those whose one or two fields I use, I will use the second solution.

Have a nice day
Jean