External database integration

Author Message

ciradhb forward

Monday 21 March 2005 5:00:44 am

Hi,
I think my need is preety simple but I didn't read anything about it in EZPublish documentation.

I have an existing database that stores a lot of scientific data. I need to create EZPublish content classes that integrate on one hand standard attributes like text, URL, email, images, etc , but on the other hand some attributes that should collect their values by a request on the external database.

Conceptually, I would like to have a datatype for these attributes that could allow me to specifify that their value is the result of a SQL request like : "SELECT Field1,Field2,Field3 FROM MyBase::MyTable WHERE Field4=$X"
where $X could be a value that is entered when the content classe is instanciated.

For instance, imagine an ecommerce site that would create pages describing their products and that the price attribute of each product is the result of "SELECT price FROM product WHERE product_ref=$Ref" .

I guess it is a basic feature for a CMS like EzPublish, and maybe there are several ways to do it. But I did not found the solution in EZP docs. Can someone help me ?

Thanks in advance.

HB

Frederik Holljen

Monday 21 March 2005 6:44:47 am

Hi,

This issue depends on a few variables that you do not mention in your request:

- how do you want to control exactly which resource to select from in the external database (by another attribute in the content object?)
- do you want to be able to "edit" the external attributes from eZ publish?
- do you need translation or version control?

If you don't need translation or version control I would suggest to write new datatypes for each of the different type of fields from the external resource (e.g external int, external varchar etc.) use a native eZ publish attribute to control the id of the external content row.

I think some of our partners have developed something like this in the past.

Frederik

ciradhb forward

Monday 21 March 2005 7:50:28 am

Hi Frederik,

In a first step, I only expect to request my database in a static way. I know the table and field names in advance, so I can hardcode them. I only need to allow a contributor to specify a value for the $X variable in the WHERE of the SELECT clause.
Actually, for the moment I only want to know how to send a request to an external database and get the result in a content object. Maybe in a second step, I will want to do it more dynamically and be able to specify more elements of the SELECT clause.
What do you mean by "edit the external attribute" ? To change its value and update the external DB ? Not for the moment, my hope is just to request the external DB, get the result, and integrate this result in a EZP content object. No translation or version control either.

Thanks for your help .

HB

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:31:49
Script start
Timing: Jan 18 2025 22:31:49
Module start 'layout'
Timing: Jan 18 2025 22:31:49
Module start 'content'
Timing: Jan 18 2025 22:31:50
Module end 'content'
Timing: Jan 18 2025 22:31:50
Script end

Main resources:

Total runtime1.2033 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 589.0469152.6250
Module start 'layout' 0.00520.0027 741.671939.4453
Module start 'content' 0.00791.1939 781.1172509.6172
Module end 'content' 1.20180.0015 1,290.734412.1641
Script end 1.2033  1,302.8984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2827160.0002
Check MTime0.00130.1058160.0001
Mysql Total
Database connection0.00080.068910.0008
Mysqli_queries1.152995.8100570.0202
Looping result0.00060.0466550.0000
Template Total1.171997.420.5859
Template load0.00230.194420.0012
Template processing1.169597.190820.5848
Template load and register function0.00020.014810.0002
states
state_id_array0.00090.071210.0009
state_identifier_array0.00260.212320.0013
Override
Cache load0.00200.1651290.0001
Sytem overhead
Fetch class attribute can translate value0.00060.053820.0003
Fetch class attribute name0.00130.104240.0003
XML
Image XML parsing0.00090.076320.0005
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00070.0593160.0000
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs