Hello,
I like to use two database, a postgresql and a mysqli in my module. My settings.php looks like this:
$db_url['default'] = 'mysqli://user:pass@localhost:3370/allathletics'; $db_url['atleta'] = 'pgsql://user:pass@192.168.2.104/cds_atletabackup';
But when I try the
db_set_active('atleta');
I get the
Fatal error: Cannot redeclare db_status_report() (previously declared in /var/www/mysite/includes/database.mysqli.inc:23) in /var/www/demo.internetstudio.hu/allathletics/web/includes/database.pgsql.inc on line 33
Is there a solution for it, or I must to use two same database type?
Ámon Tamás Sitefejlesztő és programozó
You MUST use two same database type.
Explaination is simple, since Drupal files with pgsql support and mysql support declare the same function's names inside, it's just impossible to go through this situation.
Using OO it could be possible, but Drupal is not OO.
On mer, 2008-07-30 at 10:04 +0200, Ámon Tamás wrote:
Hello,
I like to use two database, a postgresql and a mysqli in my module. My settings.php looks like this:
$db_url['default'] = 'mysqli://user:pass@localhost:3370/allathletics'; $db_url['atleta'] = 'pgsql://user:pass@192.168.2.104/cds_atletabackup';
But when I try the
db_set_active('atleta');
I get the
Fatal error: Cannot redeclare db_status_report() (previously declared in /var/www/mysite/includes/database.mysqli.inc:23) in /var/www/demo.internetstudio.hu/allathletics/web/includes/database.pgsql.inc on line 33
Is there a solution for it, or I must to use two same database type?
Ámon Tamás Sitefejlesztő és programozó -- 5NET Informatikai Kft. 1062 Budapest, Aradi utca 38. A 3/11 telefon: (1) 461-0205 | fax: (1) 461-0206 e-mail: amont@5net.hu | web: http://www.5net.hu
Quoting Pierre Rineau pierre.rineau@makina-corpus.com:
You MUST use two same database type.
Explaination is simple, since Drupal files with pgsql support and mysql support declare the same function's names inside, it's just impossible to go through this situation.
Yes, this is most unfortunate. I've an idea of how to fix it but I won't even begin until after the PDO patch is in.
Using OO it could be possible, but Drupal is not OO.
What an odd sentence. Drupal doesn't need to use classes and instantiation to resolve this bit of hardship. It just needs to use the database type to resolve which function to hook from the global function name. So I call db_query() in my module but that will call db_query_mysql() or db_query_pgsql() dependent on the type of the DB active at the time. Currently the design declares the same db_query() function within more than one file which is really sad.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
On mer, 2008-07-30 at 09:47 -0400, Earnie Boyd wrote:
Quoting Pierre Rineau pierre.rineau@makina-corpus.com:
You MUST use two same database type.
Explaination is simple, since Drupal files with pgsql support and mysql support declare the same function's names inside, it's just impossible to go through this situation.
Yes, this is most unfortunate. I've an idea of how to fix it but I won't even begin until after the PDO patch is in.
Using OO it could be possible, but Drupal is not OO.
What an odd sentence. Drupal doesn't need to use classes and instantiation to resolve this bit of hardship. It just needs to use the database type to resolve which function to hook from the global function name. So I call db_query() in my module but that will call db_query_mysql() or db_query_pgsql() dependent on the type of the DB active at the time. Currently the design declares the same db_query() function within more than one file which is really sad.
Yes, I agree with that, this was a wonderfull troll :)
But it should go with a dynamic database type resolving based on active database type.
It really could be easy to implement.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting Pierre Rineau pierre.rineau@makina-corpus.com:
On mer, 2008-07-30 at 09:47 -0400, Earnie Boyd wrote:
What an odd sentence. Drupal doesn't need to use classes and instantiation to resolve this bit of hardship. It just needs to use the database type to resolve which function to hook from the global function name. So I call db_query() in my module but that will call db_query_mysql() or db_query_pgsql() dependent on the type of the DB active at the time. Currently the design declares the same db_query() function within more than one file which is really sad.
Yes, I agree with that, this was a wonderfull troll :)
But it should go with a dynamic database type resolving based on active database type.
It really could be easy to implement.
Such a patch should wait on http://drupal.org/node/225450 to be committed which means that it this easy implementation might need to wait on D8. If someone wants to beat me to a patch go ahead; this is open source country.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
On Wed, 30 Jul 2008 09:47:28 -0400, Earnie Boyd earnie@users.sourceforge.net wrote:
Quoting Pierre Rineau pierre.rineau@makina-corpus.com:
You MUST use two same database type.
Explaination is simple, since Drupal files with pgsql support and mysql support declare the same function's names inside, it's just impossible to go through this situation.
Yes, this is most unfortunate. I've an idea of how to fix it but I won't even begin until after the PDO patch is in.
The PDO patch already addresses this and many other issues. It is currently ready (IMO), passing all unit tests not already broken (as of last week), and desperately needs someone to review it and mark it RTBC so that we can move on to the dozen or so follow-up patches that still need to be written.
--Larry Garfield
Quoting Larry Garfield larry@garfieldtech.com:
On Wed, 30 Jul 2008 09:47:28 -0400, Earnie Boyd earnie@users.sourceforge.net wrote:
Quoting Pierre Rineau pierre.rineau@makina-corpus.com:
You MUST use two same database type.
Explaination is simple, since Drupal files with pgsql support and mysql support declare the same function's names inside, it's just impossible to go through this situation.
Yes, this is most unfortunate. I've an idea of how to fix it but I won't even begin until after the PDO patch is in.
The PDO patch already addresses this and many other issues. It is currently ready (IMO), passing all unit tests not already broken (as of last week), and desperately needs someone to review it and mark it RTBC so that we can move on to the dozen or so follow-up patches that still need to be written.
I wasn't aware that that patch took care of this issue. Thanks for the enlightenment Larry.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting Ámon Tamás amont@5net.hu:
Hello,
I like to use two database, a postgresql and a mysqli in my module. My settings.php looks like this:
$db_url['default'] = 'mysqli://user:pass@localhost:3370/allathletics'; $db_url['atleta'] = 'pgsql://user:pass@192.168.2.104/cds_atletabackup';
But when I try the
db_set_active('atleta');
I get the
Fatal error: Cannot redeclare db_status_report() (previously declared in /var/www/mysite/includes/database.mysqli.inc:23) in /var/www/demo.internetstudio.hu/allathletics/web/includes/database.pgsql.inc on line 33
Is there a solution for it, or I must to use two same database type?
The only solution is to hack core. Create a definition of db_status_report in database.inc will will in turn call one of db_status_report_mysqli() or db_status_report_pgsql() dependent on the active database type. You change the name of the db_status_report function in each of the database.mysqli.inc and database.pgsql.inc files accordingly.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Earnie Boyd írta:
Quoting Ámon Tamás amont@5net.hu:
Hello,
I like to use two database, a postgresql and a mysqli in my module. My settings.php looks like this:
$db_url['default'] = 'mysqli://user:pass@localhost:3370/allathletics'; $db_url['atleta'] = 'pgsql://user:pass@192.168.2.104/cds_atletabackup';
But when I try the
db_set_active('atleta');
I get the
Fatal error: Cannot redeclare db_status_report() (previously declared in /var/www/mysite/includes/database.mysqli.inc:23) in /var/www/demo.internetstudio.hu/allathletics/web/includes/database.pgsql.inc on line 33
Is there a solution for it, or I must to use two same database type?
The only solution is to hack core. Create a definition of db_status_report in database.inc will will in turn call one of db_status_report_mysqli() or db_status_report_pgsql() dependent on the active database type. You change the name of the db_status_report function in each of the database.mysqli.inc and database.pgsql.inc files accordingly.
I thinked about a same solution. Maybe this should be in the next version in drupal... It is a drupal 6. Maybe somebody has a patch for it?
Ámon Tamás Sitefejlesztő és programozó
Quoting Ámon Tamás amont@5net.hu:
I thinked about a same solution. Maybe this should be in the next version in drupal... It is a drupal 6. Maybe somebody has a patch for it?
I haven't seen one yet. There is http://drupal.org/node/225450 to switch to PDO which is a large patch set in itself. The engine include files are changing already because of this patch which is why I haven't even attempted a patch as I've suggested. Feel free to pursue the patch yourself.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Earnie Boyd írta:
Quoting Ámon Tamás amont@5net.hu:
I thinked about a same solution. Maybe this should be in the next version in drupal... It is a drupal 6. Maybe somebody has a patch for it?
I haven't seen one yet. There is http://drupal.org/node/225450 to switch to PDO which is a large patch set in itself. The engine include files are changing already because of this patch which is why I haven't even attempted a patch as I've suggested. Feel free to pursue the patch yourself.
I found this: http://drupal.org/node/19522 But I use also postgresql for drupal too.
Ámon Tamás Sitefejlesztő és programozó