Hello.
sybase module exports a handy function called sybase_get_last_message().
we used to use it. but then we had to switch to sybase_ct module and it
doesn't have it.
the attached patch should fix it.
please consider adding it.
Jan
--
Jan Fedak talk:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Linux - the ultimate NT Service Pack.
diff -uNr php-4.0.3pl1/ext/sybase_ct/php_sybase_ct.c
php-4.0.3pl1-patched/ext/sybase_ct/php_sybase_ct.c
--- php-4.0.3pl1/ext/sybase_ct/php_sybase_ct.c Fri Jan 5 12:18:26 2001
+++ php-4.0.3pl1-patched/ext/sybase_ct/php_sybase_ct.c Fri Jan 5 12:15:20 2001
@@ -39,6 +39,7 @@
PHP_FE(sybase_select_db, NULL)
PHP_FE(sybase_query, NULL)
PHP_FE(sybase_free_result, NULL)
+ PHP_FE(sybase_get_last_message, NULL)
PHP_FE(sybase_num_rows, NULL)
PHP_FE(sybase_num_fields, NULL)
PHP_FE(sybase_fetch_row, NULL)
@@ -57,6 +58,7 @@
PHP_FALIAS(mssql_select_db, sybase_select_db,
NULL)
PHP_FALIAS(mssql_query, sybase_query,
NULL)
PHP_FALIAS(mssql_free_result, sybase_free_result, NULL)
+ PHP_FALIAS(mssql_get_last_message, sybase_get_last_message,NULL)
PHP_FALIAS(mssql_num_rows, sybase_num_rows,
NULL)
PHP_FALIAS(mssql_num_fields, sybase_num_fields, NULL)
PHP_FALIAS(mssql_fetch_row, sybase_fetch_row,
NULL)
@@ -194,6 +196,9 @@
if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) {
php_error(E_WARNING, "Sybase: Client message: %s (severity %d)",
errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber));
}
+ STR_FREE(SybCtG(server_message));
+ SybCtG(server_message) = estrdup(errmsg->msgstring);
+
/* If this is a timeout message, return CS_FAIL to cancel the
* operation and mark the connection as dead.
@@ -218,6 +223,8 @@
php_error(E_WARNING, "Sybase: Server message: %s (severity %d,
procedure %s)",
srvmsg->text, srvmsg->severity,
((srvmsg->proclen>0) ? srvmsg->proc : "N/A"));
}
+ STR_FREE(SybCtG(server_message));
+ SybCtG(server_message) = estrdup(srvmsg->text);
/* If this is a deadlock message, set the connection's deadlock flag
* so we will retry the request. Sorry about the bare constant here,
@@ -338,7 +345,7 @@
SybCtG(default_link)=-1;
SybCtG(num_links) = SybCtG(num_persistent);
SybCtG(appname) = estrndup("PHP 4.0", 7);
- SybCtG(server_message) = NULL;
+ SybCtG(server_message) = empty_string;
return SUCCESS;
}
@@ -360,9 +367,7 @@
SybCtLS_FETCH();
efree(SybCtG(appname));
- if (SybCtG(server_message)) {
- efree(SybCtG(server_message));
- }
+ STR_FREE(SybCtG(server_message));
return SUCCESS;
}
@@ -1221,6 +1226,16 @@
RETURN_TRUE;
}
+/* }}} */
+
+/* {{{ proto string sybase_get_last_message(void)
+ Returns the last message from server (over min_message_severity) */
+PHP_FUNCTION(sybase_get_last_message)
+{
+ SybCtLS_FETCH();
+
+ RETURN_STRING(SybCtG(server_message),1);
+}
/* }}} */
/* {{{ proto int sybase_num_rows(int result)
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]