forked from CUBRID/cubrid-perl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cubrid.xs
128 lines (105 loc) · 2.58 KB
/
cubrid.xs
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
#include "cubrid.h"
MODULE = DBD::cubrid PACKAGE = DBD::cubrid
INCLUDE: cubrid.xsi
MODULE = DBD::cubrid PACKAGE = DBD::cubrid::dr
MODULE = DBD::cubrid PACKAGE = DBD::cubrid::db
void
_ping( dbh )
SV *dbh
CODE:
ST(0) = sv_2mortal(newSViv(dbd_db_ping(dbh)));
void
do( dbh, statement, attr=Nullsv, ... )
SV *dbh
char *statement
SV *attr
PROTOTYPE: $$;$@
CODE:
{
int retval;
if (statement[0] == '\0') {
XST_mUNDEF (0);
return;
}
if (items < 4) {
imp_sth_t *imp_sth;
SV * const sth = dbixst_bounce_method ("prepare", 3);
if (!SvROK (sth))
XSRETURN_UNDEF;
imp_sth = (imp_sth_t*)(DBIh_COM (sth));
retval = dbd_st_execute (sth, imp_sth);
} else {
imp_sth_t *imp_sth;
SV * const sth = dbixst_bounce_method ("prepare", 3);
if (!SvROK (sth))
XSRETURN_UNDEF;
imp_sth = (imp_sth_t*)(DBIh_COM (sth));
if (!dbdxst_bind_params (sth, imp_sth, items-2, ax+2))
XSRETURN_UNDEF;
retval = dbd_st_execute (sth, imp_sth);
}
if (retval == 0)
XST_mPV (0, "0E0");
else if (retval < -1)
XST_mUNDEF (0);
else
XST_mIV (0, retval);
}
void
_primary_key_info( dbh, table )
SV *dbh
char *table
CODE:
ST(0) = _cubrid_primary_key (dbh, table);
void
_foreign_key_info( dbh, pk_table = Nullsv, fk_table = Nullsv)
SV *dbh
SV *pk_table
SV *fk_table
CODE:
{
STRLEN len;
char *pktable = (SvOK(pk_table)) ? SvPV(pk_table, len) : "";
char *fktable = (SvOK(fk_table)) ? SvPV(fk_table, len) : "";
ST(0) = _cubrid_foreign_key (dbh, pktable, fktable);
}
void
quote(dbh, str, type=NULL)
SV* dbh
SV* str
SV* type
PROTOTYPE: $$;$
CODE:
{
D_imp_dbh(dbh);
SV* quoted = dbd_db_quote(dbh, str, type);
ST(0) = quoted ? sv_2mortal(quoted) : str;
XSRETURN(1);
}
MODULE = DBD::cubrid PACKAGE = DBD::cubrid::st
void
cubrid_lob_get( sth, col )
SV *sth
int col
CODE:
ST(0) = sv_2mortal (newSViv (cubrid_st_lob_get(sth, col)));
void
cubrid_lob_export( sth, index, filename )
SV *sth
int index
char *filename
CODE:
ST(0) = sv_2mortal (newSViv (cubrid_st_lob_export(sth, index, filename)));
void
cubrid_lob_import( sth, index, filename, sql_type )
SV *sth
int index
char *filename
IV sql_type
CODE:
ST(0) = sv_2mortal (newSViv (cubrid_st_lob_import(sth, index, filename, sql_type)));
void
cubrid_lob_close( sth )
SV *sth
CODE:
ST(0) = sv_2mortal (newSViv (cubrid_st_lob_close(sth)));