1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-5.6'

* PHP-5.6:
  fix column name attribute with ODBC 3.0
  migrate SQLAllocStmt for ODBC 3.0 compliance
This commit is contained in:
Anatol Belski
2015-04-17 17:14:18 +02:00
2 changed files with 18 additions and 16 deletions

View File

@@ -954,7 +954,7 @@ int odbc_bindcols(odbc_result *result)
charextraalloc = 0;
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_DESC_BASE_COLUMN_NAME,
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME,
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
NULL, 0, NULL, &result->values[i].coltype);
@@ -1172,7 +1172,7 @@ PHP_FUNCTION(odbc_prepare)
result->numparams = 0;
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -1609,7 +1609,7 @@ PHP_FUNCTION(odbc_exec)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
efree(result);
@@ -3141,7 +3141,7 @@ PHP_FUNCTION(odbc_tables)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3210,7 +3210,7 @@ PHP_FUNCTION(odbc_columns)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3282,7 +3282,7 @@ PHP_FUNCTION(odbc_columnprivileges)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3360,7 +3360,7 @@ PHP_FUNCTION(odbc_foreignkeys)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3428,7 +3428,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3487,7 +3487,7 @@ PHP_FUNCTION(odbc_primarykeys)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3555,7 +3555,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3624,7 +3624,7 @@ PHP_FUNCTION(odbc_procedures)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3694,7 +3694,7 @@ PHP_FUNCTION(odbc_specialcolumns)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3765,7 +3765,7 @@ PHP_FUNCTION(odbc_statistics)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
@@ -3830,7 +3830,7 @@ PHP_FUNCTION(odbc_tableprivileges)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
efree(result);
php_error_docref(NULL, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");

View File

@@ -283,14 +283,16 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR)
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttribute
#define PHP_ODBC_SQLALLOCSTMT(hdbc, phstmt) SQLAllocHandle(SQL_HANDLE_STMT, hdbc, phstmt)
#define PHP_ODBC_DESC_BASE_COLUMN_NAME SQL_DESC_BASE_COLUMN_NAME
#define PHP_ODBC_SQL_DESC_NAME SQL_DESC_NAME
#else
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttributes
#define PHP_ODBC_SQLALLOCSTMT SQLAllocStmt
#define PHP_ODBC_DESC_BASE_COLUMN_NAME SQL_COLUMN_NAME
#define PHP_ODBC_SQL_DESC_NAME SQL_COLUMN_NAME
#endif
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)