Exceptions
5 days ago
apache.php
5 days ago
apcu.php
5 days ago
array.php
5 days ago
bzip2.php
5 days ago
calendar.php
5 days ago
classobj.php
5 days ago
com.php
5 days ago
cubrid.php
5 days ago
curl.php
5 days ago
datetime.php
5 days ago
dir.php
5 days ago
eio.php
5 days ago
errorfunc.php
5 days ago
exec.php
5 days ago
fileinfo.php
5 days ago
filesystem.php
5 days ago
filter.php
5 days ago
fpm.php
5 days ago
ftp.php
5 days ago
funchand.php
5 days ago
functionsList.php
5 days ago
gmp.php
5 days ago
gnupg.php
5 days ago
hash.php
5 days ago
ibase.php
5 days ago
ibmDb2.php
5 days ago
iconv.php
5 days ago
image.php
5 days ago
imap.php
5 days ago
info.php
5 days ago
ingres-ii.php
5 days ago
inotify.php
5 days ago
json.php
5 days ago
ldap.php
5 days ago
libxml.php
5 days ago
lzf.php
5 days ago
mailparse.php
5 days ago
mbstring.php
5 days ago
misc.php
5 days ago
msql.php
5 days ago
mysql.php
5 days ago
mysqli.php
5 days ago
mysqlndMs.php
5 days ago
mysqlndQc.php
5 days ago
network.php
5 days ago
oci8.php
5 days ago
opcache.php
5 days ago
openssl.php
5 days ago
outcontrol.php
5 days ago
password.php
5 days ago
pcntl.php
5 days ago
pcre.php
5 days ago
pdf.php
5 days ago
pgsql.php
5 days ago
posix.php
5 days ago
ps.php
5 days ago
pspell.php
5 days ago
readline.php
5 days ago
rpminfo.php
5 days ago
rrd.php
5 days ago
sem.php
5 days ago
session.php
5 days ago
shmop.php
5 days ago
simplexml.php
5 days ago
sockets.php
5 days ago
sodium.php
5 days ago
solr.php
5 days ago
spl.php
5 days ago
sqlsrv.php
5 days ago
ssdeep.php
5 days ago
ssh2.php
5 days ago
stream.php
5 days ago
strings.php
5 days ago
swoole.php
5 days ago
uodbc.php
5 days ago
uopz.php
5 days ago
url.php
5 days ago
var.php
5 days ago
xdiff.php
5 days ago
xml.php
5 days ago
xmlrpc.php
5 days ago
yaml.php
5 days ago
yaz.php
5 days ago
zip.php
5 days ago
zlib.php
5 days ago
cubrid.php
373 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePressVendor\Safe; |
| 4 | |
| 5 | use ProfilePressVendor\Safe\Exceptions\CubridException; |
| 6 | /** |
| 7 | * This function frees the memory occupied by the result data. It returns |
| 8 | * TRUE on success. Note that it can only frees the |
| 9 | * client fetch buffer now, and if you want free all memory, use function |
| 10 | * cubrid_close_request. |
| 11 | * |
| 12 | * @param resource $req_identifier This is the request identifier. |
| 13 | * @throws CubridException |
| 14 | * |
| 15 | */ |
| 16 | function cubrid_free_result($req_identifier): void |
| 17 | { |
| 18 | error_clear_last(); |
| 19 | $result = \cubrid_free_result($req_identifier); |
| 20 | if ($result === \false) { |
| 21 | throw CubridException::createFromPhpError(); |
| 22 | } |
| 23 | } |
| 24 | /** |
| 25 | * This function returns the current CUBRID connection charset and is similar |
| 26 | * to the CUBRID MySQL compatible function |
| 27 | * cubrid_client_encoding. |
| 28 | * |
| 29 | * @param resource $conn_identifier The CUBRID connection. |
| 30 | * @return string A string that represents the CUBRID connection charset; on success. |
| 31 | * |
| 32 | * FALSE on failure. |
| 33 | * @throws CubridException |
| 34 | * |
| 35 | */ |
| 36 | function cubrid_get_charset($conn_identifier): string |
| 37 | { |
| 38 | error_clear_last(); |
| 39 | $result = \cubrid_get_charset($conn_identifier); |
| 40 | if ($result === \false) { |
| 41 | throw CubridException::createFromPhpError(); |
| 42 | } |
| 43 | return $result; |
| 44 | } |
| 45 | /** |
| 46 | * This function returns a string that represents the client library version. |
| 47 | * |
| 48 | * @return string A string that represents the client library version; on success. |
| 49 | * |
| 50 | * FALSE on failure. |
| 51 | * @throws CubridException |
| 52 | * |
| 53 | */ |
| 54 | function cubrid_get_client_info(): string |
| 55 | { |
| 56 | error_clear_last(); |
| 57 | $result = \cubrid_get_client_info(); |
| 58 | if ($result === \false) { |
| 59 | throw CubridException::createFromPhpError(); |
| 60 | } |
| 61 | return $result; |
| 62 | } |
| 63 | /** |
| 64 | * This function returns the CUBRID database parameters or it returns FALSE on |
| 65 | * failure. It returns an associative array with the values for the following |
| 66 | * parameters: |
| 67 | * |
| 68 | * |
| 69 | * PARAM_ISOLATION_LEVEL |
| 70 | * PARAM_LOCK_TIMEOUT |
| 71 | * PARAM_MAX_STRING_LENGTH |
| 72 | * PARAM_AUTO_COMMIT |
| 73 | * |
| 74 | * |
| 75 | * |
| 76 | * Database parameters |
| 77 | * |
| 78 | * |
| 79 | * |
| 80 | * Parameter |
| 81 | * Description |
| 82 | * |
| 83 | * |
| 84 | * |
| 85 | * |
| 86 | * PARAM_ISOLATION_LEVEL |
| 87 | * The transaction isolation level. |
| 88 | * |
| 89 | * |
| 90 | * LOCK_TIMEOUT |
| 91 | * CUBRID provides the lock timeout feature, which sets the waiting |
| 92 | * time (in seconds) for the lock until the transaction lock setting is |
| 93 | * allowed. The default value of the lock_timeout_in_secs parameter is |
| 94 | * -1, which means the application client will wait indefinitely until |
| 95 | * the transaction lock is allowed. |
| 96 | * |
| 97 | * |
| 98 | * |
| 99 | * PARAM_AUTO_COMMIT |
| 100 | * In CUBRID PHP, auto-commit mode is disabled by default for |
| 101 | * transaction management. It can be set by using |
| 102 | * cubrid_set_autocommit. |
| 103 | * |
| 104 | * |
| 105 | * |
| 106 | * |
| 107 | * |
| 108 | * |
| 109 | * The following table shows the isolation levels from 1 to 6. It consists of |
| 110 | * table schema (row) and isolation level: |
| 111 | * |
| 112 | * Levels of Isolation Supported by CUBRID |
| 113 | * |
| 114 | * |
| 115 | * |
| 116 | * Name |
| 117 | * Description |
| 118 | * |
| 119 | * |
| 120 | * |
| 121 | * |
| 122 | * SERIALIZABLE (6) |
| 123 | * In this isolation level, problems concerning concurrency (e.g. |
| 124 | * dirty read, non-repeatable read, phantom read, etc.) do not |
| 125 | * occur. |
| 126 | * |
| 127 | * |
| 128 | * REPEATABLE READ CLASS with REPEATABLE READ INSTANCES (5) |
| 129 | * Another transaction T2 cannot update the schema of table A while |
| 130 | * transaction T1 is viewing table A. |
| 131 | * Transaction T1 may experience phantom read for the record R that was |
| 132 | * inserted by another transaction T2 when it is repeatedly retrieving a |
| 133 | * specific record. |
| 134 | * |
| 135 | * |
| 136 | * REPEATABLE READ CLASS with READ COMMITTED INSTANCES (or CURSOR STABILITY) (4) |
| 137 | * Another transaction T2 cannot update the schema of table A while |
| 138 | * transaction T1 is viewing table A. |
| 139 | * Transaction T1 may experience R read (non-repeatable read) that was |
| 140 | * updated and committed by another transaction T2 when it is repeatedly |
| 141 | * retrieving the record R. |
| 142 | * |
| 143 | * |
| 144 | * REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES (3) |
| 145 | * Default isolation level. Another transaction T2 cannot update |
| 146 | * the schema of table A while transaction T1 is viewing table A. |
| 147 | * Transaction T1 may experience R' read (dirty read) for the record that |
| 148 | * was updated but not committed by another transaction T2. |
| 149 | * |
| 150 | * |
| 151 | * READ COMMITTED CLASS with READ COMMITTED INSTANCES (2) |
| 152 | * Transaction T1 may experience A' read (non-repeatable read) for |
| 153 | * the table that was updated and committed by another transaction T2 |
| 154 | * while it is viewing table A repeatedly. Transaction T1 may experience |
| 155 | * R' read (non-repeatable read) for the record that was updated and |
| 156 | * committed by another transaction T2 while it is retrieving the record |
| 157 | * R repeatedly. |
| 158 | * |
| 159 | * |
| 160 | * READ COMMITTED CLASS with READ UNCOMMITTED INSTANCES (1) |
| 161 | * Transaction T1 may experience A' read (non-repeatable read) for |
| 162 | * the table that was updated and committed by another transaction T2 |
| 163 | * while it is repeatedly viewing table A. Transaction T1 may experience |
| 164 | * R' read (dirty read) for the record that was updated but not committed |
| 165 | * by another transaction T2. |
| 166 | * |
| 167 | * |
| 168 | * |
| 169 | * |
| 170 | * |
| 171 | * @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified, |
| 172 | * the last link opened by cubrid_connect is assumed. |
| 173 | * @return array An associative array with CUBRID database parameters; on success. |
| 174 | * |
| 175 | * FALSE on failure. |
| 176 | * @throws CubridException |
| 177 | * |
| 178 | */ |
| 179 | function cubrid_get_db_parameter($conn_identifier): array |
| 180 | { |
| 181 | error_clear_last(); |
| 182 | $result = \cubrid_get_db_parameter($conn_identifier); |
| 183 | if ($result === \false) { |
| 184 | throw CubridException::createFromPhpError(); |
| 185 | } |
| 186 | return $result; |
| 187 | } |
| 188 | /** |
| 189 | * This function returns a string that represents the CUBRID server version. |
| 190 | * |
| 191 | * @param resource $conn_identifier The CUBRID connection. |
| 192 | * @return string A string that represents the CUBRID server version; on success. |
| 193 | * |
| 194 | * FALSE on failure. |
| 195 | * @throws CubridException |
| 196 | * |
| 197 | */ |
| 198 | function cubrid_get_server_info($conn_identifier): string |
| 199 | { |
| 200 | error_clear_last(); |
| 201 | $result = \cubrid_get_server_info($conn_identifier); |
| 202 | if ($result === \false) { |
| 203 | throw CubridException::createFromPhpError(); |
| 204 | } |
| 205 | return $result; |
| 206 | } |
| 207 | /** |
| 208 | * The cubrid_insert_id function retrieves the ID |
| 209 | * generated for the AUTO_INCREMENT column which is updated by the previous |
| 210 | * INSERT query. It returns 0 if the previous query does not generate new |
| 211 | * rows. |
| 212 | * |
| 213 | * @param resource $conn_identifier The connection identifier previously obtained by a call to |
| 214 | * cubrid_connect. |
| 215 | * @return string A string representing the ID generated for an AUTO_INCREMENT column by the |
| 216 | * previous query, on success. |
| 217 | * |
| 218 | * 0, if the previous query does not generate new rows. |
| 219 | * |
| 220 | * FALSE on failure. |
| 221 | * @throws CubridException |
| 222 | * |
| 223 | */ |
| 224 | function cubrid_insert_id($conn_identifier = null): string |
| 225 | { |
| 226 | error_clear_last(); |
| 227 | if ($conn_identifier !== null) { |
| 228 | $result = \cubrid_insert_id($conn_identifier); |
| 229 | } else { |
| 230 | $result = \cubrid_insert_id(); |
| 231 | } |
| 232 | if ($result === \false) { |
| 233 | throw CubridException::createFromPhpError(); |
| 234 | } |
| 235 | return $result; |
| 236 | } |
| 237 | /** |
| 238 | * The cubrid_lob2_new function is used to create a lob object (both BLOB and CLOB). |
| 239 | * This function should be used before you bind a lob object. |
| 240 | * |
| 241 | * @param resource $conn_identifier Connection identifier. If the connection identifier is not specified, |
| 242 | * the last connection opened by cubrid_connect or |
| 243 | * cubrid_connect_with_url is assumed. |
| 244 | * @param string $type It may be "BLOB" or "CLOB", it won't be case-sensitive. The default value is "BLOB". |
| 245 | * @return resource Lob identifier when it is successful. |
| 246 | * |
| 247 | * FALSE on failure. |
| 248 | * @throws CubridException |
| 249 | * |
| 250 | */ |
| 251 | function cubrid_lob2_new($conn_identifier = null, string $type = "BLOB") |
| 252 | { |
| 253 | error_clear_last(); |
| 254 | if ($type !== "BLOB") { |
| 255 | $result = \cubrid_lob2_new($conn_identifier, $type); |
| 256 | } elseif ($conn_identifier !== null) { |
| 257 | $result = \cubrid_lob2_new($conn_identifier); |
| 258 | } else { |
| 259 | $result = \cubrid_lob2_new(); |
| 260 | } |
| 261 | if ($result === \false) { |
| 262 | throw CubridException::createFromPhpError(); |
| 263 | } |
| 264 | return $result; |
| 265 | } |
| 266 | /** |
| 267 | * The cubrid_lob2_size function is used to get the size of a lob object. |
| 268 | * |
| 269 | * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set. |
| 270 | * @return int It will return the size of the LOB object when it processes successfully. |
| 271 | * |
| 272 | * FALSE on failure. |
| 273 | * @throws CubridException |
| 274 | * |
| 275 | */ |
| 276 | function cubrid_lob2_size($lob_identifier): int |
| 277 | { |
| 278 | error_clear_last(); |
| 279 | $result = \cubrid_lob2_size($lob_identifier); |
| 280 | if ($result === \false) { |
| 281 | throw CubridException::createFromPhpError(); |
| 282 | } |
| 283 | return $result; |
| 284 | } |
| 285 | /** |
| 286 | * The cubrid_lob2_size64 function is used to get the |
| 287 | * size of a lob object. If the size of a lob object is larger than an |
| 288 | * integer data can be stored, you can use this function and it will return |
| 289 | * the size as a string. |
| 290 | * |
| 291 | * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set. |
| 292 | * @return string It will return the size of the LOB object as a string when it processes successfully. |
| 293 | * |
| 294 | * FALSE on failure. |
| 295 | * @throws CubridException |
| 296 | * |
| 297 | */ |
| 298 | function cubrid_lob2_size64($lob_identifier): string |
| 299 | { |
| 300 | error_clear_last(); |
| 301 | $result = \cubrid_lob2_size64($lob_identifier); |
| 302 | if ($result === \false) { |
| 303 | throw CubridException::createFromPhpError(); |
| 304 | } |
| 305 | return $result; |
| 306 | } |
| 307 | /** |
| 308 | * The cubrid_lob2_tell function is used to tell the cursor position of the LOB object. |
| 309 | * |
| 310 | * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set. |
| 311 | * @return int It will return the cursor position on the LOB object when it processes successfully. |
| 312 | * |
| 313 | * FALSE on failure. |
| 314 | * @throws CubridException |
| 315 | * |
| 316 | */ |
| 317 | function cubrid_lob2_tell($lob_identifier): int |
| 318 | { |
| 319 | error_clear_last(); |
| 320 | $result = \cubrid_lob2_tell($lob_identifier); |
| 321 | if ($result === \false) { |
| 322 | throw CubridException::createFromPhpError(); |
| 323 | } |
| 324 | return $result; |
| 325 | } |
| 326 | /** |
| 327 | * The cubrid_lob2_tell64 function is used to tell the |
| 328 | * cursor position of the LOB object. If the size of a lob object is larger |
| 329 | * than an integer data can be stored, you can use this function and it will |
| 330 | * return the position information as a string. |
| 331 | * |
| 332 | * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set. |
| 333 | * @return string It will return the cursor position on the LOB object as a string when it processes successfully. |
| 334 | * |
| 335 | * FALSE on failure. |
| 336 | * @throws CubridException |
| 337 | * |
| 338 | */ |
| 339 | function cubrid_lob2_tell64($lob_identifier): string |
| 340 | { |
| 341 | error_clear_last(); |
| 342 | $result = \cubrid_lob2_tell64($lob_identifier); |
| 343 | if ($result === \false) { |
| 344 | throw CubridException::createFromPhpError(); |
| 345 | } |
| 346 | return $result; |
| 347 | } |
| 348 | /** |
| 349 | * The cubrid_set_db_parameter function is used to set |
| 350 | * the CUBRID database parameters. It can set the following CUBRID database |
| 351 | * parameters: |
| 352 | * |
| 353 | * |
| 354 | * PARAM_ISOLATION_LEVEL |
| 355 | * PARAM_LOCK_TIMEOUT |
| 356 | * |
| 357 | * |
| 358 | * @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified, |
| 359 | * the last link opened by cubrid_connect is assumed. |
| 360 | * @param int $param_type Database parameter type. |
| 361 | * @param int $param_value Isolation level value (1-6) or lock timeout (in seconds) value. |
| 362 | * @throws CubridException |
| 363 | * |
| 364 | */ |
| 365 | function cubrid_set_db_parameter($conn_identifier, int $param_type, int $param_value): void |
| 366 | { |
| 367 | error_clear_last(); |
| 368 | $result = \cubrid_set_db_parameter($conn_identifier, $param_type, $param_value); |
| 369 | if ($result === \false) { |
| 370 | throw CubridException::createFromPhpError(); |
| 371 | } |
| 372 | } |
| 373 |