php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #81071
Patch pdo_firebird_getcolumnmeta.diff revision 2021-05-22 15:53 UTC by roman dot vanicek at gmail dot com

Patch pdo_firebird_getcolumnmeta.diff for PDO Firebird Bug #81071

Patch version 2021-05-22 15:53 UTC

Return to Bug #81071 | Download this patch
Patch Revisions:

Developer: roman.vanicek@gmail.com

820a821,889
> static int firebird_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value) /* {{{ */
> {
> 	pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
> 
> 	if (colno >= stmt->column_count) {
> 		return FAILURE;
> 	}
> 
> 	XSQLVAR const *var = &S->out_sqlda.sqlvar[colno];
> 
> 	array_init(return_value);
> 
> 	switch (var->sqltype & ~1) {
> 		case SQL_VARYING:
> 			add_assoc_string(return_value, "native_type", "varchar");
> 			break;
> 		case SQL_TEXT:
> 			add_assoc_string(return_value, "native_type", "char");
> 			break;
> 		case SQL_SHORT:
> 			if (var->sqlscale < 0)
> 				add_assoc_string(return_value, "native_type", "decimal");
> 			else
> 				add_assoc_string(return_value, "native_type", "smallint");
> 			break;
> 		case SQL_LONG:
> 			if (var->sqlscale < 0)
> 				add_assoc_string(return_value, "native_type", "decimal");
> 			else
> 				add_assoc_string(return_value, "native_type", "int");
> 			break;
> 		case SQL_INT64:
> 			if (var->sqlscale < 0)
> 				add_assoc_string(return_value, "native_type", "decimal");
> 			else
> 				add_assoc_string(return_value, "native_type", "bigint");
> 			break;
> 		case SQL_FLOAT:
> 			add_assoc_string(return_value, "native_type", "float");
> 			break;
> 		case SQL_DOUBLE:
> 			add_assoc_string(return_value, "native_type", "double precision");
> 			break;
> 		case SQL_BOOLEAN:
> 			add_assoc_string(return_value, "native_type", "boolean");
> 			break;
> 		case SQL_TYPE_DATE:
> 			add_assoc_string(return_value, "native_type", "date");
> 			break;
> 		case SQL_TYPE_TIME:
> 			add_assoc_string(return_value, "native_type", "time");
> 			break;
> 		case SQL_TIMESTAMP:
> 			add_assoc_string(return_value, "native_type", "timestamp");
> 			break;
> 		case SQL_BLOB:
> 			if (var->sqlsubtype == 1)
> 				add_assoc_string(return_value, "native_type", "blob sub_type text");
> 			else
> 				add_assoc_string(return_value, "native_type", "blob");
> 			break;
> 		default:
> 			add_assoc_string(return_value, "native_type", "unknown");
> 	}
> 
> 	return 1;
> }
> /* }}} */
> 
846c915
< 	NULL, /* get_column_meta_func */
---
> 	firebird_stmt_get_column_meta,
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 09:01:29 2024 UTC