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

Request #1828 auto build and database schema of LDAP
Submitted: 2004-07-08 22:08 UTC
From: tdr32 at cs dot byu dot edu Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: 4.3.2 OS: Fedora Core 2
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-08 22:08 UTC] tdr32 at cs dot byu dot edu
Description: ------------ I have a LDAP directory and have been connecting to it through DB_LDAP. When I started to use DB_DataObject, I noticed that it didn't auto build for the LDAP directory. The problem is that it doesn't support the functions of getListOf and tableInfo. Well, I tweaked around a bit and got it up and running on auto building for LDAP. I don't know about updating and that stuff since I haven't gotten that far, just thought you might want to see my patch. It isn't perfect, and it might only work for my situation. One thing that would need to be changed is not just assigning the type of the columns (attributes) to just string. But that was the easiest work around. Thanks for your great work. Reproduce code: --------------- In Generator.php, in the _createTableList(): if (!PEAR::isError($this->tables,DB_ERROR_NOT_CAPABLE)) { foreach($this->tables as $table) { // no change } } elseif (get_class($__DB) == 'db_ldap') { $sql = $__DB->prepare('(objectClass=!)'); $table =& $__DB->execute($sql,'*','list',array('attrsonly'=>0,'sizelimit'=>1)); if (!PEAR::isError($table)) { $defs = $table->fetchall(); $table_name = $defs[0]['dn']; $table_name = substr($table_name,0,strpos($table_name,'=')); $this->tables = array($table_name); foreach (array_keys($defs[0]) as $name) { $def = array ( 'table' => $table_name, 'name' => $name, 'type' => 'string', 'len' => '255', 'flags' => 'not_null'); $this->_definitions[$table_name][] = (object) $def; } }

Comments

 [2004-07-08 22:19 UTC] tdr32 at cs dot byu dot edu
I actually tried to extend DB_DataObject and write a LDAP version, but I had a problem with your errors. It _createTableList(), it checks for an error on line 170 and since LDAP doesn't support those functions it just quites. So, I can't even extend DB_DataObject (or I could and just have to use 2 createTables when I am generating the classes, one for SQL and one for LDAP). So maybe a better suggestion than my previous one, is to not make DB_DataObject support LDAP (since even DB doesn't support it) but to make it so that error doesn't kill the program until it has returned to the calling function, start(). That can be done by checking to see if $this->tables is an error in start and change the exit to continue in the foreach ($this->tables). Thanks Thanks
 [2004-07-16 02:23 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-07-24 02:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!