summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-12-14 10:02:25 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-17 16:33:32 +0100
commit34e39ebaf51803a7c8e4c470163c76b7bcbd7dfb (patch)
treed598cb03776798d3ea39e740d1984342eea75979
parentd80118dc163e2fce6990b997ff7100974358481c (diff)
downloadphp-git-34e39ebaf51803a7c8e4c470163c76b7bcbd7dfb.tar.gz
Fix signed/unsigned warnings in PDO ODBC
Add add skipif to test. (cherry picked from commit aa58db723221ec891d4432621003bfa55dc15edf)
-rw-r--r--ext/pdo_odbc/odbc_driver.c20
-rw-r--r--ext/pdo_odbc/odbc_stmt.c6
-rw-r--r--ext/pdo_odbc/tests/max_columns.phpt2
3 files changed, 15 insertions, 13 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 9a254553d5..76b981e2c2 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -41,7 +41,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf
message = strpprintf(0, "%s (%s[%ld] at %s:%d)",
einfo->last_err_msg,
- einfo->what, einfo->last_error,
+ einfo->what, (long) einfo->last_error,
einfo->file, einfo->line);
add_next_index_long(info, einfo->last_error);
@@ -85,8 +85,8 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement,
eh = H->env;
}
- rc = SQLGetDiagRec(htype, eh, recno++, einfo->last_state, &einfo->last_error,
- einfo->last_err_msg, sizeof(einfo->last_err_msg)-1, &errmsgsize);
+ rc = SQLGetDiagRec(htype, eh, recno++, (SQLCHAR *) einfo->last_state, &einfo->last_error,
+ (SQLCHAR *) einfo->last_err_msg, sizeof(einfo->last_err_msg)-1, &errmsgsize);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
errmsgsize = 0;
@@ -110,8 +110,8 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement,
* diagnostic records (which can be generated by PRINT statements
* in the query, for instance). */
while (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
- char discard_state[6];
- char discard_buf[1024];
+ SQLCHAR discard_state[6];
+ SQLCHAR discard_buf[1024];
SQLINTEGER code;
rc = SQLGetDiagRec(htype, eh, recno++, discard_state, &code,
discard_buf, sizeof(discard_buf)-1, &errmsgsize);
@@ -192,7 +192,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
}
}
- rc = SQLPrepare(S->stmt, (char*)sql, SQL_NTS);
+ rc = SQLPrepare(S->stmt, (SQLCHAR *) sql, SQL_NTS);
if (nsql) {
efree(nsql);
}
@@ -230,7 +230,7 @@ static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_le
return -1;
}
- rc = SQLExecDirect(stmt, (char *)sql, sql_len);
+ rc = SQLExecDirect(stmt, (SQLCHAR *) sql, sql_len);
if (rc == SQL_NO_DATA) {
/* If SQLExecDirect executes a searched update or delete statement that
@@ -438,7 +438,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
}
if (strchr(dbh->data_source, ';')) {
- char dsnbuf[1024];
+ SQLCHAR dsnbuf[1024];
SQLSMALLINT dsnbuflen;
use_direct = 1;
@@ -452,11 +452,11 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
dbh->data_source = dsn;
}
- rc = SQLDriverConnect(H->dbc, NULL, (char*)dbh->data_source, strlen(dbh->data_source),
+ rc = SQLDriverConnect(H->dbc, NULL, (SQLCHAR *) dbh->data_source, strlen(dbh->data_source),
dsnbuf, sizeof(dsnbuf)-1, &dsnbuflen, SQL_DRIVER_NOPROMPT);
}
if (!use_direct) {
- rc = SQLConnect(H->dbc, (char*)dbh->data_source, SQL_NTS, dbh->username, SQL_NTS, dbh->password, SQL_NTS);
+ rc = SQLConnect(H->dbc, (SQLCHAR *) dbh->data_source, SQL_NTS, (SQLCHAR *) dbh->username, SQL_NTS, (SQLCHAR *) dbh->password, SQL_NTS);
}
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 6fd14a6f68..fdc427d5b0 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -567,7 +567,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
SQLULEN colsize;
SQLLEN displaysize = 0;
- rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname,
+ rc = SQLDescribeCol(S->stmt, colno+1, (SQLCHAR *) S->cols[colno].colname,
sizeof(S->cols[colno].colname)-1, &colnamelen,
&S->cols[colno].coltype, &colsize, NULL, NULL);
@@ -777,7 +777,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val)
switch (attr) {
case PDO_ATTR_CURSOR_NAME:
convert_to_string(val);
- rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val));
+ rc = SQLSetCursorName(S->stmt, (SQLCHAR *) Z_STRVAL_P(val), Z_STRLEN_P(val));
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
return 1;
@@ -806,7 +806,7 @@ static int odbc_stmt_get_attr(pdo_stmt_t *stmt, zend_long attr, zval *val)
{
char buf[256];
SQLSMALLINT len = 0;
- rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len);
+ rc = SQLGetCursorName(S->stmt, (SQLCHAR *) buf, sizeof(buf), &len);
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
ZVAL_STRINGL(val, buf, len);
diff --git a/ext/pdo_odbc/tests/max_columns.phpt b/ext/pdo_odbc/tests/max_columns.phpt
index 027ba2c4da..7174826320 100644
--- a/ext/pdo_odbc/tests/max_columns.phpt
+++ b/ext/pdo_odbc/tests/max_columns.phpt
@@ -3,6 +3,8 @@ PDO ODBC varying character with max/no length
--SKIPIF--
<?php
if (!extension_loaded('pdo_odbc')) print 'skip not loaded';
+require 'ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
?>
--FILE--
<?php