equal
deleted
inserted
replaced
421 $db_sql_parse_time += $ts; |
421 $db_sql_parse_time += $ts; |
422 return true; |
422 return true; |
423 } |
423 } |
424 |
424 |
425 /** |
425 /** |
426 * Set the internal result pointer to X |
|
427 * @param int $pos The number of the row |
|
428 * @param resource $result The MySQL result resource - if not given, the latest cached query is assumed |
|
429 * @return true on success, false on failure |
|
430 */ |
|
431 |
|
432 function sql_data_seek($pos, $result = false) |
|
433 { |
|
434 if ( !$result ) |
|
435 $result = $this->latest_result; |
|
436 if ( !$result ) |
|
437 return false; |
|
438 |
|
439 return mysql_data_seek($result, $pos) ? true : false; |
|
440 } |
|
441 |
|
442 /** |
|
443 * Reports a bad query to the admin |
426 * Reports a bad query to the admin |
444 * @param string $query the naughty query |
427 * @param string $query the naughty query |
445 * @access private |
428 * @access private |
446 */ |
429 */ |
447 |
430 |
554 if ( !$result ) |
537 if ( !$result ) |
555 return null; |
538 return null; |
556 |
539 |
557 @mysql_free_result($result); |
540 @mysql_free_result($result); |
558 return null; |
541 return null; |
559 } |
|
560 |
|
561 /** |
|
562 * Returns the number of rows affected. |
|
563 * @return int |
|
564 */ |
|
565 |
|
566 function sql_affectedrows() |
|
567 { |
|
568 return mysql_affected_rows($this->_conn); |
|
569 } |
542 } |
570 |
543 |
571 /** |
544 /** |
572 * Get MySQL server version |
545 * Get MySQL server version |
573 * @return string |
546 * @return string |
1082 $db_sql_parse_time += $ts; |
1055 $db_sql_parse_time += $ts; |
1083 return true; |
1056 return true; |
1084 } |
1057 } |
1085 |
1058 |
1086 /** |
1059 /** |
1087 * Set the internal result pointer to X |
|
1088 * @param int $pos The number of the row |
|
1089 * @param resource $result The MySQL result resource - if not given, the latest cached query is assumed |
|
1090 * @return true on success, false on failure |
|
1091 */ |
|
1092 |
|
1093 function sql_data_seek($pos, $result = false) |
|
1094 { |
|
1095 if ( !$result ) |
|
1096 $result = $this->latest_result; |
|
1097 if ( !$result ) |
|
1098 return false; |
|
1099 |
|
1100 return mysql_data_seek($result, $pos) ? true : false; |
|
1101 } |
|
1102 |
|
1103 /** |
|
1104 * Reports a bad query to the admin |
1060 * Reports a bad query to the admin |
1105 * @param string $query the naughty query |
1061 * @param string $query the naughty query |
1106 * @access private |
1062 * @access private |
1107 */ |
1063 */ |
1108 |
1064 |
1220 if ( !$result ) |
1176 if ( !$result ) |
1221 return null; |
1177 return null; |
1222 |
1178 |
1223 //@mysql_free_result($result); |
1179 //@mysql_free_result($result); |
1224 return null; |
1180 return null; |
1225 } |
|
1226 |
|
1227 /** |
|
1228 * Returns the number of rows affected. |
|
1229 * @return int |
|
1230 */ |
|
1231 |
|
1232 function sql_affectedrows() |
|
1233 { |
|
1234 return mysql_affected_rows($this->_conn); |
|
1235 } |
1181 } |
1236 |
1182 |
1237 /** |
1183 /** |
1238 * Get MySQL server version |
1184 * Get MySQL server version |
1239 * @return string |
1185 * @return string |
1253 */ |
1199 */ |
1254 |
1200 |
1255 function close() |
1201 function close() |
1256 { |
1202 { |
1257 // anything we locked should certainly be unlocked now; |
1203 // anything we locked should certainly be unlocked now; |
1258 @mysql_query("COMMIT;", $this->_conn); |
1204 $this->sql_query("COMMIT;", $this->_conn); |
1259 @mysql_query("UNLOCK TABLES;", $this->_conn); |
1205 $this->sql_query("UNLOCK TABLES;", $this->_conn); |
1260 @mysql_close($this->_conn); |
|
1261 unset($this->_conn); |
1206 unset($this->_conn); |
1262 } |
1207 } |
1263 |
1208 |
1264 /** |
1209 /** |
1265 * Get a list of columns in the given table |
1210 * Get a list of columns in the given table |
1686 } |
1631 } |
1687 |
1632 |
1688 $ts = microtime_float() - $ts; |
1633 $ts = microtime_float() - $ts; |
1689 $db_sql_parse_time += $ts; |
1634 $db_sql_parse_time += $ts; |
1690 return true; |
1635 return true; |
1691 } |
|
1692 |
|
1693 /** |
|
1694 * Set the internal result pointer to X |
|
1695 * @param int $pos The number of the row |
|
1696 * @param resource $result The PostgreSQL result resource - if not given, the latest cached query is assumed |
|
1697 * @return true on success, false on failure |
|
1698 */ |
|
1699 |
|
1700 function sql_data_seek($pos, $result = false) |
|
1701 { |
|
1702 if ( !$result ) |
|
1703 $result = $this->latest_result; |
|
1704 if ( !$result ) |
|
1705 return false; |
|
1706 |
|
1707 return pg_result_seek($result, $pos) ? true : false; |
|
1708 } |
1636 } |
1709 |
1637 |
1710 /** |
1638 /** |
1711 * Reports a bad query to the admin |
1639 * Reports a bad query to the admin |
1712 * @param string $query the naughty query |
1640 * @param string $query the naughty query |
1919 return ( defined('IN_ENANO_INSTALL') ) ? $GLOBALS["lang"]->get('dbpgsql_msg_err_auth') : 'Access to the database was denied. Ensure that your database exists and that your username and password are correct.'; |
1847 return ( defined('IN_ENANO_INSTALL') ) ? $GLOBALS["lang"]->get('dbpgsql_msg_err_auth') : 'Access to the database was denied. Ensure that your database exists and that your username and password are correct.'; |
1920 } |
1848 } |
1921 } |
1849 } |
1922 |
1850 |
1923 /** |
1851 /** |
1924 * Returns the number of rows affected. |
|
1925 * @return int |
|
1926 */ |
|
1927 |
|
1928 function sql_affectedrows() |
|
1929 { |
|
1930 return pg_affected_rows($this->latest_result); |
|
1931 } |
|
1932 |
|
1933 /** |
|
1934 * Generates and outputs a report of all the SQL queries made during execution. Should only be called after everything's over with. |
1852 * Generates and outputs a report of all the SQL queries made during execution. Should only be called after everything's over with. |
1935 */ |
1853 */ |
1936 |
1854 |
1937 function sql_report() |
1855 function sql_report() |
1938 { |
1856 { |