Skip to content

Commit a2f4888

Browse files
committed
Update to remove compile warnings.
1 parent a52d69b commit a2f4888

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

NuoDB.knowngood.xsi.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ selectall_arrayref(...)
121121
(DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp))
122122
) {
123123
/* fallback to perl implementation */
124-
SV *tmp =dbixst_bounce_method("DBD::NuoDB::db::SUPER::selectall_arrayref", items);
124+
SV *tmp =dbixst_bounce_method((char*)"DBD::NuoDB::db::SUPER::selectall_arrayref", items);
125125
SPAGAIN;
126126
ST(0) = tmp;
127127
XSRETURN(1);
@@ -136,7 +136,7 @@ selectall_arrayref(...)
136136
sth = mg->mg_obj;
137137
}
138138
else {
139-
sth = dbixst_bounce_method("prepare", 3);
139+
sth = dbixst_bounce_method((char*)"prepare", 3);
140140
SPAGAIN; SP -= items; /* because stack might have been realloc'd */
141141
if (!SvROK(sth))
142142
XSRETURN_UNDEF;
@@ -179,7 +179,7 @@ selectrow_arrayref(...)
179179
}
180180
else {
181181
/* --- prepare --- */
182-
sth = dbixst_bounce_method("prepare", 3);
182+
sth = dbixst_bounce_method((char*)"prepare", 3);
183183
SPAGAIN; SP -= items; /* because stack might have been realloc'd */
184184
if (!SvROK(sth)) {
185185
if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; }
@@ -401,7 +401,7 @@ take_imp_data(h)
401401
*/
402402
SV *sv = dbd_take_imp_data(h, imp_xxh, NULL);
403403
if (SvOK(sv) && !SvTRUE(sv)) {
404-
SV *tmp = dbixst_bounce_method("DBD::NuoDB::db::SUPER::take_imp_data", items);
404+
SV *tmp = dbixst_bounce_method((char*)"DBD::NuoDB::db::SUPER::take_imp_data", items);
405405
SPAGAIN;
406406
ST(0) = tmp;
407407
} else {
@@ -654,7 +654,7 @@ fetchall_arrayref(sth, slice=&PL_sv_undef, batch_row_count=&PL_sv_undef)
654654
SV * batch_row_count
655655
CODE:
656656
if (SvOK(slice)) { /* fallback to perl implementation */
657-
SV *tmp = dbixst_bounce_method("DBD::NuoDB::st::SUPER::fetchall_arrayref", 3);
657+
SV *tmp = dbixst_bounce_method((char*)"DBD::NuoDB::st::SUPER::fetchall_arrayref", 3);
658658
SPAGAIN;
659659
ST(0) = tmp;
660660
}

dbdimp.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "dbdimp.h"
2+
#include "ProductVersion.h"
23

34
DBISTATE_DECLARE;
45

@@ -26,8 +27,11 @@ int dbd_db_login6_sv(SV *dbh, imp_dbh_t *imp_dbh, SV *dbname, SV *uid, SV *pwd,
2627
hv = (HV*) SvRV(sv);
2728
if (SvTYPE(hv) != SVt_PVHV)
2829
return FALSE;
29-
30+
#if NUODB_PRODUCT_VERSION_MAJOR >= 3
31+
NuoDB::Connection *conn = NuoDB_createConnection();
32+
#else
3033
NuoDB::Connection *conn = createConnection();
34+
#endif
3135

3236
if (!conn)
3337
return FALSE;
@@ -50,7 +54,7 @@ int dbd_db_login6_sv(SV *dbh, imp_dbh_t *imp_dbh, SV *dbname, SV *uid, SV *pwd,
5054
DBIc_ACTIVE_on(imp_dbh);
5155
DBIc_IMPSET_on(imp_dbh);
5256
} catch (NuoDB::SQLException& xcp) {
53-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
57+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
5458
conn->close();
5559
imp_dbh->conn = NULL;
5660
return FALSE;
@@ -77,7 +81,7 @@ int dbd_st_prepare_sv(SV *sth, imp_sth_t *imp_sth, SV *statement, SV *attribs)
7781
NuoDB::ParameterMetaData* md = imp_sth->pstmt->getParameterMetaData();
7882
DBIc_NUM_PARAMS(imp_sth) = md->getParameterCount();
7983
} catch (NuoDB::SQLException& xcp) {
80-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
84+
do_error(sth, xcp.getSqlcode(), xcp.getText());
8185
return FALSE;
8286
}
8387

@@ -114,7 +118,7 @@ int dbd_st_execute(SV* sth, imp_sth_t* imp_sth)
114118
NuoDB::ResultSetMetaData *md = imp_sth->rs->getMetaData();
115119
DBIc_NUM_FIELDS(imp_sth) = md->getColumnCount();
116120
} catch (NuoDB::SQLException& xcp) {
117-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
121+
do_error(sth, xcp.getSqlcode(), xcp.getText());
118122
return FALSE;
119123
}
120124

@@ -147,7 +151,7 @@ AV* dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)
147151
return Nullav;
148152
}
149153
} catch (NuoDB::SQLException& xcp) {
150-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
154+
do_error(sth, xcp.getSqlcode(), xcp.getText());
151155
}
152156

153157
av = DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);
@@ -180,7 +184,7 @@ void dbd_st_destroy(SV *sth, imp_sth_t *imp_sth)
180184
imp_sth->pstmt->close();
181185

182186
} catch (NuoDB::SQLException& xcp) {
183-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
187+
do_error(sth, xcp.getSqlcode(), xcp.getText());
184188
}
185189

186190
DBIc_IMPSET_off(imp_sth);
@@ -205,7 +209,7 @@ const char * dbd_st_analyze(SV *sth)
205209
try {
206210
return imp_sth->pstmt->analyze(2);
207211
} catch (NuoDB::SQLException& xcp) {
208-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
212+
do_error(sth, xcp.getSqlcode(), xcp.getText());
209213
return NULL;
210214
}
211215
}
@@ -221,7 +225,7 @@ int dbd_db_commit(SV* dbh, imp_dbh_t* imp_dbh)
221225
try {
222226
imp_dbh->conn->commit();
223227
} catch (NuoDB::SQLException& xcp) {
224-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
228+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
225229
return FALSE;
226230
}
227231

@@ -238,7 +242,7 @@ int dbd_db_rollback(SV* dbh, imp_dbh_t* imp_dbh)
238242
try {
239243
imp_dbh->conn->rollback();
240244
} catch (NuoDB::SQLException& xcp) {
241-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
245+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
242246
return FALSE;
243247
}
244248

@@ -278,7 +282,7 @@ int dbd_db_STORE_attrib(SV* dbh, imp_dbh_t* imp_dbh, SV* keysv, SV* valuesv)
278282
imp_dbh->conn->setAutoCommit(bool_value);
279283
DBIc_set(imp_dbh, DBIcf_AutoCommit, bool_value);
280284
} catch (NuoDB::SQLException& xcp) {
281-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
285+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
282286
return FALSE;
283287
}
284288
} else {
@@ -313,7 +317,7 @@ int dbd_db_disconnect(SV* dbh, imp_dbh_t* imp_dbh)
313317
imp_dbh->conn->close();
314318
imp_dbh->conn = NULL;
315319
} catch (NuoDB::SQLException& xcp) {
316-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
320+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
317321
return FALSE;
318322
}
319323

@@ -347,7 +351,7 @@ int dbd_bind_ph (SV *sth, imp_sth_t *imp_sth, SV *param, SV *value, IV sql_type,
347351
imp_sth->pstmt->setString(SvIV(param), value_str);
348352
}
349353
} catch (NuoDB::SQLException& xcp) {
350-
do_error(sth, xcp.getSqlcode(), (char *) xcp.getText());
354+
do_error(sth, xcp.getSqlcode(), xcp.getText());
351355
return FALSE;
352356
}
353357

@@ -374,15 +378,15 @@ const char * dbd_db_version(SV *dbh)
374378
try {
375379
return metaData->getDatabaseProductVersion();
376380
} catch (NuoDB::SQLException& xcp) {
377-
do_error(dbh, xcp.getSqlcode(), (char *) xcp.getText());
381+
do_error(dbh, xcp.getSqlcode(), xcp.getText());
378382
return NULL;
379383
}
380384

381385
return NULL;
382386
}
383387

384388

385-
void do_error(SV* h, int rc, char* what)
389+
void do_error(SV* h, int rc, const char* what)
386390
{
387391
D_imp_xxh(h);
388392

dbdimp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct imp_sth_st {
3434
#define dbd_db_destroy nuodb_db_destroy
3535
#define dbd_db_disconnect nuodb_db_disconnect
3636

37-
void do_error (SV *h, int rc, char *what);
37+
void do_error (SV *h, int rc, const char *what);
3838

3939
const char * dbd_st_analyze(SV *sth);
4040
const char * dbd_db_version(SV *dbh);

0 commit comments

Comments
 (0)