Re: Re: DB_DataObject: extrange behaviour with odbc

From: Date: Tue, 13 May 2003 06:54:33 +0000
Subject: Re: Re: DB_DataObject: extrange behaviour with odbc
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5343@lists.php.net to get a copy of this message
Alan, Thanks for the help :-) As you pointed out, the $db->getInfo('tablename') is returning an error. I checked the DB set of classes, and it seems as if the method to retrieve the table info is not yet implemented for odbc (function getSpecialQuery). Anyway, handwriting the tables works (though it's really convenient to run the createTables each time the tables are changed !). Regards, -- Daniel Alan Knowles <alan_k@php.net> 12/05/2003 17:48 Para: Daniel Garcia <daniel.garcia@assertio.es> cc: pear-general@lists.php.net Asunto: [PEAR] Re: DB_DataObject: extrange behaviour with odbc Daniel Garcia wrote: > Hi, > > I'm using DataObject to handle the database data for a small website. I've > tested it with local mySQL databases, with very good results. However, I'm > trying now to access database through ODBC (ODBC manager runs on Win2K), > and I'm getting strange results. > > > 1) First, I did not manage to run the createTables.php to build the initial > table classes and the database definition .ini file. It worked fine with: > mysql://user:password@localhost/databasename > > but when the DSN was: odbc://user:password@myodbc > > the files created were really odd: -6.php .ini .php 1.php > 1024.php Array.php DB Error (empty file) > > The odbc DSN uses the mysql ODBC driver. I tried to autogenerate the > configuration files with another ODBC driver (Client Access for AS/400), > and I got exactly the same extrange filenames. It is likely that the pear DB driver for ODBC is not returning details of the tables as expected. - It's probably worth print_r'ing the tableinfo that is returned from $db->getInfo('tablename'); http://docs.akbkhome.com/pearcvs/DB_DataObject_Generator.html#_createTableList and comparing that to the results from the mysql connection. > 2) Next I typed manually the table.php and myodbc.ini files, and the > DB_DataObject class worked fine (tried select and update) but it throws a > warning: > > Warning: parse_ini_file() [function.parse-ini-file.html]: Cannot open > 'D:/www/includes/DataObjects/.ini' for reading in c: > \php\pear\DB\DataObject.php on line 1080 Ah :) - since your odbc connection does not contain a database it can not read this from the dsn.. (and fails to load the table.ini/links)- the work around would be to set var $database="name"; I'm not sure if you can fudge the dsn to do odbc://user:password@myodbc/databasename if it works it may solve the generator. can you file it as a bug as well - noting that odbc does not set a database I will probably have to solve this with an ini setting for database name. Regards Alan > > It looks for file .ini, when the file it should look for is (I guess) > myodbc.ini. Renaming the myodbc.ini to .ini works. > > > 3) Setting on the debug mode for the class shows that the queries and > connections are successful. At least its getting something right :) > > > Any hints are appreciated ! > > -- Daniel > -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#5343) next »