Hi internals,
the attached patch fixes the setting of packetsize in sybase_ct
extension. Currently the packetsize is set via ct_config() which is not
the right function for this - it should be done via ct_con_props() as
this is a connection property according to Sybase docs.
A small memory leak fix is included as well.
Regards,
-Alex
Index: ext/sybase_ct/php_sybase_ct.c
===================================================================
RCS file: /repository/php-src/ext/sybase_ct/php_sybase_ct.c,v
retrieving revision 1.99
diff -u -r1.99 php_sybase_ct.c
--- ext/sybase_ct/php_sybase_ct.c 29 Jul 2004 19:32:46 -0000 1.99
+++ ext/sybase_ct/php_sybase_ct.c 17 Aug 2004 22:09:52 -0000
@@ -190,6 +190,7 @@
}
}
+ ct_cmd_drop(sybase_ptr->cmd);
ct_con_drop(sybase_ptr->connection);
efree(sybase_ptr);
SybCtG(num_links)--;
@@ -399,14 +400,6 @@
}
}
- /* Set the packet size, which is also per context */
- if (cfg_get_long("sybct.packet_size", &opt)==SUCCESS) {
- CS_INT cs_packet_size = opt;
- if (ct_config(sybase_globals->context, CS_SET, CS_PACKETSIZE, &cs_packet_size, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update the packet size");
- }
- }
-
sybase_globals->num_persistent=0;
sybase_globals->callback_name = NULL;
}
@@ -473,6 +466,7 @@
{
CS_LOCALE *tmp_locale;
TSRMLS_FETCH();
+ long packetsize;
/* set a CS_CONNECTION record */
if (ct_con_alloc(SybCtG(context), &sybase->connection)!=CS_SUCCEED) {
@@ -520,6 +514,12 @@
}
}
}
+
+ if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) {
+ if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize.");
+ }
+ }
/* Set the login timeout. Actually, the login timeout is per context
* and not per connection, but we will update the context here to
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php