Forums / Developer / Storing objects in distinct tables

Storing objects in distinct tables

Author Message

Gabriel Ambuehl

Wednesday 14 May 2003 4:23:16 am

I was wondering whether there is a possibility to get content objects mapped to a specific database table. Basically, I want to base an interface to administrate the DB backend of our mailserver farm on ezpublish and content objects would be near ideal if I could map them into real tables. Is there any possibility to do something like that? Or would I have to implement my own module? (Which is damn near to implement it from scratch...).

Visit http://triligon.org

Paul Borgermans

Wednesday 14 May 2003 5:30:25 am

Hello Gabriel,

If you have the time, I would suggest to make one or more new content datatypes which maps to your non-ez database table records for storage. It is not necessary to make a new module for that. Then you create a new class with your custom content datatype.

Instead of using ezpersistentobject for the attributes (fields) of your new dataype, you make your own database queries. Take a look at /kernel/classes/datatypes/ezimage. Here the storage is in the file system and a dedicated table, but you get the necessary structure and ideas.

Next you will want to write a script to create the object nodes from your table and keep them in sync.

That's the approach we will follow to integrate our own existing databases into ezpublish and getting the benefits of the rest of ezpublish.

It's a more complicated route (you will need to study how dataypes work) than an own module, but you may gain time in creating the user interface (ezp content objects, fetch function, ...).

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Wednesday 14 May 2003 5:51:57 am

More:

If you have a single table with simple fields in the ezp database, you may also use ezpersistentobject (which basically needs a definition with table name, field names, ...) . Most of the rest is done for you.

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paulo Almeida

Wednesday 14 May 2003 7:39:52 am

Do you use postgresql? Or could you use it?
Why not try with DB stored procedures and triggers?
That's the path i will try to sync user data to your imap and smtp server.

It seems that svn version alrready has suport to pg 7.3 (i haven't tryed yet)

PACPI.COM Internet Consulting
http://pacpi.com

Gabriel Ambuehl

Thursday 15 May 2003 1:57:16 am

I thought about datatypes myself but they really are a pain to get right. Compared to that, writing a module is quite straightforward in any case. I mean I need to write some code no matter what (I definitely NEED sanity checking on something that just about handles all communication needs for hundreds of domains), it could even be better not to tie it to ezpublish in first place, I haven't made up my mind on that one (then again, if I don't tie it to ezpublish, I need at least some templating anyay).

Given that the permission model in ezpublish doesn't really make much sense for our use, I might be better off to just code a loosely related script that's able to run on its own, too.

Need to go look into eztemplate's license.

As using postgre and triggers: I might even go for Postgre (one of the guys here is STRONGLY biased against MySQL) but I'm not gonna allow any DB triggers messing around with my mailserver, especially as I can simply safe EVERYTHING (not sure about autoresponders yet, though) in the DB. The mailserver will create folder structures etc on its own anyway.

The only thing I can't control from the DB without triggers is, obviously, deleting of users but that's reasonably simple, too. Just set a delete flag and have a cronjob delete all files associated with an account.

Visit http://triligon.org

eZ debug

Timing: Jan 30 2025 19:34:51
Script start
Timing: Jan 30 2025 19:34:51
Module start 'content'
Timing: Jan 30 2025 19:34:51
Module end 'content'
Timing: Jan 30 2025 19:34:51
Script end

Main resources:

Total runtime0.2329 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 587.9531370.2891
Module start 'content' 0.00860.0160 958.24221,005.5313
Module end 'content' 0.02460.2083 1,963.77343,893.7109
Script end 0.2329  5,857.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00492.1105200.0002
Check MTime0.00150.6405200.0001
Mysql Total
Database connection0.00090.367910.0009
Mysqli_queries0.133957.46411410.0009
Looping result0.00160.69041390.0000
Template Total0.207989.310.2079
Template load0.00090.378310.0009
Template processing0.207188.889710.2071
Override
Cache load0.00060.266110.0006
Sytem overhead
Fetch class attribute can translate value0.00180.790810.0018
XML
Image XML parsing0.00020.095310.0002
General
dbfile0.00853.6432200.0004
String conversion0.00000.002530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs