OSDN Git Service

Update project date from '2002 - 2009' to '2002 - 2010'.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / mysql.php
1 <?php
2
3 /*
4  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
5  * Copyright (C) 2002-2010 The Nucleus Group
6  *
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)
12  */
13 /**
14  * @license http://nucleuscms.org/license.txt GNU General Public License
15  * @copyright Copyright (C) 2002-2010 The Nucleus Group
16  * @version $Id$
17  * @version $NucleusJP: mysql.php,v 1.2 2006/07/20 08:01:52 kimitake Exp $
18  */
19  
20 /*
21  * if no mysql_* functions exist, define wrappers
22  */
23  
24 $MYSQL_CONN = 0;
25
26 if (!function_exists('mysql_query'))
27 {
28         if (!function_exists('mysqli_query') && function_exists('startUpError'))
29         {
30                 startUpError(_NO_SUITABLE_MYSQL_LIBRARY);
31         }
32         
33         function mysql_query($query) 
34         {
35                 global $MYSQL_CONN;
36                 return mysqli_query($MYSQL_CONN, $query); 
37         }
38         
39         function mysql_fetch_object($res) 
40         { 
41                 return mysqli_fetch_object($res);
42         }
43         
44         function mysql_fetch_array($res) 
45         { 
46                 return mysqli_fetch_array($res);
47         }       
48         
49         function mysql_fetch_assoc($res) 
50         { 
51                 return mysqli_fetch_assoc($res);
52         }       
53
54         function mysql_fetch_row($res) 
55         { 
56                 return mysqli_fetch_row($res);
57         }       
58
59         function mysql_num_rows($res)
60         {
61                 return mysqli_num_rows($res);
62         }
63         
64         function mysql_num_fields($res)
65         {
66                 return mysqli_num_fields($res);
67         }
68         
69         function mysql_free_result($res)
70         {
71                 return mysqli_free_result($res);
72         }
73         
74         function mysql_result($res, $row, $col) 
75         { 
76                 if (($row != 0) || ($col != 0)) {
77                         trigger_error('not implemented', E_USER_ERROR);
78                 }
79                 
80                 $row = mysqli_fetch_row($res);
81                 return $row[$col];
82         }       
83         
84         function mysql_connect($host, $username, $pwd)
85         {
86                 return mysqli_connect($host, $username, $pwd);
87         }
88         
89         function mysql_error()
90         {
91                 global $MYSQL_CONN;
92                 return mysqli_error($MYSQL_CONN);
93         }
94         
95         function mysql_select_db($db)
96         {
97                 global $MYSQL_CONN;
98                 return mysqli_select_db($MYSQL_CONN, $db);
99         }
100         
101         function mysql_close()
102         {
103                 global $MYSQL_CONN;
104                 return mysqli_close($MYSQL_CONN);
105         }
106         
107         function mysql_insert_id()
108         {
109                 global $MYSQL_CONN;
110                 return mysqli_insert_id($MYSQL_CONN);
111         }
112         
113         function mysql_affected_rows()
114         {
115                 global $MYSQL_CONN;
116                 return mysqli_affected_rows($MYSQL_CONN);
117         }
118 }
119
120
121
122 ?>