03-31-2014, 10:14 PM
Hey there, I'm committing a PDO_mysql database connector into the working copy.
Some issues: DB_data_seek() doesn't work properly for PDO. It's emulated by fetching all the rows and then returning the desired row. This is obviously inefficient, and 99% of the time DB_data_seek() is used to return to the first row, just to get the first rows results. I suggest rewriting the code to avoid the need to return to the first row in the first place-- aka trying not to rely on DB_data_seek(). It's not possible to move the pointer with PDO Mysql so it's just not going to work properly (although it could theoretically be implemented with other DB's the installation code has mysql-specific code right now, so other installations can't be supported yet)
Similarly, DB_num_rows() doesn't work properly with PDO. It works for MySQL but is not guaranteed to work for other DB's. Usually but not always it is used to check if results were returned. I suggest using columnCount (mysqli->field_count) which will be > 1 if there is a result set. For the 2 or 3 legitimate uses of DB_num_rows() to count the number of rows, I'd suggest using an iterator instead.
Also, DB_fetch_row and DB_fetch_array are not used consistently, sometimes DB_fetch_row expects an associative array of field names, sometimes a numeric zero-based array, the same for DB_fetch_array. I recommend DB_fetch_row expecting both, and DB_fetch_array expecting a zero-based array only.
Some issues: DB_data_seek() doesn't work properly for PDO. It's emulated by fetching all the rows and then returning the desired row. This is obviously inefficient, and 99% of the time DB_data_seek() is used to return to the first row, just to get the first rows results. I suggest rewriting the code to avoid the need to return to the first row in the first place-- aka trying not to rely on DB_data_seek(). It's not possible to move the pointer with PDO Mysql so it's just not going to work properly (although it could theoretically be implemented with other DB's the installation code has mysql-specific code right now, so other installations can't be supported yet)
Similarly, DB_num_rows() doesn't work properly with PDO. It works for MySQL but is not guaranteed to work for other DB's. Usually but not always it is used to check if results were returned. I suggest using columnCount (mysqli->field_count) which will be > 1 if there is a result set. For the 2 or 3 legitimate uses of DB_num_rows() to count the number of rows, I'd suggest using an iterator instead.
Also, DB_fetch_row and DB_fetch_array are not used consistently, sometimes DB_fetch_row expects an associative array of field names, sometimes a numeric zero-based array, the same for DB_fetch_array. I recommend DB_fetch_row expecting both, and DB_fetch_array expecting a zero-based array only.