3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Functions to wrap around MySQL database functions. This is basically made
8 * to allow charset conversion, but later may be useful for other stuff.
13 if (!defined('PMA_MYSQL_WRAPPERS_LIB_INCLUDED')){
14 define('PMA_MYSQL_WRAPPERS_LIB_INCLUDED', 1);
16 function PMA_mysql_dbname($result, $row, $field = FALSE) {
17 if ($field != FALSE) {
18 return PMA_convert_display_charset(mysql_dbname($result, $row, $field));
20 return PMA_convert_display_charset(mysql_dbname($result, $row));
24 function PMA_mysql_error($id = FALSE) {
26 return PMA_convert_display_charset(mysql_error($id));
28 return PMA_convert_display_charset(mysql_error());
32 function PMA_mysql_fetch_array($result, $type = FALSE) {
34 return PMA_convert_display_charset(mysql_fetch_array($result, $type));
36 return PMA_convert_display_charset(mysql_fetch_array($result));
40 function PMA_mysql_fetch_field($result , $field_offset = FALSE) {
41 if ($field_offset != FALSE) {
42 return PMA_convert_display_charset(mysql_fetch_field($result, $field_offset));
44 return PMA_convert_display_charset(mysql_fetch_field($result));
48 function PMA_mysql_fetch_object($result) {
49 return PMA_convert_display_charset(mysql_fetch_object($result));
52 function PMA_mysql_fetch_row($result) {
53 return PMA_convert_display_charset(mysql_fetch_row($result));
56 function PMA_mysql_field_flags($result, $field_offset) {
57 return PMA_convert_display_charset(mysql_field_flags($result, $field_offset));
60 function PMA_mysql_field_name($result, $field_index) {
61 return PMA_convert_display_charset(mysql_field_name($result, $field_index));
64 function PMA_mysql_field_type($result, $field_index) {
65 return PMA_convert_display_charset(mysql_field_type($result, $field_index));
68 function PMA_mysql_list_fields($database_name, $table_name, $link_identifier = FALSE) {
69 if ($link_identifier != FALSE) {
70 return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name), $link_identifier);
72 return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name));
76 function PMA_mysql_list_tables($database_name, $link_identifier = FALSE) {
77 if ($link_identifier != FALSE) {
78 return mysql_list_tables(PMA_convert_charset($database_name), $link_identifier);
80 return mysql_list_tables(PMA_convert_charset($database_name));
84 function PMA_mysql_query($query, $link_identifier = FALSE, $result_mode = FALSE) {
85 if ($link_identifier != FALSE) {
86 if ($result_mode != FALSE) {
87 return mysql_query(PMA_convert_charset($query), $link_identifier, $result_mode);
89 return mysql_query(PMA_convert_charset($query), $link_identifier);
92 return mysql_query(PMA_convert_charset($query));
96 function PMA_mysql_result($result, $row, $field = FALSE) {
97 if ($field != FALSE) {
98 return PMA_convert_display_charset(mysql_result($result, $row, PMA_convert_charset($field)));
100 return PMA_convert_display_charset(mysql_result($result, $row));
104 function PMA_mysql_select_db($database_name, $link_identifier = FALSE) {
105 if ($link_identifier != FALSE) {
106 return mysql_select_db(PMA_convert_charset($database_name), $link_identifier);
108 return mysql_select_db(PMA_convert_charset($database_name));
112 function PMA_mysql_tablename($result, $i) {
113 return PMA_convert_display_charset(mysql_tablename($result, $i));
117 } // PMA_MYSQL_WRAPPERS_LIB_INCLUDED