4 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
5 * Copyright (C) 2002-2006 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-2006 The Nucleus Group
16 * @version $Id: mysql.php,v 1.1 2006-07-12 07:13:31 kimitake Exp $
20 * if no mysql_* functions exist, define wrappers
25 if (!function_exists('mysql_query'))
27 if (!function_exists('mysqli_query') && function_exists('startUpError'))
29 startUpError('<p>No suitable mySQL library was found to run Nucleus</p>');
32 function mysql_query($query)
35 return mysqli_query($MYSQL_CONN, $query);
38 function mysql_fetch_object($res)
40 return mysqli_fetch_object($res);
43 function mysql_fetch_array($res)
45 return mysqli_fetch_array($res);
48 function mysql_fetch_assoc($res)
50 return mysqli_fetch_assoc($res);
53 function mysql_fetch_row($res)
55 return mysqli_fetch_row($res);
58 function mysql_num_rows($res)
60 return mysqli_num_rows($res);
63 function mysql_num_fields($res)
65 return mysqli_num_fields($res);
68 function mysql_free_result($res)
70 return mysqli_free_result($res);
73 function mysql_result($res, $row, $col)
75 if (($row != 0) || ($col != 0)) {
76 trigger_error('not implemented', E_USER_ERROR);
79 $row = mysqli_fetch_row($res);
83 function mysql_connect($host, $username, $pwd)
85 return mysqli_connect($host, $username, $pwd);
88 function mysql_error()
91 return mysqli_error($MYSQL_CONN);
94 function mysql_select_db($db)
97 return mysqli_select_db($MYSQL_CONN, $db);
100 function mysql_close()
103 return mysqli_close($MYSQL_CONN);
106 function mysql_insert_id()
109 return mysqli_insert_id($MYSQL_CONN);
112 function mysql_affected_rows()
115 return mysqli_affected_rows($MYSQL_CONN);