summaryrefslogtreecommitdiff
path: root/vendor/thecodingmachine/safe/generated/cubrid.php
blob: 559bc9735a3f431409aad46f3972eec6ae7cdd96 (plain)
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
<?php

namespace Safe;

use Safe\Exceptions\CubridException;

/**
 * The cubrid_bind function is used to bind values to a
 * corresponding named or question mark placeholder in the SQL statement that
 * was passed to cubrid_prepare. If
 * bind_value_type is not given, string will be the
 * default.
 *
 * The following table shows the types of substitute values.
 *
 *
 * CUBRID Bind Date Types
 *
 *
 *
 * Support
 * Bind Type
 * Corresponding SQL Type
 *
 *
 *
 *
 * Supported
 * STRING
 * CHAR, VARCHAR
 *
 *
 *
 * NCHAR
 * NCHAR, NVARCHAR
 *
 *
 *
 * BIT
 * BIT, VARBIT
 *
 *
 *
 * NUMERIC or NUMBER
 * SHORT, INT, NUMERIC
 *
 *
 *
 * FLOAT
 * FLOAT
 *
 *
 *
 * DOUBLE
 * DOUBLE
 *
 *
 *
 * TIME
 * TIME
 *
 *
 *
 * DATE
 * DATE
 *
 *
 *
 * TIMESTAMP
 * TIMESTAMP
 *
 *
 *
 * OBJECT
 * OBJECT
 *
 *
 *
 * ENUM
 * ENUM
 *
 *
 *
 * BLOB
 * BLOB
 *
 *
 *
 * CLOB
 * CLOB
 *
 *
 *
 * NULL
 * NULL
 *
 *
 * Not supported
 * SET
 * SET
 *
 *
 *
 * MULTISET
 * MULTISET
 *
 *
 *
 * SEQUENCE
 * SEQUENCE
 *
 *
 *
 *
 *
 * @param resource $req_identifier Request identifier as a result of
 * cubrid_prepare.
 * @param int $bind_index Location of binding parameters. It starts with 1.
 * @param mixed $bind_value Actual value for binding.
 * @param string $bind_value_type A type of the value to bind. (It is omitted by default.
 * Thus, the system internally uses string by default. However, you need to
 * specify the exact type of the value as an argument when they are NCHAR,
 * BIT, or BLOB/CLOB).
 * @throws CubridException
 *
 */
function cubrid_bind($req_identifier, int $bind_index, $bind_value, string $bind_value_type = null): void
{
    error_clear_last();
    if ($bind_value_type !== null) {
        $result = \cubrid_bind($req_identifier, $bind_index, $bind_value, $bind_value_type);
    } else {
        $result = \cubrid_bind($req_identifier, $bind_index, $bind_value);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_col_size function is used to get the
 * number of elements in a collection type (set, multiset, sequence)
 * attribute.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID the instance that you want to work with.
 * @param string $attr_name Name of the attribute that you want to work with.
 * @return int Number of elements, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_col_size($conn_identifier, string $oid, string $attr_name): int
{
    error_clear_last();
    $result = \cubrid_col_size($conn_identifier, $oid, $attr_name);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_column_names function is used to get the
 * column names of the query result by using req_identifier.
 *
 * @param resource $req_identifier Request identifier.
 * @return array Array of string values containing the column names, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_column_names($req_identifier): array
{
    error_clear_last();
    $result = \cubrid_column_names($req_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_column_types function gets column types of
 * query results by using req_identifier.
 *
 * @param resource $req_identifier Request identifier.
 * @return array Array of string values containing the column types, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_column_types($req_identifier): array
{
    error_clear_last();
    $result = \cubrid_column_types($req_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_commit function is used to execute commit
 * on the transaction pointed by conn_identifier,
 * currently in progress. Connection to the server is closed after the
 * cubrid_commit function is called; However,
 * the connection handle is still valid.
 *
 * In CUBRID PHP, auto-commit mode is disabled by default for transaction management.
 * You can set it by using cubrid_set_autocommit.
 * You can get its status by using cubrid_get_autocommit. Before you start a transaction,
 * remember to disable the auto-commit mode.
 *
 * @param resource $conn_identifier Connection identifier.
 * @throws CubridException
 *
 */
function cubrid_commit($conn_identifier): void
{
    error_clear_last();
    $result = \cubrid_commit($conn_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_connect_with_url function is used to
 * establish the environment for connecting to your server by using connection
 * information passed with an url string argument. If the HA feature is
 * enabled in CUBRID, you must specify the connection information of the
 * standby server, which is used for failover when failure occurs, in the url
 * string argument of this function. If the user name and password is not
 * given, then the "PUBLIC" connection will be made by default.
 *
 * &lt;url&gt; ::= CUBRID:&lt;host&gt;:&lt;db_name&gt;:&lt;db_user&gt;:&lt;db_password&gt;:[?&lt;properties&gt;]
 *
 * &lt;properties&gt; ::= &lt;property&gt; [&amp;&lt;property&gt;]
 *
 * &lt;properties&gt; ::= alhosts=&lt;alternative_hosts&gt;[ &amp;rctime=&lt;time&gt;]
 *
 * &lt;properties&gt; ::= login_timeout=&lt;milli_sec&gt;
 *
 * &lt;properties&gt; ::= query_timeout=&lt;milli_sec&gt;
 *
 * &lt;properties&gt; ::= disconnect_on_query_timeout=true|false
 *
 * &lt;alternative_hosts&gt; ::= &lt;standby_broker1_host&gt;:&lt;port&gt; [,&lt;standby_broker2_host&gt;:&lt;port&gt;]
 *
 * &lt;host&gt; := HOSTNAME | IP_ADDR
 *
 * &lt;time&gt; := SECOND
 *
 * &lt;milli_sec&gt; := MILLI SECOND
 *
 *
 * host : A host name or IP address of the master database
 * db_name : A name of the database
 * db_user : A name of the database user
 * db_password : A database user password
 *
 * alhosts : Specifies the broker information of the standby server, which is
 * used for failover when it is impossible to connect to the active server.
 * You can specify multiple brokers for failover, and the connection to the brokers
 * is attempted in the order listed in alhosts
 *
 * rctime : An interval between the attempts to connect to the active broker in
 * which failure occurred. After a failure occurs, the system connects to the
 * broker specified by althosts (failover), terminates the transaction, and then
 * attempts to connect to the active broker of the master database at every rctime.
 * The default value is 600 seconds.
 *
 * login_timeout : Timeout value (unit: msec.) for database login. The default
 * value is 0, which means infinite postponement.
 *
 *
 * query_timeout : Timeout value (unit: msec.) for query request. Upon timeout,
 * a message to cancel requesting a query transferred to server is sent. The return
 * value can depend on the disconnect_on_query_timeout configuration; even though the
 * message to cancel a request is sent to server, that request may succeed.
 *
 *
 * disconnect_on_query_timeout : Configures a value whether to immediately return
 * an error of function being executed upon timeout. The default value is false.
 *
 *
 *
 * @param string $conn_url A character string that contains server connection information.
 * @param string $userid User name for the database.
 * @param string $passwd User password.
 * @param bool $new_link If a second call is made to
 * cubrid_connect_with_url with the same arguments,
 * no new connection will be established, but instead, the connection
 * identifier of the already opened connection will be returned. The
 * new_link parameter modifies this behavior and
 * makes cubrid_connect_with_url always open a new
 * connection, even if cubrid_connect_with_url was
 * called before with the same parameters.
 * @return resource Connection identifier, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_connect_with_url(string $conn_url, string $userid = null, string $passwd = null, bool $new_link = false)
{
    error_clear_last();
    if ($new_link !== false) {
        $result = \cubrid_connect_with_url($conn_url, $userid, $passwd, $new_link);
    } elseif ($passwd !== null) {
        $result = \cubrid_connect_with_url($conn_url, $userid, $passwd);
    } elseif ($userid !== null) {
        $result = \cubrid_connect_with_url($conn_url, $userid);
    } else {
        $result = \cubrid_connect_with_url($conn_url);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_connect function is used to establish the
 * environment for connecting to your server by using your server address,
 * port number, database name, user name, and password. If the user name and
 * password is not given, then the "PUBLIC" connection will be made by
 * default.
 *
 * @param string $host Host name or IP address of CUBRID CAS server.
 * @param int $port Port number of CUBRID CAS server (BROKER_PORT configured in $CUBRID/conf/cubrid_broker.conf).
 * @param string $dbname Name of database.
 * @param string $userid User name for the database. If not given, the default
 * value is "public".
 * @param string $passwd User password. If not given, the default value is "".
 * @param bool $new_link If a second call is made to
 * cubrid_connect with the same arguments, no new
 * connection will be established, but instead, the connection identifier
 * of the already opened connection will be returned. The
 * new_link parameter modifies this behavior and
 * makes cubrid_connect always open a new connection,
 * even if cubrid_connect was called before with the
 * same parameters.
 * @return resource Connection identifier, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_connect(string $host, int $port, string $dbname, string $userid = null, string $passwd = null, bool $new_link = false)
{
    error_clear_last();
    if ($new_link !== false) {
        $result = \cubrid_connect($host, $port, $dbname, $userid, $passwd, $new_link);
    } elseif ($passwd !== null) {
        $result = \cubrid_connect($host, $port, $dbname, $userid, $passwd);
    } elseif ($userid !== null) {
        $result = \cubrid_connect($host, $port, $dbname, $userid);
    } else {
        $result = \cubrid_connect($host, $port, $dbname);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_current_oid function is used to get the
 * oid of the current cursor location from the query result.  To use
 * cubrid_current_oid, the query executed must be a
 * updatable query, and the CUBRID_INCLUDE_OID option must be included during
 * the query execution.
 *
 * @param resource $req_identifier Request identifier.
 * @return string Oid of current cursor location, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_current_oid($req_identifier): string
{
    error_clear_last();
    $result = \cubrid_current_oid($req_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_disconnect function closes the connection
 * handle and disconnects from server. If any request handle is not closed at this point,
 * it will be closed. It is similar to the CUBRID MySQL compatible function cubrid_close.
 *
 * @param resource $conn_identifier Connection identifier.
 * @throws CubridException
 *
 */
function cubrid_disconnect($conn_identifier = null): void
{
    error_clear_last();
    if ($conn_identifier !== null) {
        $result = \cubrid_disconnect($conn_identifier);
    } else {
        $result = \cubrid_disconnect();
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_drop function is used to delete an
 * instance from database by using the oid of the instance.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid Oid of the instance that you want to delete.
 * @throws CubridException
 *
 */
function cubrid_drop($conn_identifier, string $oid): void
{
    error_clear_last();
    $result = \cubrid_drop($conn_identifier, $oid);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * This function frees the memory occupied by the result data. It returns
 * TRUE on success. Note that it can only frees the
 * client fetch buffer now, and if you want free all memory, use function
 * cubrid_close_request.
 *
 * @param resource $req_identifier This is the request identifier.
 * @throws CubridException
 *
 */
function cubrid_free_result($req_identifier): void
{
    error_clear_last();
    $result = \cubrid_free_result($req_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * This function returns the current CUBRID connection charset and is similar
 * to the CUBRID MySQL compatible function
 * cubrid_client_encoding.
 *
 * @param resource $conn_identifier The CUBRID connection.
 * @return string A string that represents the CUBRID connection charset on success.
 * @throws CubridException
 *
 */
function cubrid_get_charset($conn_identifier): string
{
    error_clear_last();
    $result = \cubrid_get_charset($conn_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_get_class_name function is used to get the
 * class name from oid. It doesn't work when selecting data from the system tables,
 * for example db_class.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance that you want to check the existence.
 * @return string Class name when process is successful.
 * @throws CubridException
 *
 */
function cubrid_get_class_name($conn_identifier, string $oid): string
{
    error_clear_last();
    $result = \cubrid_get_class_name($conn_identifier, $oid);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * This function returns a string that represents the client library version.
 *
 * @return string A string that represents the client library version on success.
 * @throws CubridException
 *
 */
function cubrid_get_client_info(): string
{
    error_clear_last();
    $result = \cubrid_get_client_info();
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * This function returns the CUBRID database parameters.
 * It returns an associative array with the values for the following parameters:
 *
 *
 * PARAM_ISOLATION_LEVEL
 * PARAM_LOCK_TIMEOUT
 * PARAM_MAX_STRING_LENGTH
 * PARAM_AUTO_COMMIT
 *
 *
 *
 * Database parameters
 *
 *
 *
 * Parameter
 * Description
 *
 *
 *
 *
 * PARAM_ISOLATION_LEVEL
 * The transaction isolation level.
 *
 *
 * LOCK_TIMEOUT
 * CUBRID provides the lock timeout feature, which sets the waiting
 * time (in seconds) for the lock until the transaction lock setting is
 * allowed. The default value of the lock_timeout_in_secs parameter is
 * -1, which means the application client will wait indefinitely until
 * the transaction lock is allowed.
 *
 *
 *
 * PARAM_AUTO_COMMIT
 * In CUBRID PHP, auto-commit mode is disabled by default for
 * transaction management. It can be set by using
 * cubrid_set_autocommit.
 *
 *
 *
 *
 *
 *
 * The following table shows the isolation levels from 1 to 6. It consists of
 * table schema (row) and isolation level:
 *
 * Levels of Isolation Supported by CUBRID
 *
 *
 *
 * Name
 * Description
 *
 *
 *
 *
 * SERIALIZABLE (6)
 * In this isolation level, problems concerning concurrency (e.g.
 * dirty read, non-repeatable read, phantom read, etc.) do not
 * occur.
 *
 *
 * REPEATABLE READ CLASS with REPEATABLE READ INSTANCES (5)
 * Another transaction T2 cannot update the schema of table A while
 * transaction T1 is viewing table A.
 * Transaction T1 may experience phantom read for the record R that was
 * inserted by another transaction T2 when it is repeatedly retrieving a
 * specific record.
 *
 *
 * REPEATABLE READ CLASS with READ COMMITTED INSTANCES (or CURSOR STABILITY) (4)
 * Another transaction T2 cannot update the schema of table A while
 * transaction T1 is viewing table A.
 * Transaction T1 may experience R read (non-repeatable read) that was
 * updated and committed by another transaction T2 when it is repeatedly
 * retrieving the record R.
 *
 *
 * REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES (3)
 * Default isolation level.  Another transaction T2 cannot update
 * the schema of table A  while transaction T1 is viewing table A.
 * Transaction T1 may experience R' read (dirty read) for the record that
 * was updated but not committed by another transaction T2.
 *
 *
 * READ COMMITTED CLASS with READ COMMITTED INSTANCES (2)
 * Transaction T1 may experience A' read (non-repeatable read) for
 * the table that was updated and committed by another transaction  T2
 * while it is viewing table A repeatedly.  Transaction T1 may experience
 * R' read (non-repeatable read) for the record that was updated and
 * committed by another transaction T2 while it is retrieving the record
 * R repeatedly.
 *
 *
 * READ COMMITTED CLASS with READ UNCOMMITTED INSTANCES (1)
 * Transaction T1 may experience A' read (non-repeatable read) for
 * the table that was updated and committed by another transaction T2
 * while it is repeatedly viewing table A.  Transaction T1 may experience
 * R' read (dirty read) for the record that was updated but not committed
 * by another transaction T2.
 *
 *
 *
 *
 *
 * @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified,
 * the last link opened by cubrid_connect is assumed.
 * @return array An associative array with CUBRID database parameters; on success.
 * @throws CubridException
 *
 */
function cubrid_get_db_parameter($conn_identifier): array
{
    error_clear_last();
    $result = \cubrid_get_db_parameter($conn_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_get_query_timeout function is used to get
 * the query timeout of the request.
 *
 * @param resource $req_identifier Request identifier.
 * @return int Returns the query timeout value in milliseconds of the current request on success.
 * @throws CubridException
 *
 */
function cubrid_get_query_timeout($req_identifier): int
{
    error_clear_last();
    $result = \cubrid_get_query_timeout($req_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * This function returns a string that represents the CUBRID server version.
 *
 * @param resource $conn_identifier The CUBRID connection.
 * @return string A string that represents the CUBRID server version on success.
 * @throws CubridException
 *
 */
function cubrid_get_server_info($conn_identifier): string
{
    error_clear_last();
    $result = \cubrid_get_server_info($conn_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_insert_id function retrieves the ID
 * generated for the AUTO_INCREMENT column which is updated by the previous
 * INSERT query. It returns 0 if the previous query does not generate new
 * rows.
 *
 * @param resource $conn_identifier The connection identifier previously obtained by a call to
 * cubrid_connect.
 * @return string A string representing the ID generated for an AUTO_INCREMENT column by the
 * previous query, on success.
 *
 * 0, if the previous query does not generate new rows.
 *
 * FALSE on failure.
 * @throws CubridException
 *
 */
function cubrid_insert_id($conn_identifier = null): string
{
    error_clear_last();
    if ($conn_identifier !== null) {
        $result = \cubrid_insert_id($conn_identifier);
    } else {
        $result = \cubrid_insert_id();
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * cubrid_lob_close is used to close all BLOB/CLOB
 * returned from cubrid_lob_get.
 *
 * @param array $lob_identifier_array LOB identifier array returned from cubrid_lob_get.
 * @throws CubridException
 *
 */
function cubrid_lob_close(array $lob_identifier_array): void
{
    error_clear_last();
    $result = \cubrid_lob_close($lob_identifier_array);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * cubrid_lob_export is used to get BLOB/CLOB data from CUBRID database, and saves its contents to a file.
 * To use this function, you must use cubrid_lob_get first to get BLOB/CLOB info from CUBRID.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param resource $lob_identifier LOB identifier.
 * @param string $path_name Path name of the file.
 * @throws CubridException
 *
 */
function cubrid_lob_export($conn_identifier, $lob_identifier, string $path_name): void
{
    error_clear_last();
    $result = \cubrid_lob_export($conn_identifier, $lob_identifier, $path_name);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * cubrid_lob_get is used to get BLOB/CLOB meta info from CUBRID database,
 * CUBRID gets BLOB/CLOB by executing the SQL statement, and returns all LOBs as a resource array.
 * Be sure that the SQL retrieves only one column and its data type is BLOB or CLOB.
 *
 * Remember to use cubrid_lob_close to release the LOBs if you don't need it any more.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $sql SQL statement to be executed.
 * @return array Return an array of LOB resources, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_lob_get($conn_identifier, string $sql): array
{
    error_clear_last();
    $result = \cubrid_lob_get($conn_identifier, $sql);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * cubrid_lob_send reads BLOB/CLOB data and passes it straight through to the browser.
 * To use this function, you must use cubrid_lob_get first to get BLOB/CLOB info from CUBRID.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param resource $lob_identifier LOB identifier.
 * @throws CubridException
 *
 */
function cubrid_lob_send($conn_identifier, $lob_identifier): void
{
    error_clear_last();
    $result = \cubrid_lob_send($conn_identifier, $lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * cubrid_lob_size is used to get BLOB/CLOB data size.
 *
 * @param resource $lob_identifier LOB identifier.
 * @return string A string representing LOB data size, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_lob_size($lob_identifier): string
{
    error_clear_last();
    $result = \cubrid_lob_size($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_bind function is used to bind BLOB/CLOB datas
 * to a corresponding question mark placeholder in the SQL statement that was passed
 * to cubrid_prepare. If bind_value_type
 * is not given, string will be "BLOB" as the default. But if you use
 * cubrid_lob2_new before, bind_value_type
 * will be consistent with type in cubrid_lob2_new as the default.
 *
 * @param resource $req_identifier Request identifier as a result of cubrid_prepare.
 * @param int $bind_index Location of binding parameters. It starts with 1.
 * @param mixed $bind_value Actual value for binding.
 * @param string $bind_value_type It must be "BLOB" or "CLOB" and it won't be case-sensitive. If it not be given, the default value is "BLOB".
 * @throws CubridException
 *
 */
function cubrid_lob2_bind($req_identifier, int $bind_index, $bind_value, string $bind_value_type = null): void
{
    error_clear_last();
    if ($bind_value_type !== null) {
        $result = \cubrid_lob2_bind($req_identifier, $bind_index, $bind_value, $bind_value_type);
    } else {
        $result = \cubrid_lob2_bind($req_identifier, $bind_index, $bind_value);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_close function is used to close LOB object
 * returned from cubrid_lob2_new or got from the result set.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @throws CubridException
 *
 */
function cubrid_lob2_close($lob_identifier): void
{
    error_clear_last();
    $result = \cubrid_lob2_close($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_export function is used to save the
 * contents of BLOB/CLOB data to a file. To use this function, you must use
 * cubrid_lob2_new or fetch a lob object from CUBRID
 * database first. If the file already exists, the operation will fail.
 * This function will not influence the cursor position of the lob object.
 * It operates the entire lob object.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param string $file_name File name you want to store BLOB/CLOB data. It also supports the path of the file.
 * @throws CubridException
 *
 */
function cubrid_lob2_export($lob_identifier, string $file_name): void
{
    error_clear_last();
    $result = \cubrid_lob2_export($lob_identifier, $file_name);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_import function is used to save the
 * contents of BLOB/CLOB data from a file. To use this function, you must use
 * cubrid_lob2_new or fetch a lob object from CUBRID database
 * first. If the file already exists, the operation will fail.
 * This function will not influence the cursor position of the lob object.
 * It operates the entire lob object.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param string $file_name File name you want to import BLOB/CLOB data. It also supports the path of the file.
 * @throws CubridException
 *
 */
function cubrid_lob2_import($lob_identifier, string $file_name): void
{
    error_clear_last();
    $result = \cubrid_lob2_import($lob_identifier, $file_name);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_new function is used to create a lob object (both BLOB and CLOB).
 * This function should be used before you bind a lob object.
 *
 * @param resource $conn_identifier Connection identifier. If the connection identifier is not specified,
 * the last connection opened by cubrid_connect or
 * cubrid_connect_with_url is assumed.
 * @param string $type It may be "BLOB" or "CLOB", it won't be case-sensitive. The default value is "BLOB".
 * @return resource Lob identifier when it is successful.
 * @throws CubridException
 *
 */
function cubrid_lob2_new($conn_identifier = null, string $type = "BLOB")
{
    error_clear_last();
    if ($type !== "BLOB") {
        $result = \cubrid_lob2_new($conn_identifier, $type);
    } elseif ($conn_identifier !== null) {
        $result = \cubrid_lob2_new($conn_identifier);
    } else {
        $result = \cubrid_lob2_new();
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_read function reads len bytes from the
 * LOB data and returns the bytes read.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param int $len Length from buffer you want to read from the lob data.
 * @return string Returns the contents as a string, FALSE when there is no more data.
 * @throws CubridException
 *
 */
function cubrid_lob2_read($lob_identifier, int $len): string
{
    error_clear_last();
    $result = \cubrid_lob2_read($lob_identifier, $len);
    if ($result === null) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_seek function is used to move the cursor
 * position of a lob object by the value set in the offset
 * argument, to the direction set in the origin argument.
 *
 * To set the origin argument, you can use CUBRID_CURSOR_FIRST
 * to set the cursor position moving forward offset units from
 * the first beginning. In this case, offset must be a positive value.
 *
 * If you use CUBRID_CURSOR_CURRENT for origin, you can move
 * forward or backward. and offset can be positive or negative.
 *
 * If you use CUBRID_CURSOR_LAST for origin, you can move
 * backward offset units from the end of LOB object and
 * offset only can be positive.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param int $offset Number of units you want to move the cursor.
 * @param int $origin This parameter can be the following values:
 *
 * CUBRID_CURSOR_FIRST: move forward from the first beginning.
 *
 * CUBRID_CURSOR_CURRENT: move forward or backward from the current position.
 *
 * CUBRID_CURSOR_LAST: move backward at the end of LOB object.
 * @throws CubridException
 *
 */
function cubrid_lob2_seek($lob_identifier, int $offset, int $origin = CUBRID_CURSOR_CURRENT): void
{
    error_clear_last();
    $result = \cubrid_lob2_seek($lob_identifier, $offset, $origin);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_seek64 function is used to move the cursor
 * position of a lob object by the value set in the offset
 * argument, to the direction set in the origin argument.
 * If the offset you want to move is larger than an integer
 * data can be stored, you can use this function.
 *
 * To set the origin argument, you can use CUBRID_CURSOR_FIRST
 * to set the cursor position moving forward offset units from
 * the first beginning. In this case, offset must be a positive value.
 *
 * If you use CUBRID_CURSOR_CURRENT for origin, you can move
 * forward or backward. and offset can be positive or negative.
 *
 * If you use CUBRID_CURSOR_LAST for origin, you can move backward
 * offset units from the end of LOB object and offset only can be positive.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param string $offset Number of units you want to move the cursor.
 * @param int $origin This parameter can be the following values:
 *
 * CUBRID_CURSOR_FIRST: move forward from the first beginning.
 *
 * CUBRID_CURSOR_CURRENT: move forward or backward from the current position.
 *
 * CUBRID_CURSOR_LAST: move backward at the end of LOB object.
 * @throws CubridException
 *
 */
function cubrid_lob2_seek64($lob_identifier, string $offset, int $origin = CUBRID_CURSOR_CURRENT): void
{
    error_clear_last();
    $result = \cubrid_lob2_seek64($lob_identifier, $offset, $origin);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lob2_size function is used to get the size of a lob object.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @return int It will return the size of the LOB object when it processes successfully.
 * @throws CubridException
 *
 */
function cubrid_lob2_size($lob_identifier): int
{
    error_clear_last();
    $result = \cubrid_lob2_size($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_size64 function is used to get the
 * size of a lob object.  If the size of a lob object is larger than an
 * integer data can be stored, you can use this function and it will return
 * the size as a string.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @return string It will return the size of the LOB object as a string when it processes successfully.
 * @throws CubridException
 *
 */
function cubrid_lob2_size64($lob_identifier): string
{
    error_clear_last();
    $result = \cubrid_lob2_size64($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_tell function is used to tell the cursor position of the LOB object.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @return int It will return the cursor position on the LOB object when it processes successfully.
 * @throws CubridException
 *
 */
function cubrid_lob2_tell($lob_identifier): int
{
    error_clear_last();
    $result = \cubrid_lob2_tell($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_tell64 function is used to tell the
 * cursor position of the LOB object. If the size of a lob object is larger
 * than an integer data can be stored, you can use this function and it will
 * return the position information as a string.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @return string It will return the cursor position on the LOB object as a string when it processes successfully.
 * @throws CubridException
 *
 */
function cubrid_lob2_tell64($lob_identifier): string
{
    error_clear_last();
    $result = \cubrid_lob2_tell64($lob_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_lob2_write function reads as much as data
 * from buf and stores it to the LOB object. Note that
 * this function can only append characters now.
 *
 * @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
 * @param string $buf Data that need to be written to the lob object.
 * @throws CubridException
 *
 */
function cubrid_lob2_write($lob_identifier, string $buf): void
{
    error_clear_last();
    $result = \cubrid_lob2_write($lob_identifier, $buf);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lock_read function is used to put read
 * lock on the instance pointed by given oid.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance that you want to put read lock on.
 * @throws CubridException
 *
 */
function cubrid_lock_read($conn_identifier, string $oid): void
{
    error_clear_last();
    $result = \cubrid_lock_read($conn_identifier, $oid);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_lock_write function is used to put write
 * lock on the instance pointed by the given oid.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance that you want to put write lock on.
 * @throws CubridException
 *
 */
function cubrid_lock_write($conn_identifier, string $oid): void
{
    error_clear_last();
    $result = \cubrid_lock_write($conn_identifier, $oid);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_move_cursor function is used to move the
 * current cursor location of req_identifier by the
 * value set in the offset argument, to the direction
 * set in the origin argument. To set the
 * origin argument, you can use CUBRID_CURSOR_FIRST
 * for the first part of the result, CUBRID_CURSOR_CURRENT for the current
 * location of the result, or CUBRID_CURSOR_LAST for the last part of the
 * result. If origin argument is not explicitly
 * designated, then the function uses CUBRID_CURSOR_CURRENT as its default
 * value.
 *
 * If the value of cursor movement range goes over the valid limit, then the
 * cursor moves to the next location after the valid range for the cursor.
 * For example, if you move 20 units in the result with the size of 10, then
 * the cursor will move to 11th place and return CUBRID_NO_MORE_DATA.
 *
 * @param resource $req_identifier Request identifier.
 * @param int $offset Number of units you want to move the cursor.
 * @param int $origin Location where you want to move the cursor from CUBRID_CURSOR_FIRST, CUBRID_CURSOR_CURRENT, CUBRID_CURSOR_LAST.
 * @return int Returns TRUE on success.
 * @throws CubridException
 *
 */
function cubrid_move_cursor($req_identifier, int $offset, int $origin = CUBRID_CURSOR_CURRENT): int
{
    error_clear_last();
    $result = \cubrid_move_cursor($req_identifier, $offset, $origin);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_next_result function is used to get
 * results of next query if multiple SQL statements are executed and
 * CUBRID_EXEC_QUERY_ALL flag is set upon
 * cubrid_execute.
 *
 * @param resource $result result comes from a call to cubrid_execute
 * @throws CubridException
 *
 */
function cubrid_next_result($result): void
{
    error_clear_last();
    $result = \cubrid_next_result($result);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * Establishes a persistent connection to a CUBRID server.
 *
 * cubrid_pconnect_with_url acts very much like
 * cubrid_connect_with_url with two major differences.
 *
 * First, when connecting, the function would first try to find a (persistent)
 * link that's already open with the same host, port, dbname and userid. If
 * one is found, an identifier for it will be returned instead of opening a
 * new connection.
 *
 * Second, the connection to the SQL server will not be closed when the
 * execution of the script ends.  Instead, the link will remain open for
 * future use (cubrid_close or
 * cubrid_disconnect will not close links established by
 * cubrid_pconnect_with_url).
 *
 * This type of link is therefore called 'persistent'.
 *
 * &lt;url&gt; ::= CUBRID:&lt;host&gt;:&lt;db_name&gt;:&lt;db_user&gt;:&lt;db_password&gt;:[?&lt;properties&gt;]
 *
 * &lt;properties&gt; ::= &lt;property&gt; [&amp;&lt;property&gt;]
 *
 * &lt;properties&gt; ::= alhosts=&lt;alternative_hosts&gt;[ &amp;rctime=&lt;time&gt;]
 *
 * &lt;properties&gt; ::= login_timeout=&lt;milli_sec&gt;
 *
 * &lt;properties&gt; ::= query_timeout=&lt;milli_sec&gt;
 *
 * &lt;properties&gt; ::= disconnect_on_query_timeout=true|false
 *
 * &lt;alternative_hosts&gt; ::= &lt;standby_broker1_host&gt;:&lt;port&gt; [,&lt;standby_broker2_host&gt;:&lt;port&gt;]
 *
 * &lt;host&gt; := HOSTNAME | IP_ADDR
 *
 * &lt;time&gt; := SECOND
 *
 * &lt;milli_sec&gt; := MILLI SECOND
 *
 *
 * host : A host name or IP address of the master database
 * db_name : A name of the database
 * db_user : A name of the database user
 * db_password : A database user password
 *
 * alhosts : Specifies the broker information of the standby server, which is
 * used for failover when it is impossible to connect to the active server.
 * You can specify multiple brokers for failover, and the connection to the brokers
 * is attempted in the order listed in alhosts
 *
 * rctime : An interval between the attempts to connect to the active broker in
 * which failure occurred. After a failure occurs, the system connects to the
 * broker specified by althosts (failover), terminates the transaction, and then
 * attempts to connect to the active broker of the master database at every rctime.
 * The default value is 600 seconds.
 *
 * login_timeout : Timeout value (unit: msec.) for database login. The default
 * value is 0, which means infinite postponement.
 *
 *
 * query_timeout : Timeout value (unit: msec.) for query request. Upon timeout,
 * a message to cancel requesting a query transferred to server is sent. The return
 * value can depend on the disconnect_on_query_timeout configuration; even though the
 * message to cancel a request is sent to server, that request may succeed.
 *
 *
 * disconnect_on_query_timeout : Configures a value whether to immediately return
 * an error of function being executed upon timeout. The default value is false.
 *
 *
 *
 * @param string $conn_url A character string that contains server connection information.
 * @param string $userid User name for the database.
 * @param string $passwd User password.
 * @return resource Connection identifier, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_pconnect_with_url(string $conn_url, string $userid = null, string $passwd = null)
{
    error_clear_last();
    if ($passwd !== null) {
        $result = \cubrid_pconnect_with_url($conn_url, $userid, $passwd);
    } elseif ($userid !== null) {
        $result = \cubrid_pconnect_with_url($conn_url, $userid);
    } else {
        $result = \cubrid_pconnect_with_url($conn_url);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * Establishes a persistent connection to a CUBRID server.
 *
 * cubrid_pconnect acts very much like
 * cubrid_connect with two major differences.
 *
 * First, when connecting, the function would first try to find a (persistent)
 * link that's already open with the same host, port, dbname and userid. If
 * one is found, an identifier for it will be returned instead of opening a
 * new connection.
 *
 * Second, the connection to the SQL server will not be closed when the
 * execution of the script ends.  Instead, the link will remain open for
 * future use (cubrid_close or
 * cubrid_disconnect will not close links established by
 * cubrid_pconnect).
 *
 * This type of link is therefore called 'persistent'.
 *
 * @param string $host Host name or IP address of CUBRID CAS server.
 * @param int $port Port number of CUBRID CAS server (BROKER_PORT configured in $CUBRID/conf/cubrid_broker.conf).
 * @param string $dbname Name of database.
 * @param string $userid User name for the database.
 * @param string $passwd User password.
 * @return resource Connection identifier, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_pconnect(string $host, int $port, string $dbname, string $userid = null, string $passwd = null)
{
    error_clear_last();
    if ($passwd !== null) {
        $result = \cubrid_pconnect($host, $port, $dbname, $userid, $passwd);
    } elseif ($userid !== null) {
        $result = \cubrid_pconnect($host, $port, $dbname, $userid);
    } else {
        $result = \cubrid_pconnect($host, $port, $dbname);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_prepare function is a sort of API which represents SQL statements
 * compiled previously to a given connection handle. This pre-compiled SQL statement will be included
 * in the cubrid_prepare.
 *
 * Accordingly, you can use this statement effectively to execute several times repeatedly or to
 * process long data. Only a single statement can be used and a parameter may put a question mark (?)
 * to appropriate area in the SQL statement. Add a parameter when you bind a value in the VALUES
 * clause of INSERT statement or in the WHERE clause. Note that it is allowed to bind a value to a
 * MARK(?) by using the cubrid_bind function only.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $prepare_stmt Prepare query.
 * @param int $option OID return option CUBRID_INCLUDE_OID.
 * @return resource Request identifier, if process is successful.
 * @throws CubridException
 *
 */
function cubrid_prepare($conn_identifier, string $prepare_stmt, int $option = 0)
{
    error_clear_last();
    $result = \cubrid_prepare($conn_identifier, $prepare_stmt, $option);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_put function is used to update an
 * attribute of the instance of the given oid.
 *
 * You can update single attribute by using string data type to set
 * attr.  In such case, you can use integer,
 * floating point or string type data for the value
 * argument. To update multiple number of attributes, you can disregard the
 * attr argument, and set
 * value argument with associative array data type.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance that you want to update.
 * @param string $attr Name of the attribute that you want to update.
 * @param mixed $value New value that you want to assign to the attribute.
 * @throws CubridException
 *
 */
function cubrid_put($conn_identifier, string $oid, string $attr = null, $value = null): void
{
    error_clear_last();
    if ($value !== null) {
        $result = \cubrid_put($conn_identifier, $oid, $attr, $value);
    } elseif ($attr !== null) {
        $result = \cubrid_put($conn_identifier, $oid, $attr);
    } else {
        $result = \cubrid_put($conn_identifier, $oid);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_rollback function executes rollback on the
 * transaction pointed by conn_identifier, currently in
 * progress.
 *
 * Connection to server is closed after calling
 * cubrid_rollback. Connection handle, however, is
 * still valid.
 *
 * @param resource $conn_identifier Connection identifier.
 * @throws CubridException
 *
 */
function cubrid_rollback($conn_identifier): void
{
    error_clear_last();
    $result = \cubrid_rollback($conn_identifier);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_schema function is used to get the
 * requested schema information from database. To get information about specific class,
 * set the class_name, to get information about specific attribute
 * (can be used only with CUBRID_SCH_ATTR_PRIVILEGE),
 * set the attr_name.
 *
 * The result of the cubrid_schema function is returned as a two-dimensional
 * array (column (associative array) * row (numeric array)). The following
 * tables shows types of schema and the column structure of the result array to
 * be returned based on the schema type.
 *
 *
 * Result Composition of Each Type
 *
 *
 *
 * Schema
 * Column Number
 * Column Name
 * Value
 *
 *
 *
 *
 * CUBRID_SCH_CLASS
 * 1
 * NAME
 *
 *
 *
 *
 * 2
 * TYPE
 * 0:system class 1:vclass 2:class
 *
 *
 *
 * CUBRID_SCH_VCLASS
 * 1
 * NAME
 *
 *
 *
 *
 * 2
 * TYPE
 * 1:vclass
 *
 *
 *
 * CUBRID_SCH_QUERY_SPEC
 * 1
 * QUERY_SPEC
 *
 *
 *
 *
 * CUBRID_SCH_ATTRIBUTE / CUBRID_SCH_CLASS_ATTRIBUTE
 * 1
 * ATTR_NAME
 *
 *
 *
 *
 * 2
 * DOMAIN
 *
 *
 *
 *
 * 3
 * SCALE
 *
 *
 *
 *
 * 4
 * PRECISION
 *
 *
 *
 *
 * 5
 * INDEXED
 * 1:indexed
 *
 *
 *
 * 6
 * NOT NULL
 * 1:not null
 *
 *
 *
 * 7
 * SHARED
 * 1:shared
 *
 *
 *
 * 8
 * UNIQUE
 * 1:unique
 *
 *
 *
 * 9
 * DEFAULT
 *
 *
 *
 *
 * 10
 * ATTR_ORDER
 * base:1
 *
 *
 *
 * 11
 * CLASS_NAME
 *
 *
 *
 *
 * 12
 * SOURCE_CLASS
 *
 *
 *
 *
 * 13
 * IS_KEY
 * 1:key
 *
 *
 *
 * CUBRID_SCH_METHOD / CUBRID_SCH_CLASS_METHOD
 * 1
 * NAME
 *
 *
 *
 *
 * 2
 * RET_DOMAIN
 *
 *
 *
 *
 * 3
 * ARG_DOMAIN
 *
 *
 *
 *
 * CUBRID_SCH_METHOD_FILE
 * 1
 * METHOD_FILE
 *
 *
 *
 *
 * CUBRID_SCH_SUPERCLASS / CUBRID_SCH_DIRECT_SUPER_CLASS / CUBRID_SCH_SUBCLASS
 * 1
 * CLASS_NAME
 *
 *
 *
 *
 * 2
 * TYPE
 * 0:system class 1:vclass 2:class
 *
 *
 *
 * CUBRID_SCH_CONSTRAINT
 * 1
 * TYPE
 * 0:unique 1:index 2:reverse unique 3:reverse index
 *
 *
 *
 * 2
 * NAME
 *
 *
 *
 *
 * 3
 * ATTR_NAME
 *
 *
 *
 *
 * 4
 * NUM_PAGES
 *
 *
 *
 *
 * 5
 * NUM_KEYS
 *
 *
 *
 *
 * 6
 * PRIMARY_KEY
 * 1:primary key
 *
 *
 *
 * 7
 * KEY_ORDER
 * base:1
 *
 *
 *
 * CUBRID_SCH_TRIGGER
 * 1
 * NAME
 *
 *
 *
 *
 * 2
 * STATUS
 *
 *
 *
 *
 * 3
 * EVENT
 *
 *
 *
 *
 * 4
 * TARGET_CLASS
 *
 *
 *
 *
 * 5
 * TARGET_ATTR
 *
 *
 *
 *
 * 6
 * ACTION_TIME
 *
 *
 *
 *
 * 7
 * ACTION
 *
 *
 *
 *
 * 8
 * PRIORITY
 *
 *
 *
 *
 * 9
 * CONDITION_TIME
 *
 *
 *
 *
 * 10
 * CONDITION
 *
 *
 *
 *
 * CUBRID_SCH_CLASS_PRIVILEGE / CUBRID_SCH_ATTR_PRIVILEGE
 * 1
 * CLASS_NAME / ATTR_NAME
 *
 *
 *
 *
 * 2
 * PRIVILEGE
 *
 *
 *
 *
 * 3
 * GRANTABLE
 *
 *
 *
 *
 * CUBRID_SCH_PRIMARY_KEY
 * 1
 * CLASS_NAME
 *
 *
 *
 *
 * 2
 * ATTR_NAME
 *
 *
 *
 *
 * 3
 * KEY_SEQ
 * base:1
 *
 *
 *
 * 4
 * KEY_NAME
 *
 *
 *
 *
 * CUBRID_SCH_IMPORTED_KEYS / CUBRID_SCH_EXPORTED_KEYS / CUBRID_SCH_CROSS_REFERENCE
 * 1
 * PKTABLE_NAME
 *
 *
 *
 *
 * 2
 * PKCOLUMN_NAME
 *
 *
 *
 *
 * 3
 * FKTABLE_NAME
 * base:1
 *
 *
 *
 * 4
 * FKCOLUMN_NAME
 *
 *
 *
 *
 * 5
 * KEY_SEQ
 * base:1
 *
 *
 *
 * 6
 * UPDATE_ACTION
 * 0:cascade 1:restrict 2:no action 3:set null
 *
 *
 *
 * 7
 * DELETE_ACTION
 * 0:cascade 1:restrict 2:no action 3:set null
 *
 *
 *
 * 8
 * FK_NAME
 *
 *
 *
 *
 * 9
 * PK_NAME
 *
 *
 *
 *
 *
 *
 * @param resource $conn_identifier Connection identifier.
 * @param int $schema_type Schema data that you want to know.
 * @param string $class_name Class you want to know the schema of.
 * @param string $attr_name Attribute you want to know the schema of.
 * @return array Array containing the schema information, when process is successful.
 * @throws CubridException
 *
 */
function cubrid_schema($conn_identifier, int $schema_type, string $class_name = null, string $attr_name = null): array
{
    error_clear_last();
    if ($attr_name !== null) {
        $result = \cubrid_schema($conn_identifier, $schema_type, $class_name, $attr_name);
    } elseif ($class_name !== null) {
        $result = \cubrid_schema($conn_identifier, $schema_type, $class_name);
    } else {
        $result = \cubrid_schema($conn_identifier, $schema_type);
    }
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
    return $result;
}


/**
 * The cubrid_seq_drop function is used to delete an
 * element you request from the given sequence type attribute in the
 * database.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance you want to work with.
 * @param string $attr_name Name of the attribute that you want to delete an element from.
 * @param int $index Index of the element that you want to delete (1-based).
 * @throws CubridException
 *
 */
function cubrid_seq_drop($conn_identifier, string $oid, string $attr_name, int $index): void
{
    error_clear_last();
    $result = \cubrid_seq_drop($conn_identifier, $oid, $attr_name, $index);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_col_insert function is used to insert an
 * element to a sequence type attribute in a requested location.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance you want to work with.
 * @param string $attr_name Name of the attribute you want to insert an instance to.
 * @param int $index Location of the element, you want to insert the element to (1-based).
 * @param string $seq_element Content of the element that you want to insert.
 * @throws CubridException
 *
 */
function cubrid_seq_insert($conn_identifier, string $oid, string $attr_name, int $index, string $seq_element): void
{
    error_clear_last();
    $result = \cubrid_seq_insert($conn_identifier, $oid, $attr_name, $index, $seq_element);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_seq_put function is used to update the
 * content of the requested element in a sequent type attribute using OID.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance you want to work with.
 * @param string $attr_name Name of the attribute that you want to update an element.
 * @param int $index Index (1-based) of the element that you want to update.
 * @param string $seq_element New content that you want to use for the update.
 * @throws CubridException
 *
 */
function cubrid_seq_put($conn_identifier, string $oid, string $attr_name, int $index, string $seq_element): void
{
    error_clear_last();
    $result = \cubrid_seq_put($conn_identifier, $oid, $attr_name, $index, $seq_element);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_set_add function is used to insert a
 * single element to a set type attribute (set, multiset, sequence) you
 * requested.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance you want to work with.
 * @param string $attr_name Name of the attribute you want to insert an element.
 * @param string $set_element Content of the element you want to insert.
 * @throws CubridException
 *
 */
function cubrid_set_add($conn_identifier, string $oid, string $attr_name, string $set_element): void
{
    error_clear_last();
    $result = \cubrid_set_add($conn_identifier, $oid, $attr_name, $set_element);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_set_autocommit function is used to set the
 * CUBRID database auto-commit mode of the current database connection.
 *
 * In CUBRID PHP, auto-commit mode is disabled by default for transaction
 * management. When auto-commit mode is truned from off to on, any pending work is
 * automatically committed.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param bool $mode Auto-commit mode. The following constants can be used:
 *
 *
 * CUBRID_AUTOCOMMIT_FALSE
 * CUBRID_AUTOCOMMIT_TRUE
 *
 * @throws CubridException
 *
 */
function cubrid_set_autocommit($conn_identifier, bool $mode): void
{
    error_clear_last();
    $result = \cubrid_set_autocommit($conn_identifier, $mode);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_set_db_parameter function is used to set
 * the CUBRID database parameters. It can set the following CUBRID database
 * parameters:
 *
 *
 * PARAM_ISOLATION_LEVEL
 * PARAM_LOCK_TIMEOUT
 *
 *
 * @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified,
 * the last link opened by cubrid_connect is assumed.
 * @param int $param_type Database parameter type.
 * @param int $param_value Isolation level value (1-6) or lock timeout (in seconds) value.
 * @throws CubridException
 *
 */
function cubrid_set_db_parameter($conn_identifier, int $param_type, int $param_value): void
{
    error_clear_last();
    $result = \cubrid_set_db_parameter($conn_identifier, $param_type, $param_value);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_set_drop function is used to delete an
 * element that you request from the given set type (set, multiset) attribute
 * of the database.
 *
 * @param resource $conn_identifier Connection identifier.
 * @param string $oid OID of the instance you want to work with.
 * @param string $attr_name Name of the attribute you want to delete an element from.
 * @param string $set_element Content of the element you want to delete.
 * @throws CubridException
 *
 */
function cubrid_set_drop($conn_identifier, string $oid, string $attr_name, string $set_element): void
{
    error_clear_last();
    $result = \cubrid_set_drop($conn_identifier, $oid, $attr_name, $set_element);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}


/**
 * The cubrid_set_query_timeout function is used to set
 * the timeout time of query execution.
 *
 * @param resource $req_identifier Request identifier.
 * @param int $timeout Timeout time in milliseconds.
 * @throws CubridException
 *
 */
function cubrid_set_query_timeout($req_identifier, int $timeout): void
{
    error_clear_last();
    $result = \cubrid_set_query_timeout($req_identifier, $timeout);
    if ($result === false) {
        throw CubridException::createFromPhpError();
    }
}