Forums / Developer / SQL queries break Content Object creation

SQL queries break Content Object creation

Author Message

Dave Dykshoorn

Wednesday 24 September 2003 8:54:35 am

The problem I am facing is one that I can't make much sense out of and I was hoping someone could enlighten me to my mistake. The Query works and returns the correct results however if I run the query
$class =& eZContentClass::fetch(19);
returns this:

ezcontentclass Object
(
[PersistentDataDirty] =>
[ID] =>
[Name] =>
[Identifier] =>
[ContentObjectName] =>
[Version] =>
[VersionCount] => 1
[CreatorID] =>
[ModifierID] =>
[Created] =>
[Modified] =>
[InGroups] =>
[AllGroups] =>
)

whereas if i fake, or remove, the query it creates the object correctly:

ezcontentclass Object
(
[PersistentDataDirty] =>
[ID] => 19
[Name] => Saved Report
[Identifier] => saved_report
[ContentObjectName] =>
[Version] => 0
[VersionCount] => 1
[CreatorID] => 14
[ModifierID] => 14
[Created] => 1059166776
[Modified] => 1064251143
[InGroups] =>
[AllGroups] =>
)

I attempted the query using the built in php mysql functions with the same result. I have also moved the query to after fetching the class but this doesn't help either.

The code follows:

$db =& new eZMySQLDB(array( 'server'=>'myserver',
'database'=>'mydatabase',
'user'=>'dbuser',
'password'=>'userspassword' ) );

$info = $db->arrayQuery("SELECT `Report`, `RunName`, `UserID` FROM `mytable` WHERE `RunID` = $RunID" );

$class =& eZContentClass::fetch(19); //my content class

...
(more code)

Thanks for the help!

Dave

Dave Dykshoorn

Wednesday 24 September 2003 3:03:19 pm

The problem is more generic than I first thought. If I connect to a db other than the ezp db any and all eZp Object functions seem to return defined but empty objects.

I think there is a problem with the way I terminate my db connection (or don't terminate it). It seems eZp is getting confused with the mysql resource that I create by connecting to another db. eZp seems to be unable to accurately get information about eZp objects.

Again, if I remove the query everything runs fine. If I do my queries in another view and then $Module->redirectToView the results of the query, the objects (after the redirect) work fine as well.

Has anyone else run into this? Or does anyone know if I'm running the above query incorrectly, which could cause eZp's db connection to get messed up?

Dave

enigmista enigmista

Tuesday 27 July 2004 6:04:00 am

Same problem. No solution found.