cvs: php4 /ext/sybase_ct php_sybase_ct.c

From: Date: Sat, 13 Jan 2001 22:47:44 +0000
Subject: cvs: php4 /ext/sybase_ct php_sybase_ct.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3599@lists.php.net to get a copy of this message
zeev Sat Jan 13 14:47:44 2001 EDT Modified files: /php4/ext/sybase_ct php_sybase_ct.c Log: Add sybase_get_last_message() from Jan Fedak <J.Fedak@sh.cvut.cz> @- Added sybase_get_last_message() to the Sybase CT module (Jan Fedak) Index: php4/ext/sybase_ct/php_sybase_ct.c diff -u php4/ext/sybase_ct/php_sybase_ct.c:1.39 php4/ext/sybase_ct/php_sybase_ct.c:1.40 --- php4/ext/sybase_ct/php_sybase_ct.c:1.39 Wed Dec 6 18:50:46 2000 +++ php4/ext/sybase_ct/php_sybase_ct.c Sat Jan 13 14:47:44 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sybase_ct.c,v 1.39 2000/12/07 02:50:46 joey Exp $ */ +/* $Id: php_sybase_ct.c,v 1.40 2001/01/13 22:47:44 zeev Exp $ */ #include "php.h" @@ -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) @@ -58,6 +59,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) @@ -202,7 +204,10 @@ 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. */ @@ -226,6 +231,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, @@ -339,7 +346,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; } @@ -361,9 +368,7 @@ SybCtLS_FETCH(); efree(SybCtG(appname)); - if (SybCtG(server_message)) { - efree(SybCtG(server_message)); - } + STR_FREE(SybCtG(server_message)); return SUCCESS; } @@ -1226,6 +1231,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)

« previous php.cvs (#3599) next »