Login | Register
My pages Projects Community openCollabNet

Discussions > users > [propel] Stored Procedures MSSQL doesn't work and results in "Changed database context to ..."

propel
Discussion topic

Back to topic list

[propel] Stored Procedures MSSQL doesn't work and results in "Changed database context to ..."

Reply

Author Wolfgang Drews <drews at dynamicwebpages dot de>
Full name Wolfgang Drews <drews at dynamicwebpages dot de>
Date 2005-03-23 01:29:52 PST
Message Hi List,

i have a strange problem and i would really appreciate any
kind of help or discussion about it. Maybe this mail just
helps someone out there, having the same problems ....

I use Propel/Creole on Linux as Productionsystem in
combination with MSSQL (FreeTDS). I develop on a Windows XP.
I have some StoredProcedures working well under Windows, but
throwing errors under Linux (Changed database context to ...)

Under Windows i can call SPs this way:

$stmt = $this->con->p​repareCall("pe_objec​tTrees_getnodes");
$stmt->setInt("@​id_pe_objectTreeRoot​s", $id_pe_objectTreeRoots, false);
$result = $stmt->executeQu​ery(ResultSet::FETCH​MODE_NUM);

$result is then an array i can walk through and build an
array of arrays, what fits my needs.
Under Linux, this does not work! Here is the code, that works
under Linux:

$sql = "EXECUTE pe_objectTrees_getnodes ".$id_pe_objectTreeRoots;
$stmt = $this->con->c​reateStatement();
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
return parent::populateObjects($rs);

ofcourse i have to override the hydrate-method (and in there
have to use the debug_backtrace() to know what function was
actually called) and then "populate" the object -> what i get
back is an array of objects -> atually not what i need, but
i can work with it.

a better workaround for this is to use preparedstatements, which
leaves the hydrate-method untouched and works under linux, too:

$stmt = $this->con->p​repareStatement('EXE​CUTE pe_objectTrees_getnodes ?');
$stmt->setInt(1, $id_pe_objectTrees);
$result = $stmt->executeQu​ery(ResultSet::FETCH​MODE_NUM);

the output here again fits my needs, giving me an array of arrays.

does anyone can tell me, hy the first version does run under
windows, but not under linux?

best regards

-Wolfgang

--
PHP-Knotenpunkt Dynamic Web Pages: http://www.dynamicwebpages.de/
Deutschsprachige PHP-Zertifizierungen: http://www.phpzertif​izierung.de/
Professionelle Lösungen für dynamisches Webpublishing: http://php-buch.de/


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@pr​opel.tigris.org
For additional commands, e-mail: users-help at propel dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[propel] Stored Procedures MSSQL doesn't work and results in "Changed database context to ..." Wolfgang Drews <drews at dynamicwebpages dot de> Wolfgang Drews <drews at dynamicwebpages dot de> 2005-03-23 01:29:52 PST
Messages per page: