Database

Currently only MySQL, MySQLi and PDO are supported, but it would be easy to add more.

IMPORTANT: Prepared statements are executed by this plugin! Note that result sets are exhausted after dumping them.

PDO can display the SQL statement as well, but this information cannot be retrieved from the older ways of querying DB's.

visit HLI#X
1. pre($result) type: PDOStatement (object)
in builder\plugins\dbDump.php on line 24
*** SQL statement ***
SELECT * FROM help_topic LIMIT 0,5
*** Row ****** help_topic_id ****** name ****** help_category_id ****** description ****** example ****** url ***
*** 0 ***0JOIN6MySQL supports the following JOIN syntaxes for the *** length: 849 ***mysql> SELECT table1.* FROM table1 -> L *** length: 127 *** 
*** 1 ***1HEX23 HEX(N_or_S) If N_OR_S is a number, returns a s *** length: 337 ***mysql> SELECT HEX(255); -> 'FF' mysql> SEL *** length: 124 *** 
*** 2 ***2REPLACE23 REPLACE(str,from_str,to_str) Returns the string *** length: 130 ***mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww'); -> 'WwWwWw.mysql.com' 
*** 3 ***3REPEAT23 REPEAT(str,count) Returns a string consisting o *** length: 168 ***mysql> SELECT REPEAT('MySQL', 3); -> 'MySQLMySQLMySQL' 
*** 4 ***4CONTAINS11 Contains(g1,g2) Returns 1 or 0 to indicate whether or not g1 completely contains g2.   
*** global scope ***

Note that simply passing the result object/resource will not display error messages comming from DB as the result set will be false if the statement could not be executed (this is not true for PDO prepared statements). But you can pass the connection object/resource to get information about that, including any error message.

visit HLI#X
2. pre($result) type: boolean
in builder\plugins\dbDump.php on line 35
false
*** global scope ***
visit HLI#X
3. pre($pdo) type: PDO (object)
*** error info ***
Table 'mysql.somewhere' doesn't exist, 1146 (driver), 42S02 (SQLSTATE)
*** last insert ID ***
'0'
*** autocommit ***
1
*** case ***
0
*** client version ***
'5.0.27'
*** connection status ***
'localhost via TCP/IP'
*** driver name ***
'mysql'
*** errmode ***
0
*** oracle nulls ***
0
*** persistent ***
false
*** prefetch ***
false
*** server stat ***
'Uptime: 68402 Threads: 4 Questions: 95 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 1 Queries per second avg: 0.001'
*** server version ***
'5.0.27-community-nt'
*** timeout ***
false

It's easier with prepared statements:

visit HLI#X
4. pre($stmt) type: PDOStatement (object)
in builder\plugins\dbDump.php on line 42
*** SQL statement ***
SELECT something FROM somewhere
*** SQL error ***
Table 'mysql.somewhere' doesn't exist, 1146 (driver), 42S02 (SQLSTATE)
*** global scope ***

The same querys done with mysql-extension and a persistent connection:

visit HLI#X
5. pre($result) type: mysql result (resource)
in builder\plugins\dbDump.php on line 52
*** Row ****** help_topic_id ****** name ****** help_category_id ****** description ****** example ****** url ***
*** 0 ***0JOIN6MySQL supports the following JOIN syntaxes for the *** length: 849 ***mysql> SELECT table1.* FROM table1 -> L *** length: 127 *** 
*** 1 ***1HEX23 HEX(N_or_S) If N_OR_S is a number, returns a s *** length: 337 ***mysql> SELECT HEX(255); -> 'FF' mysql> SEL *** length: 124 *** 
*** 2 ***2REPLACE23 REPLACE(str,from_str,to_str) Returns the string *** length: 130 ***mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww'); -> 'WwWwWw.mysql.com' 
*** 3 ***3REPEAT23 REPEAT(str,count) Returns a string consisting o *** length: 168 ***mysql> SELECT REPEAT('MySQL', 3); -> 'MySQLMySQLMySQL' 
*** 4 ***4CONTAINS11 Contains(g1,g2) Returns 1 or 0 to indicate whether or not g1 completely contains g2.   
*** global scope ***
visit HLI#X
6. pre($result) type: boolean
in builder\plugins\dbDump.php on line 55
false
*** global scope ***
visit HLI#X
7. pre($mysql) type: mysql link persistent (resource)
*** statement info ***
false
*** error info ***
Table 'mysql.somewhere' doesn't exist, 1146 (driver)
*** last insert ID ***
0
*** client version ***
'5.0.27'
*** client encoding ***
'latin1'
*** host ***
'localhost via TCP/IP'
*** protocol ***
10
*** persistent ***
true
*** server stat ***
'Uptime: 68402 Threads: 4 Questions: 99 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 1 Queries per second avg: 0.001'
*** server version ***
'5.0.27-community-nt'

The same querys done with mysqli-extension:

visit HLI#X
8. pre($result) type: mysqli_result (object)
in builder\plugins\dbDump.php on line 64
*** Row ****** help_topic_id ****** name ****** help_category_id ****** description ****** example ****** url ***
*** 0 ***0JOIN6MySQL supports the following JOIN syntaxes for the *** length: 849 ***mysql> SELECT table1.* FROM table1 -> L *** length: 127 *** 
*** 1 ***1HEX23 HEX(N_or_S) If N_OR_S is a number, returns a s *** length: 337 ***mysql> SELECT HEX(255); -> 'FF' mysql> SEL *** length: 124 *** 
*** 2 ***2REPLACE23 REPLACE(str,from_str,to_str) Returns the string *** length: 130 ***mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww'); -> 'WwWwWw.mysql.com' 
*** 3 ***3REPEAT23 REPEAT(str,count) Returns a string consisting o *** length: 168 ***mysql> SELECT REPEAT('MySQL', 3); -> 'MySQLMySQLMySQL' 
*** 4 ***4CONTAINS11 Contains(g1,g2) Returns 1 or 0 to indicate whether or not g1 completely contains g2.   
*** global scope ***
visit HLI#X
9. pre($result) type: boolean
in builder\plugins\dbDump.php on line 67
false
*** global scope ***
visit HLI#X
10. pre($mysqli) type: mysqli (object)
*** statement info ***
NULL
*** error info ***
Table 'mysql.somewhere' doesn't exist, 1146 (driver), 42S02 (SQLSTATE)
*** last insert ID ***
0
*** client version ***
'5.0.27'
*** client encoding ***
'latin1'
*** host ***
'localhost via TCP/IP'
*** protocol ***
10
*** server stat ***
'Uptime: 68403 Threads: 5 Questions: 101 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 1 Queries per second avg: 0.001'
*** server version ***
'5.0.27-community-nt'

As prepared statements in mysqli work differently from PDO, it is not possible to have the nice error messages here. Also, I haven't found a way to display the column names. Any idea would be appreciated.

visit HLI#X
11. pre($stmt) type: mysqli_stmt (object)
in builder\plugins\dbDump.php on line 78
*** Row ****** 0 ****** 1 ****** 2 ****** 3 ****** 4 ****** 5 ***
*** 0 ***1HEX23 HEX(N_or_S) If N_OR_S is a number, returns a s *** length: 337 ***mysql> SELECT HEX(255); -> 'FF' mysql> SEL *** length: 124 *** 
*** 1 ***2REPLACE23 REPLACE(str,from_str,to_str) Returns the string *** length: 130 ***mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww'); -> 'WwWwWw.mysql.com' 
*** 2 ***3REPEAT23 REPEAT(str,count) Returns a string consisting o *** length: 168 ***mysql> SELECT REPEAT('MySQL', 3); -> 'MySQLMySQLMySQL' 
*** 3 ***9CONCAT23 CONCAT(str1,str2,...) Returns the string that r *** length: 385 ***mysql> SELECT CONCAT('My', 'S', 'QL'); -> *** length: 159 *** 
*** 4 ***11CHAR FUNCTION23 CHAR(N,...) CHAR() interprets the arguments as *** length: 178 ***mysql> SELECT CHAR(77,121,83,81,'76'); -> *** length: 110 *** 
*** global scope ***
HLI