yes for that to work you'd have to change PEAR, which I don't really recommend. perhaps there is a way to query the database for that information? ie in mysql you can call
$this->dbH->query('SELECT LAST_INSERT_ID()');
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I, too, advise against changing anything in the basic SiteManager distribution, including PEAR. I have enough trouble debugging my own code without having to worry about the "good" stuff. ;-)
However, if I have a family of functionality that I would like to make available to a collection of modules, then I do something like this: create a class (called MoreFuncs, say) containing that functionality, extend SM_module (called Enhanced_Module, say), and add a MoreFuncs object to the Enhanced_Module. Then I make my modules extend Enhanced_Module instead of SM_Module.
In a little more detail:
class MoreFuncs {
function funcDesired1(){
// desired func code here
}
function funcDesired2(){
// desired func code here
}
}
class Enhanced_Module extended SM_Module {
var mfH;
// constructor
function Enhanced_Module(){
$this->mfH = new MoreFuncs;
}
}
class MyMod extends Enhanced_Module {
function moduleConfig(){
// whatever
}
function moduleThink(){
$this->mfH->funcDesired1();
}
}
[ probably some housekeeping missing here, some includes and requires, and a parent constructor or something, but hopefully this gives the idea. ]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I'm trying to add pg_last_oid() function to dbH to use it like this:
$result = $this->dbH->simpleQuery($SQL_QUERY);
$this->dbH->lastOID($result);
but.. have no idea how to do it..
It probably must be added to PEAR, but it doeasn't work when I add it in way the numRows() function is implemeneted.
best regards
Radek Litwin
(radek dot starla dot pl)
yes for that to work you'd have to change PEAR, which I don't really recommend. perhaps there is a way to query the database for that information? ie in mysql you can call
$this->dbH->query('SELECT LAST_INSERT_ID()');
I, too, advise against changing anything in the basic SiteManager distribution, including PEAR. I have enough trouble debugging my own code without having to worry about the "good" stuff. ;-)
However, if I have a family of functionality that I would like to make available to a collection of modules, then I do something like this: create a class (called MoreFuncs, say) containing that functionality, extend SM_module (called Enhanced_Module, say), and add a MoreFuncs object to the Enhanced_Module. Then I make my modules extend Enhanced_Module instead of SM_Module.
In a little more detail:
class MoreFuncs {
function funcDesired1(){
// desired func code here
}
function funcDesired2(){
// desired func code here
}
}
class Enhanced_Module extended SM_Module {
var mfH;
// constructor
function Enhanced_Module(){
$this->mfH = new MoreFuncs;
}
}
class MyMod extends Enhanced_Module {
function moduleConfig(){
// whatever
}
function moduleThink(){
$this->mfH->funcDesired1();
}
}
[ probably some housekeeping missing here, some includes and requires, and a parent constructor or something, but hopefully this gives the idea. ]