GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — plugin_syslog/database.php at develop · ddb4github/plugin_syslog Expand file tree/ Copy pathdatabase.phpMore file actions 250 lines (231 loc) · 9.15 KB / Copy pathdatabase.phpFile metadata and controls250 lines (231 loc) · 9.15 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 <?php /* +-------------------------------------------------------------------------+ | Copyright (C) 2004-2024 The Cacti Group | | | | This program is free software; you can redistribute it and/or | | modify it under the terms of the GNU General Public License | | as published by the Free Software Foundation; either version 2 | | of the License, or (at your option) any later version. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | +-------------------------------------------------------------------------+ | Cacti: The Complete RRDTool-based Graphing Solution | +-------------------------------------------------------------------------+ | This code is designed, written, and maintained by the Cacti Group. See | | about.php and/or the AUTHORS file for specific developer information. | +-------------------------------------------------------------------------+ | http://www.cacti.net/ | +-------------------------------------------------------------------------+ */ /** * syslog_db_connect_real - makes a connection to the database server * @param $host - the hostname of the database server, 'localhost' if the database server is running * on this machine * * @param $user - the username to connect to the database server as * @param $pass - the password to connect to the database server with * @param $db_name - the name of the database to connect to * @param $db_type - the type of database server to connect to, only 'mysql' is currently supported * @param $retries - the number a time the server should attempt to connect before failing * @param $db_ssl - true or false, is the database using ssl * @param $db_ssl_key - the path to the ssl key file * @param $db_ssl_cert - the path to the ssl cert file * @param $db_ssl_ca - the path to the ssl ca file * * @return (object) connection_id for success, (bool) '0' for error */ function syslog_db_connect_real($host, $user, $pass, $db_name, $db_type, $port = '3306', $retries = 20, $db_ssl = '', $db_ssl_key = '', $db_ssl_cert = '', $db_ssl_ca = '') { return db_connect_real($host, $user, $pass, $db_name, $db_type, $port, $retries, $db_ssl, $db_ssl_key, $db_ssl_cert, $db_ssl_ca); } /** * syslog_db_close - closes the open connection * * @param $syslog_cnn - the connection object to connect to * * @return the result of the close command */ function syslog_db_close($syslog_cnn) { return db_close($syslog_cnn); } /** * syslog_db_execute - run an sql query and do not return any output * * @param $syslog_cnn - the connection object to connect to * @param $sql - the sql query to execute * @param $log - whether to log error messages, defaults to true * * @return '1' for success, '0' for error */ function syslog_db_execute($sql, $log = TRUE) { global $syslog_cnn; return db_execute($sql, $log, $syslog_cnn); } /** * syslog_db_execute_prepared - run an sql query and do not return any output * * @param $sql - the sql query to execute * @param $log - whether to log error messages, defaults to true * * @return '1' for success, '0' for error */ function syslog_db_execute_prepared($sql, $parms = array(), $log = TRUE) { global $syslog_cnn; return db_execute_prepared($sql, $parms, $log, $syslog_cnn); } /** * syslog_db_fetch_cell - run a 'select' sql query and return the first column of the * first row found * * @param $sql - the sql query to execute * @param $log - whether to log error messages, defaults to true * @param $col_name - use this column name instead of the first one * * @return (bool) the output of the sql query as a single variable */ function syslog_db_fetch_cell($sql, $col_name = '', $log = TRUE) { global $syslog_cnn; return db_fetch_cell($sql, $col_name, $log, $syslog_cnn); } /** * syslog_db_fetch_cell_prepared - run a 'select' sql query and return the first column of the * first row found * * @param $sql - the sql query to execute * @param $params - an array of parameters * @param $col_name - use this column name instead of the first one * @param $log - whether to log error messages, defaults to true * * @return (bool) the output of the sql query as a single variable */ function syslog_db_fetch_cell_prepared($sql, $params = array(), $col_name = '', $log = TRUE) { global $syslog_cnn; return db_fetch_cell_prepared($sql, $params, $col_name, $log, $syslog_cnn); } /** * syslog_db_fetch_row - run a 'select' sql query and return the first row found * * @param $sql - the sql query to execute * @param $log - whether to log error messages, defaults to true * * @return the first row of the result as a hash */ function syslog_db_fetch_row($sql, $log = TRUE) { global $syslog_cnn; return db_fetch_row($sql, $log, $syslog_cnn); } /** * syslog_db_fetch_row_prepared - run a 'select' sql query and return the first row found * * @param $sql - the sql query to execute * @param $params - an array of parameters * @param $log - whether to log error messages, defaults to true * * @return the first row of the result as a hash */ function syslog_db_fetch_row_prepared($sql, $params = array(), $log = TRUE) { global $syslog_cnn; return db_fetch_row_prepared($sql, $params, $log, $syslog_cnn); } /** * syslog_db_fetch_assoc - run a 'select' sql query and return all rows found * * @param $sql - the sql query to execute * @param $log - whether to log error messages, defaults to true * * @return the entire result set as a multi-dimensional hash */ function syslog_db_fetch_assoc($sql, $log = TRUE) { global $syslog_cnn; return db_fetch_assoc($sql, $log, $syslog_cnn); } /** * syslog_db_fetch_assoc_prepared - run a 'select' sql query and return all rows found * * @param $sql - the sql query to execute * @param $params - an array of parameters * @param $log - whether to log error messages, defaults to true * * @return the entire result set as a multi-dimensional hash */ function syslog_db_fetch_assoc_prepared($sql, $params = array(), $log = TRUE) { global $syslog_cnn; return db_fetch_assoc_prepared($sql, $params, $log, $syslog_cnn); } /** * syslog_db_fetch_insert_id - get the last insert_id or auto incriment * * @param $syslog_cnn - the connection object to connect to * * @return the id of the last auto incriment row that was created */ function syslog_db_fetch_insert_id() { global $syslog_cnn; return db_fetch_insert_id($syslog_cnn); } /** * syslog_db_replace - replaces the data contained in a particular row * * @param $table_name - the name of the table to make the replacement in * @param $array_items - an array containing each column -> value mapping in the row * @param $keyCols - the name of the column containing the primary key * @param $autoQuote - whether to use intelligent quoting or not * * @return the auto incriment id column (if applicable) */ function syslog_db_replace($table_name, $array_items, $keyCols) { global $syslog_cnn; return db_replace($table_name, $array_items, $keyCols, $syslog_cnn); } /** * syslog_sql_save - saves data to an sql table * * @param $array_items - an array containing each column -> value mapping in the row * @param $table_name - the name of the table to make the replacement in * @param $key_cols - the primary key(s) * * @return the auto incriment id column (if applicable) */ function syslog_sql_save($array_items, $table_name, $key_cols = 'id', $autoinc = true) { global $syslog_cnn; return sql_save($array_items, $table_name, $key_cols, $autoinc, $syslog_cnn); } /** * syslog_db_table_exists - checks whether a table exists * * @param $table - the name of the table * @param $log - whether to log error messages, defaults to true * * @return (bool) the output of the sql query as a single variable */ function syslog_db_table_exists($table, $log = true) { global $syslog_cnn; preg_match("/([`]{0,1}(?<database>[\w_]+)[`]{0,1}\.){0,1}[`]{0,1}(?<table>[\w_]+)[`]{0,1}/", $table, $matches); if ($matches !== false && array_key_exists('table', $matches)) { $sql = 'SHOW TABLES LIKE \'' . $matches['table'] . '\''; return (db_fetch_cell($sql, '', $log, $syslog_cnn) ? true : false); } return false; } function syslog_db_column_exists($table, $column, $log = true) { global $syslog_cnn; return db_column_exists($table, $column, $log, $syslog_cnn); } function syslog_db_add_column($table, $column, $log = true) { global $syslog_cnn; return db_add_column($table, $column, $log, $syslog_cnn); } /** * syslog_db_affected_rows - return the number of rows affected by the last transaction * * @return (bool|int) The number of rows affected by the last transaction, * or false on error */ function syslog_db_affected_rows() { global $syslog_cnn; return db_affected_rows($syslog_cnn);; } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |