OSDN Git Service

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