4 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
5 * Copyright (C) 2002-2010 The Nucleus Group
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * (see nucleus/documentation/index.html#license for more info)
14 * @license http://nucleuscms.org/license.txt GNU General Public License
15 * @copyright Copyright (C) 2002-2010 The Nucleus Group
17 * @version $NucleusJP: mysql.php,v 1.2 2006/07/20 08:01:52 kimitake Exp $
21 * if no mysql_* functions exist, define wrappers
26 if (!function_exists('mysql_query'))
28 if (!function_exists('mysqli_query') && function_exists('startUpError'))
30 startUpError(_NO_SUITABLE_MYSQL_LIBRARY);
33 function mysql_query($query)
36 return mysqli_query($MYSQL_CONN, $query);
39 function mysql_fetch_object($res)
41 return mysqli_fetch_object($res);
44 function mysql_fetch_array($res)
46 return mysqli_fetch_array($res);
49 function mysql_fetch_assoc($res)
51 return mysqli_fetch_assoc($res);
54 function mysql_fetch_row($res)
56 return mysqli_fetch_row($res);
59 function mysql_num_rows($res)
61 return mysqli_num_rows($res);
64 function mysql_num_fields($res)
66 return mysqli_num_fields($res);
69 function mysql_free_result($res)
71 return mysqli_free_result($res);
74 function mysql_result($res, $row, $col)
76 if (($row != 0) || ($col != 0)) {
77 trigger_error('not implemented', E_USER_ERROR);
80 $row = mysqli_fetch_row($res);
84 function mysql_connect($host, $username, $pwd)
86 return mysqli_connect($host, $username, $pwd);
89 function mysql_error()
92 return mysqli_error($MYSQL_CONN);
95 function mysql_select_db($db)
98 return mysqli_select_db($MYSQL_CONN, $db);
101 function mysql_close()
104 return mysqli_close($MYSQL_CONN);
107 function mysql_insert_id()
110 return mysqli_insert_id($MYSQL_CONN);
113 function mysql_affected_rows()
116 return mysqli_affected_rows($MYSQL_CONN);