diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-12-14 10:02:25 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-12-14 10:03:56 +0100 |
commit | aa58db723221ec891d4432621003bfa55dc15edf (patch) | |
tree | 9019f47fe16ef465347fc5a6e6be54e3addf524e /ext/pdo_odbc | |
parent | 2b7eb0e26a1816a3c5ddb28dd53f98ae0ecef047 (diff) | |
download | php-git-aa58db723221ec891d4432621003bfa55dc15edf.tar.gz |
Fix signed/unsigned warnings in PDO ODBC
Add add skipif to test.
Diffstat (limited to 'ext/pdo_odbc')
-rw-r--r-- | ext/pdo_odbc/odbc_driver.c | 20 | ||||
-rw-r--r-- | ext/pdo_odbc/odbc_stmt.c | 6 | ||||
-rw-r--r-- | ext/pdo_odbc/tests/max_columns.phpt | 2 |
3 files changed, 15 insertions, 13 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 81e4915da5..1729cf0fef 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 @@ -442,7 +442,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; @@ -456,11 +456,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 |