mysql.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
00005  * Copyright (C) 2002-2007 The Nucleus Group
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * (see nucleus/documentation/index.html#license for more info)
00012  */
00020 /*
00021  * if no mysql_* functions exist, define wrappers
00022  */
00023  
00024 $MYSQL_CONN = 0;
00025 
00026 if (!function_exists('mysql_query'))
00027 {
00028         if (!function_exists('mysqli_query') && function_exists('startUpError'))
00029         {
00030                 startUpError('<p>No suitable mySQL library was found to run Nucleus</p>');
00031         }
00032         
00033         function mysql_query($query) 
00034         {
00035                 global $MYSQL_CONN;
00036                 return mysqli_query($MYSQL_CONN, $query); 
00037         }
00038         
00039         function mysql_fetch_object($res) 
00040         { 
00041                 return mysqli_fetch_object($res);
00042         }
00043         
00044         function mysql_fetch_array($res) 
00045         { 
00046                 return mysqli_fetch_array($res);
00047         }       
00048         
00049         function mysql_fetch_assoc($res) 
00050         { 
00051                 return mysqli_fetch_assoc($res);
00052         }       
00053 
00054         function mysql_fetch_row($res) 
00055         { 
00056                 return mysqli_fetch_row($res);
00057         }       
00058 
00059         function mysql_num_rows($res)
00060         {
00061                 return mysqli_num_rows($res);
00062         }
00063         
00064         function mysql_num_fields($res)
00065         {
00066                 return mysqli_num_fields($res);
00067         }
00068         
00069         function mysql_free_result($res)
00070         {
00071                 return mysqli_free_result($res);
00072         }
00073         
00074         function mysql_result($res, $row, $col) 
00075         { 
00076                 if (($row != 0) || ($col != 0)) {
00077                         trigger_error('not implemented', E_USER_ERROR);
00078                 }
00079                 
00080                 $row = mysqli_fetch_row($res);
00081                 return $row[$col];
00082         }       
00083         
00084         function mysql_connect($host, $username, $pwd)
00085         {
00086                 return mysqli_connect($host, $username, $pwd);
00087         }
00088         
00089         function mysql_error()
00090         {
00091                 global $MYSQL_CONN;
00092                 return mysqli_error($MYSQL_CONN);
00093         }
00094         
00095         function mysql_select_db($db)
00096         {
00097                 global $MYSQL_CONN;
00098                 return mysqli_select_db($MYSQL_CONN, $db);
00099         }
00100         
00101         function mysql_close()
00102         {
00103                 global $MYSQL_CONN;
00104                 return mysqli_close($MYSQL_CONN);
00105         }
00106         
00107         function mysql_insert_id()
00108         {
00109                 global $MYSQL_CONN;
00110                 return mysqli_insert_id($MYSQL_CONN);
00111         }
00112         
00113         function mysql_affected_rows()
00114         {
00115                 global $MYSQL_CONN;
00116                 return mysqli_affected_rows($MYSQL_CONN);
00117         }
00118 }
00119 
00120 
00121 
00122 ?>



Generated on Wed Jun 25 17:25:59 2008 by  doxygen 1.5.5