Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #15232 Multiple database handles seem to collide
Submitted: 2008-12-04 09:17 UTC
From: c0ntax Assigned: danielc
Status: Bogus Package: MDB2 (version 2.4.1)
PHP Version: 5.2.0 OS: 5.0.32-Debian_7etch8-log
Roadmaps: (Not assigned)    
Subscription  


 [2008-12-04 09:17 UTC] c0ntax (Dan Burzynski)
Description: ------------ If I create two database handles and then query against the first one I created, it runs the query against the second database connection. It seems that the most recent one is stamping over the top of the last. Test script: --------------- From the command line: mysqladmin -u bob -p buttons create test1 mysqladmin -u bob -p buttons create test2 mysql -u bob -p buttons -e 'create table a (a int primary key); insert into a (a) values (1);' test1 mysql -u bob -p buttons -e 'create table b (b int primary key); insert into b (b) values (1);' test2 Now the script: <?php require('MDB2.php'); $dsn1 = 'mysql://bob:buttons@localhost/test1'; $dsn2 = 'mysql://bob:buttons@localhost/test2'; $options = array( 'debug' => (true), 'portability' => MDB2_PORTABILITY_ALL, 'persistent' => false, 'debug_handler' => 'db_debug_handler' ); $dbh1 =& MDB2::connect($dsn1, $options); if (PEAR::isError($dbh1)) { print 'DBH1: ' . $dbh1->getMessage() . "<br>\n"; } $dbh2 =& MDB2::connect($dsn2, $options); if (PEAR::isError($dbh2)) { print 'DBH2: ' . $dbh2->getMessage() . "<br>\n"; } $result1 =& $dbh1->query('SELECT * FROM a LIMIT 1'); var_dump($result1); //$result2 =& $dbh2->query('SELECT * FROM b LIMIT 1'); //var_dump($result2); //$result3 =& $dbh1->query('SELECT * FROM a LIMIT 1'); //var_dump($result3); function db_debug_handler(&$db, $scope, $message, $is_manip = null) { // call the default handler just so that we can later call getDebugOutput return MDB2_defaultDebugOutput($db, $scope, $message, $is_manip); } ?> Expected result: ---------------- A MDB2_BufferedResult_mysql object with the contents of table 'a' in it Actual result: -------------- An MDB2_Error object with the following message: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM a LIMIT 1] [Native code: 1146] [Native message: Table 'test2.a' doesn't exist] The full backtrace is below. Notice how throughout all of it, the connected_database_name is test1 (as it should be) and not test2 (which is what it seems to use when executing the query) object(MDB2_Error)[3] public 'error_message_prefix' => string '' (length=0) public 'mode' => int 1 public 'level' => int 1024 public 'code' => int -18 public 'message' => string 'MDB2 Error: no such table' (length=25) public 'userinfo' => string '_doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM a LIMIT 1] [Native code: 1146] [Native message: Table 'test2.a' doesn't exist] ' (length=170) public 'backtrace' => array 0 => array 'file' => string '/home/bob/moo/docs/include/PEAR/MDB2.php' (length=43) 'line' => int 973 'function' => string 'PEAR_Error' (length=10) 'class' => string 'PEAR_Error' (length=10) 'object' => &object(MDB2_Error)[3] 'type' => string '->' (length=2) 'args' => array 0 => string 'MDB2 Error: no such table' (length=25) 1 => int -18 2 => int 1 3 => int 1024 4 => string '_doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM a LIMIT 1] [Native code: 1146] [Native message: Table 'test2.a' doesn't exist] ' (length=170) 1 => array 'file' => string '/home/bob/moo/docs/include/PEAR/PEAR.php' (length=43) 'line' => int 564 'function' => string 'MDB2_Error' (length=10) 'class' => string 'MDB2_Error' (length=10) 'object' => &object(MDB2_Error)[3] 'type' => string '->' (length=2) 'args' => array 0 => int -18 1 => int 1 2 => int 1024 3 => string '_doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM a LIMIT 1] [Native code: 1146] [Native message: Table 'test2.a' doesn't exist] ' (length=170) 2 => array 'file' => string '/home/bob/moo/docs/include/PEAR/MDB2.php' (length=43) 'line' => int 1442 'function' => string 'raiseError' (length=10) 'class' => string 'PEAR' (length=4) 'object' => object(MDB2_Driver_mysql)[1] public 'string_quoting' => array 'start' => string ''' (length=1) 'end' => string ''' (length=1) 'escape' => string '\' (length=1) 'escape_pattern' => string '\' (length=1) public 'identifier_quoting' => array 'start' => string '`' (length=1) 'end' => string '`' (length=1) 'escape' => string '`' (length=1) public 'sql_comments' => array 0 => array 'start' => string '-- ' (length=3) 'end' => string ' ' (length=1) 'escape' => boolean false 1 => array 'start' => string '#' (length=1) 'end' => string ' ' (length=1) 'escape' => boolean false 2 => array 'start' => string '/*' (length=2) 'end' => string '*/' (length=2) 'escape' => boolean false public 'start_transaction' => boolean true public 'varchar_max_length' => int 65532 public 'db_index' => int 1 public 'dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connected_dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connection' => resource(5, mysql link) public 'opened_persistent' => boolean false public 'database_name' => string 'test1' (length=5) public 'connected_database_name' => string 'test1' (length=5) public 'connected_server_info' => string '5.0.32-Debian_7etch8-log' (length=24) public 'supported' => array 'sequences' => string 'emulated' (length=8) 'indexes' => boolean true 'affected_rows' => boolean true 'summary_functions' => boolean true 'order_by_text' => boolean true 'transactions' => boolean true 'savepoints' => boolean true 'current_id' => string 'emulated' (length=8) 'limit_queries' => boolean true 'LOBs' => boolean true 'replace' => boolean true 'sub_selects' => boolean true 'auto_increment' => boolean true 'primary_key' => boolean true 'result_introspection' => boolean true 'prepared_statements' => boolean true 'identifier_quoting' => boolean true 'pattern_escaping' => boolean true 'new_link' => boolean true public 'options' => array 'ssl' => boolean false 'field_case' => int 0 'disable_query' => boolean false 'result_class' => string 'MDB2_Result_%s' (length=14) 'buffered_result_class' => string 'MDB2_BufferedResult_%s' (length=22) 'result_wrap_class' => boolean false 'result_buffering' => boolean true 'fetch_class' => string 'stdClass' (length=8) 'persistent' => boolean false 'debug' => boolean true 'debug_handler' => string 'moodb_debug_handler' (length=19) 'debug_expanded_output' => boolean false 'default_text_field_length' => int 4096 'lob_buffer_length' => int 8192 'log_line_break' => string ' ' (length=1) 'idxname_format' => string '%s_idx' (length=6) 'seqname_format' => string '%s_seq' (length=6) 'savepoint_format' => string 'MDB2_SAVEPOINT_%s' (length=17) 'statement_format' => string 'MDB2_STATEMENT_%1$s_%2$s' (length=24) 'seqcol_name' => string 'sequence' (length=8) 'quote_identifier' => boolean false 'use_transactions' => boolean true 'decimal_places' => int 2 'portability' => int 127 'modules' => array 'ex' => string 'Extended' (length=8) 'dt' => string 'Datatype' (length=8) 'mg' => string 'Manager' (length=7) 'rv' => string 'Reverse' (length=7) 'na' => string 'Native' (length=6) 'fc' => string 'Function' (length=8) 'emulate_prepared' => boolean false 'datatype_map' => array empty 'datatype_map_callback' => array empty 'nativetype_map_callback' => array empty 'default_table_type' => string '' (length=0) public 'wildcards' => array 0 => string '%' (length=1) 1 => string '_' (length=1) public 'as_keyword' => string ' AS ' (length=4) public 'warnings' => array empty public 'debug_output' => string 'query(1): SELECT * FROM a LIMIT 1 ' (length=34) public 'in_transaction' => null public 'nested_transaction_counter' => null public 'has_transaction_error' => boolean false public 'offset' => int 0 public 'limit' => int 0 public 'phptype' => string 'mysql' (length=5) public 'dbsyntax' => string 'mysql' (length=5) public 'last_query' => string 'SELECT * FROM a LIMIT 1' (length=23) public 'fetchmode' => int 1 public 'modules' => array empty public 'destructor_registered' => boolean true public '_debug' => boolean false public '_default_error_mode' => null public '_default_error_options' => null public '_default_error_handler' => string '' (length=0) public '_error_class' => string 'PEAR_Error' (length=10) public '_expected_errors' => array empty 'type' => string '->' (length=2) 'args' => array 0 => null 1 => int -18 2 => null 3 => null 4 => string '_doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM a LIMIT 1] [Native code: 1146] [Native message: Table 'test2.a' doesn't exist] ' (length=170) 5 => string 'MDB2_Error' (length=10) 6 => boolean true 3 => array 'file' => string '/home/bob/moo/docs/include/PEAR/MDB2/Driver/mysql.php' (length=56) 'line' => int 607 'function' => string 'raiseError' (length=10) 'class' => string 'MDB2_Driver_Common' (length=18) 'object' => object(MDB2_Driver_mysql)[1] public 'string_quoting' => array 'start' => string ''' (length=1) 'end' => string ''' (length=1) 'escape' => string '\' (length=1) 'escape_pattern' => string '\' (length=1) public 'identifier_quoting' => array 'start' => string '`' (length=1) 'end' => string '`' (length=1) 'escape' => string '`' (length=1) public 'sql_comments' => array 0 => array 'start' => string '-- ' (length=3) 'end' => string ' ' (length=1) 'escape' => boolean false 1 => array 'start' => string '#' (length=1) 'end' => string ' ' (length=1) 'escape' => boolean false 2 => array 'start' => string '/*' (length=2) 'end' => string '*/' (length=2) 'escape' => boolean false public 'start_transaction' => boolean true public 'varchar_max_length' => int 65532 public 'db_index' => int 1 public 'dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connected_dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connection' => resource(5, mysql link) public 'opened_persistent' => boolean false public 'database_name' => string 'test1' (length=5) public 'connected_database_name' => string 'test1' (length=5) public 'connected_server_info' => string '5.0.32-Debian_7etch8-log' (length=24) public 'supported' => array 'sequences' => string 'emulated' (length=8) 'indexes' => boolean true 'affected_rows' => boolean true 'summary_functions' => boolean true 'order_by_text' => boolean true 'transactions' => boolean true 'savepoints' => boolean true 'current_id' => string 'emulated' (length=8) 'limit_queries' => boolean true 'LOBs' => boolean true 'replace' => boolean true 'sub_selects' => boolean true 'auto_increment' => boolean true 'primary_key' => boolean true 'result_introspection' => boolean true 'prepared_statements' => boolean true 'identifier_quoting' => boolean true 'pattern_escaping' => boolean true 'new_link' => boolean true public 'options' => array 'ssl' => boolean false 'field_case' => int 0 'disable_query' => boolean false 'result_class' => string 'MDB2_Result_%s' (length=14) 'buffered_result_class' => string 'MDB2_BufferedResult_%s' (length=22) 'result_wrap_class' => boolean false 'result_buffering' => boolean true 'fetch_class' => string 'stdClass' (length=8) 'persistent' => boolean false 'debug' => boolean true 'debug_handler' => string 'moodb_debug_handler' (length=19) 'debug_expanded_output' => boolean false 'default_text_field_length' => int 4096 'lob_buffer_length' => int 8192 'log_line_break' => string ' ' (length=1) 'idxname_format' => string '%s_idx' (length=6) 'seqname_format' => string '%s_seq' (length=6) 'savepoint_format' => string 'MDB2_SAVEPOINT_%s' (length=17) 'statement_format' => string 'MDB2_STATEMENT_%1$s_%2$s' (length=24) 'seqcol_name' => string 'sequence' (length=8) 'quote_identifier' => boolean false 'use_transactions' => boolean true 'decimal_places' => int 2 'portability' => int 127 'modules' => array 'ex' => string 'Extended' (length=8) 'dt' => string 'Datatype' (length=8) 'mg' => string 'Manager' (length=7) 'rv' => string 'Reverse' (length=7) 'na' => string 'Native' (length=6) 'fc' => string 'Function' (length=8) 'emulate_prepared' => boolean false 'datatype_map' => array empty 'datatype_map_callback' => array empty 'nativetype_map_callback' => array empty 'default_table_type' => string '' (length=0) public 'wildcards' => array 0 => string '%' (length=1) 1 => string '_' (length=1) public 'as_keyword' => string ' AS ' (length=4) public 'warnings' => array empty public 'debug_output' => string 'query(1): SELECT * FROM a LIMIT 1 ' (length=34) public 'in_transaction' => null public 'nested_transaction_counter' => null public 'has_transaction_error' => boolean false public 'offset' => int 0 public 'limit' => int 0 public 'phptype' => string 'mysql' (length=5) public 'dbsyntax' => string 'mysql' (length=5) public 'last_query' => string 'SELECT * FROM a LIMIT 1' (length=23) public 'fetchmode' => int 1 public 'modules' => array empty public 'destructor_registered' => boolean true public '_debug' => boolean false public '_default_error_mode' => null public '_default_error_options' => null public '_default_error_handler' => string '' (length=0) public '_error_class' => string 'PEAR_Error' (length=10) public '_expected_errors' => array empty 'type' => string '->' (length=2) 'args' => array 0 => null 1 => null 2 => null 3 => string 'Could not execute statement' (length=27) 4 => string '_doQuery' (length=8) 4 => array 'file' => string '/home/bob/moo/docs/include/PEAR/MDB2.php' (length=43) 'line' => int 2514 'function' => string '_doQuery' (length=8) 'class' => string 'MDB2_Driver_mysql' (length=17) 'object' => object(MDB2_Driver_mysql)[1] public 'string_quoting' => array 'start' => string ''' (length=1) 'end' => string ''' (length=1) 'escape' => string '\' (length=1) 'escape_pattern' => string '\' (length=1) public 'identifier_quoting' => array 'start' => string '`' (length=1) 'end' => string '`' (length=1) 'escape' => string '`' (length=1) public 'sql_comments' => array 0 => array 'start' => string '-- ' (length=3) 'end' => string ' ' (length=1) 'escape' => boolean false 1 => array 'start' => string '#' (length=1) 'end' => string ' ' (length=1) 'escape' => boolean false 2 => array 'start' => string '/*' (length=2) 'end' => string '*/' (length=2) 'escape' => boolean false public 'start_transaction' => boolean true public 'varchar_max_length' => int 65532 public 'db_index' => int 1 public 'dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connected_dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connection' => resource(5, mysql link) public 'opened_persistent' => boolean false public 'database_name' => string 'test1' (length=5) public 'connected_database_name' => string 'test1' (length=5) public 'connected_server_info' => string '5.0.32-Debian_7etch8-log' (length=24) public 'supported' => array 'sequences' => string 'emulated' (length=8) 'indexes' => boolean true 'affected_rows' => boolean true 'summary_functions' => boolean true 'order_by_text' => boolean true 'transactions' => boolean true 'savepoints' => boolean true 'current_id' => string 'emulated' (length=8) 'limit_queries' => boolean true 'LOBs' => boolean true 'replace' => boolean true 'sub_selects' => boolean true 'auto_increment' => boolean true 'primary_key' => boolean true 'result_introspection' => boolean true 'prepared_statements' => boolean true 'identifier_quoting' => boolean true 'pattern_escaping' => boolean true 'new_link' => boolean true public 'options' => array 'ssl' => boolean false 'field_case' => int 0 'disable_query' => boolean false 'result_class' => string 'MDB2_Result_%s' (length=14) 'buffered_result_class' => string 'MDB2_BufferedResult_%s' (length=22) 'result_wrap_class' => boolean false 'result_buffering' => boolean true 'fetch_class' => string 'stdClass' (length=8) 'persistent' => boolean false 'debug' => boolean true 'debug_handler' => string 'moodb_debug_handler' (length=19) 'debug_expanded_output' => boolean false 'default_text_field_length' => int 4096 'lob_buffer_length' => int 8192 'log_line_break' => string ' ' (length=1) 'idxname_format' => string '%s_idx' (length=6) 'seqname_format' => string '%s_seq' (length=6) 'savepoint_format' => string 'MDB2_SAVEPOINT_%s' (length=17) 'statement_format' => string 'MDB2_STATEMENT_%1$s_%2$s' (length=24) 'seqcol_name' => string 'sequence' (length=8) 'quote_identifier' => boolean false 'use_transactions' => boolean true 'decimal_places' => int 2 'portability' => int 127 'modules' => array 'ex' => string 'Extended' (length=8) 'dt' => string 'Datatype' (length=8) 'mg' => string 'Manager' (length=7) 'rv' => string 'Reverse' (length=7) 'na' => string 'Native' (length=6) 'fc' => string 'Function' (length=8) 'emulate_prepared' => boolean false 'datatype_map' => array empty 'datatype_map_callback' => array empty 'nativetype_map_callback' => array empty 'default_table_type' => string '' (length=0) public 'wildcards' => array 0 => string '%' (length=1) 1 => string '_' (length=1) public 'as_keyword' => string ' AS ' (length=4) public 'warnings' => array empty public 'debug_output' => string 'query(1): SELECT * FROM a LIMIT 1 ' (length=34) public 'in_transaction' => null public 'nested_transaction_counter' => null public 'has_transaction_error' => boolean false public 'offset' => int 0 public 'limit' => int 0 public 'phptype' => string 'mysql' (length=5) public 'dbsyntax' => string 'mysql' (length=5) public 'last_query' => string 'SELECT * FROM a LIMIT 1' (length=23) public 'fetchmode' => int 1 public 'modules' => array empty public 'destructor_registered' => boolean true public '_debug' => boolean false public '_default_error_mode' => null public '_default_error_options' => null public '_default_error_handler' => string '' (length=0) public '_error_class' => string 'PEAR_Error' (length=10) public '_expected_errors' => array empty 'type' => string '->' (length=2) 'args' => array 0 => string 'SELECT * FROM a LIMIT 1' (length=23) 1 => boolean false 2 => resource(5, mysql link) 3 => string 'test1' (length=5) 5 => array 'file' => string '/home/bob/moo/docs/test.php' (length=30) 'line' => int 31 'function' => string 'query' (length=5) 'class' => string 'MDB2_Driver_Common' (length=18) 'object' => object(MDB2_Driver_mysql)[1] public 'string_quoting' => array 'start' => string ''' (length=1) 'end' => string ''' (length=1) 'escape' => string '\' (length=1) 'escape_pattern' => string '\' (length=1) public 'identifier_quoting' => array 'start' => string '`' (length=1) 'end' => string '`' (length=1) 'escape' => string '`' (length=1) public 'sql_comments' => array 0 => array 'start' => string '-- ' (length=3) 'end' => string ' ' (length=1) 'escape' => boolean false 1 => array 'start' => string '#' (length=1) 'end' => string ' ' (length=1) 'escape' => boolean false 2 => array 'start' => string '/*' (length=2) 'end' => string '*/' (length=2) 'escape' => boolean false public 'start_transaction' => boolean true public 'varchar_max_length' => int 65532 public 'db_index' => int 1 public 'dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connected_dsn' => array 'phptype' => string 'mysql' (length=5) 'dbsyntax' => string 'mysql' (length=5) 'username' => string 'bob' (length=6) 'password' => string 'buttons' (length=9) 'protocol' => string 'tcp' (length=3) 'hostspec' => string 'localhost' (length=9) 'port' => boolean false 'socket' => boolean false 'database' => boolean false 'mode' => boolean false public 'connection' => resource(5, mysql link) public 'opened_persistent' => boolean false public 'database_name' => string 'test1' (length=5) public 'connected_database_name' => string 'test1' (length=5) public 'connected_server_info' => string '5.0.32-Debian_7etch8-log' (length=24) public 'supported' => array 'sequences' => string 'emulated' (length=8) 'indexes' => boolean true 'affected_rows' => boolean true 'summary_functions' => boolean true 'order_by_text' => boolean true 'transactions' => boolean true 'savepoints' => boolean true 'current_id' => string 'emulated' (length=8) 'limit_queries' => boolean true 'LOBs' => boolean true 'replace' => boolean true 'sub_selects' => boolean true 'auto_increment' => boolean true 'primary_key' => boolean true 'result_introspection' => boolean true 'prepared_statements' => boolean true 'identifier_quoting' => boolean true 'pattern_escaping' => boolean true 'new_link' => boolean true public 'options' => array 'ssl' => boolean false 'field_case' => int 0 'disable_query' => boolean false 'result_class' => string 'MDB2_Result_%s' (length=14) 'buffered_result_class' => string 'MDB2_BufferedResult_%s' (length=22) 'result_wrap_class' => boolean false 'result_buffering' => boolean true 'fetch_class' => string 'stdClass' (length=8) 'persistent' => boolean false 'debug' => boolean true 'debug_handler' => string 'moodb_debug_handler' (length=19) 'debug_expanded_output' => boolean false 'default_text_field_length' => int 4096 'lob_buffer_length' => int 8192 'log_line_break' => string ' ' (length=1) 'idxname_format' => string '%s_idx' (length=6) 'seqname_format' => string '%s_seq' (length=6) 'savepoint_format' => string 'MDB2_SAVEPOINT_%s' (length=17) 'statement_format' => string 'MDB2_STATEMENT_%1$s_%2$s' (length=24) 'seqcol_name' => string 'sequence' (length=8) 'quote_identifier' => boolean false 'use_transactions' => boolean true 'decimal_places' => int 2 'portability' => int 127 'modules' => array 'ex' => string 'Extended' (length=8) 'dt' => string 'Datatype' (length=8) 'mg' => string 'Manager' (length=7) 'rv' => string 'Reverse' (length=7) 'na' => string 'Native' (length=6) 'fc' => string 'Function' (length=8) 'emulate_prepared' => boolean false 'datatype_map' => array empty 'datatype_map_callback' => array empty 'nativetype_map_callback' => array empty 'default_table_type' => string '' (length=0) public 'wildcards' => array 0 => string '%' (length=1) 1 => string '_' (length=1) public 'as_keyword' => string ' AS ' (length=4) public 'warnings' => array empty public 'debug_output' => string 'query(1): SELECT * FROM a LIMIT 1 ' (length=34) public 'in_transaction' => null public 'nested_transaction_counter' => null public 'has_transaction_error' => boolean false public 'offset' => int 0 public 'limit' => int 0 public 'phptype' => string 'mysql' (length=5) public 'dbsyntax' => string 'mysql' (length=5) public 'last_query' => string 'SELECT * FROM a LIMIT 1' (length=23) public 'fetchmode' => int 1 public 'modules' => array empty public 'destructor_registered' => boolean true public '_debug' => boolean false public '_default_error_mode' => null public '_default_error_options' => null public '_default_error_handler' => string '' (length=0) public '_error_class' => string 'PEAR_Error' (length=10) public '_expected_errors' => array empty 'type' => string '->' (length=2) 'args' => array 0 => string 'SELECT * FROM a LIMIT 1' (length=23) public 'callback' => null

Comments

 [2008-12-05 13:18 UTC] c0ntax (Dan Burzynski)
Sorry to reopen this, but have a try of the script below with persistent connections set to true. Even with new_link=true in the DSN it still exhibits the same erronious behaviour of running the first query against the second database handle.
 [2010-03-02 15:42 UTC] doconnor (Daniel O'Connor)
I can't tell: is this because MDB2 uses a bunch of static methods and global state, or persistent connections causing global state behaviour ?
 [2010-06-10 14:40 UTC] alec (Aleksander Machniak)
Works for me with "?new_link=true" added to $dsn2. Tested with pgsql driver and 2.4.1/2.5.0-svn versions. This ticket should be closed.
 [2010-07-14 07:54 UTC] phreek_11 (jonny jonny)
Still doesnt work for me. I have persistent and new_link set to true. I have the latest MDB2 packages (with mssql) and PHP 5.2.5. When switching between 2 connections on 2 different servers it works fine, but when switching between two different databases on the same server (and different username/passwords) it does not work.
 [2011-09-05 00:16 UTC] ghada (ghada el)
We're FINALLY migrating from DB to MDB2. We are now running into this same issue with the database connections. We have several database connections: 1. MSSQL - 2 connections to 2 different databases on the same box (DB1, DB2). 2. MySql - 1 connection to 1 database (DB3). 3. PgSql - 1 connection to 1 database (DB4). The MySql and the PgSql databases are on the same box. The MSSQL databases are on a different box to the MySql and PgSql databases. We've tried the 'new-link=true' on the DSN. We've tried using the: - factory() - connect() - singleton() None of them work when we switch between the databases. i.e. (this could be any query) 1. Run Query1 on MSSQL DB1 2. Run Query2 on MySql DB3 3. Run Query3 on MSSQL DB2 - this generates the error "MDB2 Error: no such table". We have the latest MDB2 (2.4.1) and php (5.3.1). Has this issue been resolved or is there some "trick" that we're missing?
 [2012-10-24 19:05 UTC] danielc (Daniel Convissor)
-Status: Assigned +Status: Bogus -Assigned To: quipo +Assigned To: danielc
In SVN commit r328127, I added a testBug15232() method in tests/Standard/BugsTest.php. The test passes (I used mysql, mysqli, and pgsql) when running the against the beta release that came out yesterday (2.5.0b4). Not sure if the beta fixed the release the users are running or if there are overriding factors in the users' code or environment that are/were causing the problems. Marking this "bogus" so it doesn't show up as fixed when generating the next release.