]> granicus.if.org Git - php/commitdiff
Fix signed/unsigned warnings in PDO ODBC
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 14 Dec 2020 09:02:25 +0000 (10:02 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 14 Dec 2020 09:03:56 +0000 (10:03 +0100)
Add add skipif to test.

ext/pdo_odbc/odbc_driver.c
ext/pdo_odbc/odbc_stmt.c
ext/pdo_odbc/tests/max_columns.phpt

index 81e4915da56f15773adcd012a060008f5f17a895..1729cf0fefb6c84a5f8481fd53387d1e3dfb0788 100644 (file)
@@ -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) {
index 6fd14a6f689c49947de66c533ec0d92dc12d1f1e..fdc427d5b00d447a288ff607003504ab89c6e166 100644 (file)
@@ -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);
index 027ba2c4daae3450f8408334e50a87e2e5481f17..71748263201e97fb3daac68e67d15b7a1c384291 100644 (file)
@@ -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