Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #5127 crosslink fields don't work with pgsql
Submitted: 2005-08-17 15:26 UTC
From: jowenn at kde dot org Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: 4.4.0 OS: linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 33 - 22 = ?

 
 [2005-08-17 15:26 UTC] jowenn at kde dot org
Description: ------------ I'm using postgresql 8.x and there the table names as they are understood by the pear db layer and teh formbuilder are created like "public.tablename" This causes Problems, since form fields for crosslinked tables are created like __crossLink_public.siteuser_group_username_id The page receives this as __crossLink_public_siteuser_group_username_id in the post request though ( . --> _). The problem is solved, if in processForm the crosslink name is generated like: $crossLinkName = str_replace('.','_','__crossLink_'. $crossLink['table']. '_'.$crossLink['fromField']. '_'.$crossLink['toField']); (with the str_replace) Could that be put into mainstream ? Kind regards Joseph Wenninger

Comments

 [2005-08-17 16:42 UTC] justinpatrin
Could it be possible to generate them without the "public."?
 [2005-08-17 16:44 UTC] justinpatrin
I *could* put something like this in FB, but it would require a bunch of little calls all over the place and this could easily turn into a maintenance nightmare...if '.' is the only special char and this isn't fixable in any other way I'll consider adding it.
 [2005-08-17 18:05 UTC] mw21st
I don't think this needs a fix in the code. I'm using Postgres at work and I did not experience this problem - all the table names are reported back without the schema prefix. However a colleague of mine hat a similar(?) problem, and he solved it by changing (in the DataObject generator script): $this->tables = $__DB->getListOf('schema.tables'); To: $this->tables = $__DB->getListOf('tables'); And then re-genenerated the class files. I don't know why on some setups this seems different, but my guess is, it's some configuration issue.
 [2005-08-19 09:49 UTC] jowenn at kde dot org
If only the "public" schema is used there is no problem to put generator_strip_schema = true into the inifile for the generator since "tablename" equals to "public.tablename", but if a user uses schemas he has defined himself, he can't do that. I don't really see the problem, why it should be a nightmare to maintain. What about a function fixFieldNames or something like that, through which all generated field names are passed through before being put into the page or before being checked for in post/get requests, which filters anything but a-zA-Z0-9_ away and replaces the bad characters by "_" A disadvantage would be a performance penalty ofcourse.
 [2005-08-19 18:05 UTC] justinpatrin
Take a look at the size of the codebase, this is why it's a maintenance problem. That said, I suppose this does need to be handled somehow.... It looks like either HTML_QuickForm is altering the element names or the browser is. Your solution makes some sense and, actually, is pretty much what DB_DataObject already does when dealing with class and field names. We'll try to get something like this into FormBuilder...
 [2005-08-22 04:55 UTC] justinpatrin
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.