cvs: php4 /ext/fbsql php_fbsql.c php_fbsql.h
| From: | Frank M. Kromann | Date: | Wed, 06 Feb 2002 19:24:03 +0000 |
| Subject: | cvs: php4 /ext/fbsql php_fbsql.c php_fbsql.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9304@lists.php.net to get a copy of this message | ||
fmk Wed Feb 6 14:24:03 2002 EDT
Modified files:
/php4/ext/fbsql php_fbsql.h php_fbsql.c
Log:
Adding fbsql_table_name() aliased fbsql_tablename() for compatibility with MySQL
Index: php4/ext/fbsql/php_fbsql.h
diff -u php4/ext/fbsql/php_fbsql.h:1.18 php4/ext/fbsql/php_fbsql.h:1.19
--- php4/ext/fbsql/php_fbsql.h:1.18 Thu Jan 10 16:56:18 2002
+++ php4/ext/fbsql/php_fbsql.h Wed Feb 6 14:24:02 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fbsql.h,v 1.18 2002/01/10 21:56:18 fmk Exp $ */
+/* $Id: php_fbsql.h,v 1.19 2002/02/06 19:24:02 fmk Exp $ */
#define HAVE_FBSQL 1
@@ -76,6 +76,8 @@
PHP_FUNCTION(fbsql_field_len);
PHP_FUNCTION(fbsql_field_type);
PHP_FUNCTION(fbsql_field_flags);
+PHP_FUNCTION(fbsql_table_name);
+
PHP_FUNCTION(fbsql_set_transaction);
PHP_FUNCTION(fbsql_autocommit);
PHP_FUNCTION(fbsql_commit);
Index: php4/ext/fbsql/php_fbsql.c
diff -u php4/ext/fbsql/php_fbsql.c:1.71 php4/ext/fbsql/php_fbsql.c:1.72
--- php4/ext/fbsql/php_fbsql.c:1.71 Wed Jan 23 12:48:31 2002
+++ php4/ext/fbsql/php_fbsql.c Wed Feb 6 14:24:02 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fbsql.c,v 1.71 2002/01/23 17:48:31 fmk Exp $ */
+/* $Id: php_fbsql.c,v 1.72 2002/02/06 19:24:02 fmk Exp $ */
/* TODO:
*
@@ -206,6 +206,7 @@
PHP_FE(fbsql_field_len, NULL)
PHP_FE(fbsql_field_type, NULL)
PHP_FE(fbsql_field_flags, NULL)
+ PHP_FE(fbsql_table_name, NULL)
/* Fontbase additions: */
PHP_FE(fbsql_set_transaction, NULL)
@@ -233,6 +234,7 @@
/* Aliases: */
PHP_FALIAS(fbsql, fbsql_db_query, NULL)
+ PHP_FALIAS(fbsql_tablename, fbsql_table_name, NULL)
{NULL, NULL, NULL}
};
@@ -3365,7 +3367,50 @@
}
/* }}} */
-/* {{{ proto bool fbsql_free_result(int result)
+/* {{{ proto string fbsql_table_name(resource result, int index)
+ Retreive the table name for index after a call to fbsql_list_tables() */
+PHP_FUNCTION(fbsql_table_name)
+{
+ PHPFBResult* result = NULL;
+ zval **fbsql_result_index = NULL, **table_index;
+ unsigned index;
+ char* value;
+ unsigned int length;
+ void** row;
+
+ switch (ZEND_NUM_ARGS()) {
+ case 2:
+ if (zend_get_parameters_ex(2, &fbsql_result_index, &table_index)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_long_ex(table_index);
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+ ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result",
le_result);
+
+ index = Z_LVAL_PP(table_index);
+ if (index < 0)
+ {
+ if (FB_SQL_G(generateWarnings))
+ php_error(E_WARNING, "Illegal index (%i)", index);
+ RETURN_FALSE;
+ }
+
+ if (result->rowCount == 0x7fffffff) phpfbFetchRow(result, index);
+ if (index > result->rowCount) RETURN_FALSE;
+ result->rowIndex = index;
+ result->columnIndex = 0;
+
+ row = fbcrhRowAtIndex(result->rowHandler, index);
+ phpfbColumnAsString(result, 0, row[0], &length, &value);
+ RETURN_STRINGL(value, length, 1);
+}
+/* }}} */
+
+/* {{{ proto bool fbsql_free_result(resource result)
free the memory used to store a result */
PHP_FUNCTION(fbsql_free_result)
{