summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-08-22 11:09:12 +0000
committerAntony Dovgal <tony2001@php.net>2006-08-22 11:09:12 +0000
commit08a9ab02ba56fbf43062073a3749407645698b51 (patch)
tree6e31d949765451bbbea08186782983971193d6ed
parent7dfbf5b2e4dc4030dbbe137e7d4b52f15e43e5bd (diff)
downloadphp-git-08a9ab02ba56fbf43062073a3749407645698b51.tar.gz
minor improvements
-rw-r--r--ext/oci8/oci8.c10
-rw-r--r--ext/oci8/oci8_interface.c7
-rw-r--r--ext/oci8/oci8_lob.c2
-rw-r--r--ext/oci8/oci8_statement.c6
-rw-r--r--ext/oci8/php_oci8_int.h6
-rw-r--r--ext/oci8/tests/statement_cache.phpt4
6 files changed, 17 insertions, 18 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index b488524ae4..3a4b3c35c9 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -897,12 +897,12 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
if (error_code) {
int tmp_buf_len = strlen(tmp_buf);
- if (tmp_buf[tmp_buf_len - 1] == '\n') {
+ if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') {
tmp_buf[tmp_buf_len - 1] = '\0';
}
- if (error_buf) {
+ if (tmp_buf_len && error_buf) {
*error_buf = NULL;
- *error_buf = estrndup(tmp_buf, tmp_buf_len + 1);
+ *error_buf = estrndup(tmp_buf, tmp_buf_len);
}
}
return error_code;
@@ -1142,7 +1142,7 @@ open:
if (alloc_non_persistent) {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
- connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1);
+ connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
connection->is_persistent = 0;
} else {
connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
@@ -1151,7 +1151,7 @@ open:
}
} else {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
- connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1);
+ connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
connection->is_persistent = 0;
}
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 6964cc3e1a..ce8fafb478 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -1636,15 +1636,14 @@ PHP_FUNCTION(oci_parse)
php_oci_statement *statement;
char *query;
int query_len;
- zend_bool cached = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &z_connection, &query, &query_len, &cached) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) {
return;
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- statement = php_oci_statement_create(connection, query, query_len, cached TSRMLS_CC);
+ statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC);
if (statement) {
RETURN_RESOURCE(statement->id);
@@ -1748,7 +1747,7 @@ PHP_FUNCTION(oci_new_cursor)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- statement = php_oci_statement_create(connection, NULL, 0, 0 TSRMLS_CC);
+ statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC);
if (statement) {
RETURN_RESOURCE(statement->id);
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index c19b9c6ced..326811df71 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -479,7 +479,7 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS
/* {{{ php_oci_lob_get_buffering()
Return current buffering state for the LOB */
-int php_oci_lob_get_buffering (php_oci_descriptor *descriptor TSRMLS_DC)
+int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
{
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
return 1;
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index c504b8db36..a481607ba7 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -43,7 +43,7 @@
/* {{{ php_oci_statement_create()
Create statemend handle and allocate necessary resources */
-php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, long query_len, zend_bool cached TSRMLS_DC)
+php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, int query_len TSRMLS_DC)
{
php_oci_statement *statement;
@@ -258,7 +258,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
/* {{{ php_oci_statement_get_column()
Get column from the result set */
-php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, long column_name_len TSRMLS_DC)
+php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC)
{
php_oci_out_column *column = NULL;
int i;
@@ -485,7 +485,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
buf = 0;
switch (outcol->data_type) {
case SQLT_RSET:
- outcol->statement = php_oci_statement_create(statement->connection, NULL, 0, 0 TSRMLS_CC);
+ outcol->statement = php_oci_statement_create(statement->connection, NULL, 0 TSRMLS_CC);
outcol->stmtid = outcol->statement->id;
outcol->statement->nested = 1;
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index b3b902347f..65020b8c31 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -327,7 +327,7 @@ int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC
int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
int php_oci_lob_flush (php_oci_descriptor *, int TSRMLS_DC);
int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
-int php_oci_lob_get_buffering (php_oci_descriptor * TSRMLS_DC);
+int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
#ifdef HAVE_OCI8_TEMP_LOB
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
@@ -372,10 +372,10 @@ int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC
/* statement related prototypes {{{ */
-php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, long, zend_bool TSRMLS_DC);
+php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC);
int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
-php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, long TSRMLS_DC);
+php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC);
int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
diff --git a/ext/oci8/tests/statement_cache.phpt b/ext/oci8/tests/statement_cache.phpt
index e7c8911e88..19e69d4c21 100644
--- a/ext/oci8/tests/statement_cache.phpt
+++ b/ext/oci8/tests/statement_cache.phpt
@@ -9,11 +9,11 @@ require dirname(__FILE__)."/connect.inc";
$pc = oci_pconnect($user, $password, $dbase);
-$stmt = oci_parse($pc, "select 1+3 from dual", true);
+$stmt = oci_parse($pc, "select 1+3 from dual");
oci_execute($stmt);
var_dump(oci_fetch_array($stmt));
-$stmt = oci_parse($pc, "select 1+3 from dual", true);
+$stmt = oci_parse($pc, "select 1+3 from dual");
oci_execute($stmt);
var_dump(oci_fetch_array($stmt));