mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 11:10:49 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f06e773c8 |
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(enchant,for ENCHANT support,
|
||||
[ --with-enchant[=DIR] Include enchant support.
|
||||
GNU Aspell version 1.1.3 or higher required.])
|
||||
|
||||
if test "$PHP_ENCHANT" != "no"; then
|
||||
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
|
||||
if test "$PHP_ENCHANT" != "yes"; then
|
||||
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
|
||||
else
|
||||
ENCHANT_SEARCH_DIRS="/usr/local /usr"
|
||||
fi
|
||||
for i in $ENCHANT_SEARCH_DIRS; do
|
||||
if test -f $i/include/enchant/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include/enchant
|
||||
elif test -f $i/include/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$ENCHANT_DIR"; then
|
||||
AC_MSG_ERROR(Cannot find enchant)
|
||||
fi
|
||||
|
||||
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
|
||||
|
||||
AC_DEFINE(HAVE_ENCHANT,1,[ ])
|
||||
PHP_SUBST(ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
|
||||
fi
|
||||
@@ -0,0 +1,9 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_ENABLE("enchant", "Enchant Support", "no");
|
||||
|
||||
if (PHP_ENCHANT == "yes") {
|
||||
EXTENSION("enchant", "enchant.c");
|
||||
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$tag = 'en_US';
|
||||
$r = enchant_broker_init();
|
||||
$bprovides = enchant_broker_describe($r);
|
||||
echo "Current broker provides the following backend(s):\n";
|
||||
print_r($bprovides);
|
||||
|
||||
|
||||
if (enchant_broker_dict_exists($r,$tag)) {
|
||||
$d = enchant_broker_request_dict($r, $tag);
|
||||
$dprovides = enchant_dict_describe($d);
|
||||
echo "dictionary $tag provides:\n";
|
||||
$spellerrors = enchant_dict_check($d, "soong");
|
||||
print_r($dprovides);
|
||||
echo "found $spellerrors spell errors\n";
|
||||
if ($spellerrors) {
|
||||
$suggs = enchant_dict_suggest($d, "soong");
|
||||
echo "Suggestions for 'soong':";
|
||||
print_r($suggs);
|
||||
}
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
?>
|
||||
Executable
+715
@@ -0,0 +1,715 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "enchant.h"
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_enchant.h"
|
||||
|
||||
|
||||
typedef EnchantBroker * EnchantBrokerPtr;
|
||||
typedef struct _broker_struct enchant_broker;
|
||||
typedef struct _dict_struct enchant_dict;
|
||||
|
||||
typedef enchant_broker * enchant_brokerPtr;
|
||||
typedef enchant_dict * enchant_dictPtr;
|
||||
|
||||
typedef struct _broker_struct {
|
||||
EnchantBroker *pbroker;
|
||||
enchant_dict **dict;
|
||||
unsigned int dictcnt;
|
||||
zval *rsrc_id;
|
||||
} _enchant_broker;
|
||||
|
||||
typedef struct _dict_struct {
|
||||
unsigned int id;
|
||||
EnchantDict *pdict;
|
||||
enchant_broker *pbroker;
|
||||
zval *rsrc_id;
|
||||
enchant_dict *next;
|
||||
enchant_dict *prev;
|
||||
} _enchant_dict;
|
||||
|
||||
|
||||
/* True global resources - no need for thread safety here */
|
||||
static int le_enchant_broker;
|
||||
static int le_enchant_dict;
|
||||
|
||||
/* If you declare any globals in php_enchant.h uncomment this:*/
|
||||
/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
|
||||
|
||||
/* {{{ enchant_functions[]
|
||||
*
|
||||
* Every user visible function must have an entry in enchant_functions[].
|
||||
*/
|
||||
function_entry enchant_functions[] = {
|
||||
PHP_FE(enchant_broker_init, NULL)
|
||||
PHP_FE(enchant_broker_free, NULL)
|
||||
PHP_FE(enchant_broker_get_error, NULL)
|
||||
PHP_FE(enchant_broker_request_dict, NULL)
|
||||
PHP_FE(enchant_broker_request_pwl_dict, NULL)
|
||||
PHP_FE(enchant_broker_free_dict, NULL)
|
||||
PHP_FE(enchant_broker_dict_exists, NULL)
|
||||
PHP_FE(enchant_broker_set_ordering, NULL)
|
||||
PHP_FE(enchant_broker_describe, NULL)
|
||||
PHP_FE(enchant_dict_check, NULL)
|
||||
PHP_FE(enchant_dict_suggest, NULL)
|
||||
PHP_FE(enchant_dict_add_to_personal, NULL)
|
||||
PHP_FE(enchant_dict_add_to_session, NULL)
|
||||
PHP_FE(enchant_dict_is_in_session, NULL)
|
||||
PHP_FE(enchant_dict_store_replacement, NULL)
|
||||
PHP_FE(enchant_dict_get_error, NULL)
|
||||
PHP_FE(enchant_dict_describe, NULL)
|
||||
|
||||
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ enchant_module_entry
|
||||
*/
|
||||
zend_module_entry enchant_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"enchant",
|
||||
enchant_functions,
|
||||
PHP_MINIT(enchant),
|
||||
PHP_MSHUTDOWN(enchant),
|
||||
NULL, /* Replace with NULL if there's nothing to do at request start */
|
||||
NULL, /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(enchant),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#ifdef COMPILE_DL_ENCHANT
|
||||
ZEND_GET_MODULE(enchant)
|
||||
#endif
|
||||
|
||||
static void
|
||||
enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
zval *tmp_array;
|
||||
|
||||
MAKE_STD_ZVAL(tmp_array);
|
||||
array_init(tmp_array);
|
||||
|
||||
add_assoc_string(tmp_array, "name", (char *)name, 1);
|
||||
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
|
||||
add_assoc_string(tmp_array, "file", (char *)file, 1);
|
||||
|
||||
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
|
||||
array_init(zdesc);
|
||||
}
|
||||
|
||||
add_next_index_zval(zdesc, tmp_array);
|
||||
}
|
||||
|
||||
static void
|
||||
describe_dict_fn (const char * const lang,
|
||||
const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
zval *tmp_array;
|
||||
|
||||
MAKE_STD_ZVAL(tmp_array);
|
||||
array_init(tmp_array);
|
||||
|
||||
add_assoc_string(tmp_array, "lang", (char *)lang, 1);
|
||||
add_assoc_string(tmp_array, "name", (char *)name, 1);
|
||||
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
|
||||
add_assoc_string(tmp_array, "file", (char *)file, 1);
|
||||
|
||||
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
|
||||
array_init(zdesc);
|
||||
}
|
||||
|
||||
add_next_index_zval(zdesc, tmp_array);
|
||||
}
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
int total, tofree;
|
||||
if (rsrc->ptr) {
|
||||
enchant_broker *broker = (enchant_broker *)rsrc->ptr;
|
||||
if (broker) {
|
||||
if (broker->pbroker) {
|
||||
if (broker->dictcnt && broker->dict) {
|
||||
if (broker->dict) {
|
||||
tofree = total = broker->dictcnt-1;
|
||||
do {
|
||||
printf("broker free, dict id: %i\n", broker->dict[total]->id);
|
||||
zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
|
||||
efree(broker->dict[total]);
|
||||
total--;
|
||||
} while (total>=0);
|
||||
}
|
||||
efree(broker->dict);
|
||||
broker->dict = NULL;
|
||||
}
|
||||
enchant_broker_free(broker->pbroker);
|
||||
}
|
||||
efree(broker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
int prev;
|
||||
|
||||
if (rsrc->ptr) {
|
||||
enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
|
||||
if (pdict) {
|
||||
if (pdict->pdict && pdict->pbroker) {
|
||||
enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
|
||||
}
|
||||
prev = -pdict->pbroker->dictcnt;
|
||||
printf("id:%i\n",pdict->id);
|
||||
if (pdict->id) {
|
||||
pdict->pbroker->dict[pdict->id-1]->next = NULL;
|
||||
}
|
||||
//efree(pdict);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(enchant)
|
||||
{
|
||||
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
|
||||
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MSHUTDOWN_FUNCTION
|
||||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
static void __enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
php_info_print_table_row(3, name, desc, file);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(enchant)
|
||||
{
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "enchant support", "enabled");
|
||||
php_info_print_table_row(2, "Version", "@version@");
|
||||
php_info_print_table_row(2, "Revision", "$Revision$");
|
||||
php_info_print_table_row(1, "Provides");
|
||||
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_new([int weekstart])
|
||||
create a new broker object capable of requesting */
|
||||
PHP_FUNCTION(enchant_broker_init)
|
||||
{
|
||||
enchant_broker *broker;
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
if ( ZEND_NUM_ARGS() ) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
|
||||
}
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
|
||||
if (pbroker) {
|
||||
broker = (enchant_broker *) safe_emalloc(sizeof(enchant_broker), 1, 0);
|
||||
broker->pbroker = pbroker;
|
||||
broker->dict = NULL;
|
||||
broker->dictcnt = 0;
|
||||
ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
|
||||
broker->rsrc_id = return_value;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto boolean enchant_free(resource broker)
|
||||
Destroys the broker object and its dictionnaries */
|
||||
PHP_FUNCTION(enchant_broker_free)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker);
|
||||
zend_list_delete(Z_RESVAL_P(broker));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string enchant_broker_get_error(resource broker)
|
||||
Returns the last error of the broker */
|
||||
PHP_FUNCTION(enchant_broker_get_error)
|
||||
{
|
||||
zval *broker;
|
||||
char *msg=NULL;
|
||||
enchant_broker *pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant broker", le_enchant_broker);
|
||||
|
||||
if (pbroker) {
|
||||
if (pbroker->pbroker) {
|
||||
msg = enchant_broker_get_error(pbroker->pbroker);
|
||||
}
|
||||
}
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
|
||||
create a new dict using tag, the non-empty language tag you wish to request
|
||||
a dictionary for ("en_US", "de_DE", ...) */
|
||||
PHP_FUNCTION(enchant_broker_request_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *tag;
|
||||
int taglen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant broker", le_enchant_broker);
|
||||
if (pbroker) {
|
||||
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
pos = pbroker->dictcnt++;
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)safe_emalloc(sizeof(enchant_dict *), 1, 0);
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
printf("new id: %i\n", pos);
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)safe_emalloc(sizeof(enchant_dict), 1, 0);
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos?pbroker->dict[pos-1]:NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string tag)
|
||||
creates a dictionnary using a PWL file. A PWL file is personal word file one word per line.
|
||||
It must exists before the call.*/
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *pwl;
|
||||
long pwllen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant broker", le_enchant_broker);
|
||||
if (pbroker) {
|
||||
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pos = pbroker->dictcnt++;
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)safe_emalloc(sizeof(enchant_dict *), 1, 0);
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)safe_emalloc(sizeof(enchant_dict), 1, 0);
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos?pbroker->dict[pos-1]:NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_free_dict(resource dict)
|
||||
Free the dictionary resource */
|
||||
PHP_FUNCTION(enchant_broker_free_dict)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
zend_list_delete(Z_RESVAL_P(dict));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_new_dmy(resource broker, string tag)
|
||||
Wether a dictionary exists or not. Using non-empty tag */
|
||||
PHP_FUNCTION(enchant_broker_dict_exists)
|
||||
{
|
||||
zval *broker;
|
||||
char *tag;
|
||||
long taglen = 0;
|
||||
enchant_broker * pbroker;
|
||||
int exists = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker);
|
||||
if (pbroker && taglen) {
|
||||
if (pbroker->pbroker) {
|
||||
exists = enchant_broker_dict_exists(pbroker->pbroker, tag);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ressource broker invalid");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto resource enchant_broker_set_ordering(resource broker, string tag, string ordering)
|
||||
Declares a preference of dictionaries to use for the language
|
||||
described/referred to by 'tag'. The ordering is a comma delimited
|
||||
list of provider names. As a special exception, the "*" tag can
|
||||
be used as a language tag to declare a default ordering for any
|
||||
language that does not explictly declare an ordering. */
|
||||
|
||||
PHP_FUNCTION(enchant_broker_set_ordering)
|
||||
{
|
||||
zval *broker;
|
||||
char *pordering;
|
||||
int porderinglen;
|
||||
char *ptag;
|
||||
int ptaglen;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant broker", le_enchant_broker);
|
||||
if (pbroker->pbroker) {
|
||||
enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ressource broker invalid");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_broker_describe(resource broker)
|
||||
Enumerates the Enchant providers and tells
|
||||
you some rudimentary information about them. The same info is provided through phpinfo() */
|
||||
PHP_FUNCTION(enchant_broker_describe)
|
||||
{
|
||||
EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
|
||||
zval *broker;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant broker", le_enchant_broker);
|
||||
if (pbroker->pbroker) {
|
||||
enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ressource broker invalid");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto long enchant_dict_check(resource broker)
|
||||
0 if the word is correctly spelled, positive if not, negative if error */
|
||||
PHP_FUNCTION(enchant_dict_check)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
enchant_dict *pdict;
|
||||
int results;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &results) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
results = enchant_dict_check( pdict->pdict, word, strlen(word));
|
||||
RETURN_LONG((long)results);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_dict_suggest(resource broker, string word)
|
||||
Will return an list of values if any of those pre-conditions are not met.*/
|
||||
PHP_FUNCTION(enchant_dict_suggest)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
long wordlen;
|
||||
char **suggs;
|
||||
enchant_dict *pdict;
|
||||
int i;
|
||||
int n_sugg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, strlen(word), &n_sugg);
|
||||
if (suggs && n_sugg) {
|
||||
array_init(return_value);
|
||||
for (i=0; i<n_sugg; i++) {
|
||||
add_next_index_string(return_value, suggs[i], 1);
|
||||
}
|
||||
}
|
||||
enchant_dict_free_suggestions(pdict->pdict, suggs);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_dict_add_to_personal(resource broker)
|
||||
A list of UTF-8 encoded suggestions, or false */
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
long wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_add_to_session(resource broker, string word)
|
||||
add 'word' to this spell-checking session */
|
||||
PHP_FUNCTION(enchant_dict_add_to_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
long wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
enchant_dict_add_to_session(pdict->pdict, word, wordlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_is_in_session(resource broker)
|
||||
whether or not 'word' exists in this spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_is_in_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
long wordlen;
|
||||
long result=0;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
result = (long)enchant_dict_is_in_session(pdict->pdict, word, wordlen);
|
||||
}
|
||||
}
|
||||
RETURN_BOOL(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_dict_store_replacement(resource broker, string mis, string cor)
|
||||
add a correction for 'mis' using 'cor'.
|
||||
Notes that you replaced @mis with @cor, so it's possibly more likely
|
||||
that future occurrences of @mis will be replaced with @cor. So it might
|
||||
bump @cor up in the suggestion list.*/
|
||||
PHP_FUNCTION(enchant_dict_store_replacement)
|
||||
{
|
||||
zval *dict;
|
||||
char *mis;
|
||||
long mislen;
|
||||
char *cor;
|
||||
long corlen;
|
||||
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_dict_get_error(resource dict)
|
||||
Returns the last error of the current spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_get_error)
|
||||
{
|
||||
zval *dict;
|
||||
char *msg=NULL;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_broker *, &dict, -1, "enchant broker", le_enchant_broker);
|
||||
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
msg = enchant_dict_get_error(pdict->pdict);
|
||||
}
|
||||
}
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_dict_describe(resource dict)
|
||||
Describes an individual dictionary 'dict' */
|
||||
PHP_FUNCTION(enchant_dict_describe)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict);
|
||||
if (pdict) {
|
||||
if (pdict->pdict) {
|
||||
enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>enchant</name>
|
||||
<summary>Date and Time Library</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>pajoye</user>
|
||||
<name>Pierre-Alain Joye</name>
|
||||
<email>paj@pearfr.org</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>Enchant is a binder for libenchant. Libenchant provides a common
|
||||
API for many spell libraries:
|
||||
- aspell/pspell (intended to replace ispell)
|
||||
- hspell (hebrew)
|
||||
- ispell
|
||||
- myspell (OpenOffice project, mozilla)
|
||||
- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
|
||||
A plugin system allows to add custom spell support.
|
||||
see www.abisource.com/enchant/</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>alpha</state>
|
||||
<version>0.1</version>
|
||||
<date>2004-03-08</date>
|
||||
<notes>Initial release</notes>
|
||||
<filelist>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="config.w32"/>
|
||||
<file role="src" name="enchant.c"/>
|
||||
<file role="src" name="php_enchant.h"/>
|
||||
<dir name="docs" role="doc">
|
||||
<dir name="examples">
|
||||
<file name="example1.php"/>
|
||||
</dir>
|
||||
</dir>
|
||||
</filelist>
|
||||
<configureoptions>
|
||||
<configureoption name="with-enchant" default="shared" prompt="libenchant prefix?"/>
|
||||
</configureoptions>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="5" />
|
||||
</deps>
|
||||
</release>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef PHP_ENCHANT_H
|
||||
#define PHP_ENCHANT_H
|
||||
|
||||
extern zend_module_entry enchant_module_entry;
|
||||
#define phpext_enchant_ptr &enchant_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_ENCHANT_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_ENCHANT_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
PHP_MINIT_FUNCTION(enchant);
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant);
|
||||
PHP_MINFO_FUNCTION(enchant);
|
||||
|
||||
PHP_FUNCTION(enchant_broker_init);
|
||||
PHP_FUNCTION(enchant_broker_free);
|
||||
PHP_FUNCTION(enchant_broker_get_error);
|
||||
PHP_FUNCTION(enchant_broker_request_dict);
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict);
|
||||
PHP_FUNCTION(enchant_broker_free_dict);
|
||||
PHP_FUNCTION(enchant_broker_dict_exists);
|
||||
PHP_FUNCTION(enchant_broker_set_ordering);
|
||||
PHP_FUNCTION(enchant_broker_describe);
|
||||
|
||||
PHP_FUNCTION(enchant_dict_check);
|
||||
PHP_FUNCTION(enchant_dict_suggest);
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal);
|
||||
PHP_FUNCTION(enchant_dict_add_to_session);
|
||||
PHP_FUNCTION(enchant_dict_is_in_session);
|
||||
PHP_FUNCTION(enchant_dict_store_replacement);
|
||||
PHP_FUNCTION(enchant_dict_get_error);
|
||||
PHP_FUNCTION(enchant_dict_describe);
|
||||
|
||||
#ifdef ZTS
|
||||
#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
|
||||
#else
|
||||
#define ENCHANT_G(v) (enchant_globals.v)
|
||||
#endif
|
||||
|
||||
#endif /* PHP_ENCHANT_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileinfo
|
||||
Ilia Alshanetsky
|
||||
Whitespace-only changes.
@@ -0,0 +1,54 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension fileinfo
|
||||
|
||||
PHP_ARG_WITH(fileinfo, for fileinfo support,
|
||||
[ --with-fileinfo=DIR Include fileinfo support])
|
||||
|
||||
if test "$PHP_FILEINFO" != "no"; then
|
||||
SEARCH_PATH="/usr/local /usr"
|
||||
SEARCH_FOR="/include/magic.h"
|
||||
if test -r $PHP_FILEINFO/$SEARCH_FOR; then
|
||||
FILEINFO_DIR=$PHP_FILEINFO
|
||||
else
|
||||
AC_MSG_CHECKING([for magic files in default path])
|
||||
for i in $SEARCH_PATH ; do
|
||||
if test -r $i/$SEARCH_FOR; then
|
||||
FILEINFO_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$FILEINFO_DIR"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([Please reinstall the libmagic distribution])
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($FILEINFO_DIR/include)
|
||||
|
||||
LIBNAME=magic
|
||||
LIBSYMBOL=magic_open
|
||||
|
||||
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FILEINFO_DIR/lib, FILEINFO_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_FILEINFOLIB,1,[ ])
|
||||
],[
|
||||
AC_MSG_ERROR([wrong magic lib version or lib not found])
|
||||
],[
|
||||
-L$FILEINFO_DIR/lib -lm -ldl
|
||||
])
|
||||
|
||||
MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /etc/magic"
|
||||
for i in $MAGIC_MIME_LOCATIONS; do
|
||||
if test -f $i; then
|
||||
PHP_DEFAULT_MAGIC_FILE=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
|
||||
|
||||
PHP_SUBST(FILEINFO_SHARED_LIBADD)
|
||||
|
||||
PHP_NEW_EXTENSION(fileinfo, fileinfo.c, $ext_shared)
|
||||
fi
|
||||
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Ilia Alshanetsky <ilia@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <magic.h>
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/file.h" /* needed for context stuff */
|
||||
#include "php_fileinfo.h"
|
||||
#include "fopen_wrappers.h" /* needed for is_url */
|
||||
|
||||
struct php_fileinfo {
|
||||
long options;
|
||||
struct magic_set *magic;
|
||||
};
|
||||
|
||||
#ifndef PHP_DEFAULT_MAGIC_FILE
|
||||
#define PHP_DEFAULT_MAGIC_FILE NULL
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_ENGINE_2
|
||||
|
||||
static zend_object_handlers finfo_object_handlers;
|
||||
zend_class_entry *finfo_class_entry;
|
||||
|
||||
struct finfo_object {
|
||||
zend_object zo;
|
||||
struct php_fileinfo *ptr;
|
||||
};
|
||||
|
||||
#define FILEINFO_DECLARE_INIT_OBJECT(object) \
|
||||
zval *object = getThis();
|
||||
|
||||
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) \
|
||||
{ \
|
||||
struct finfo_object *obj; \
|
||||
obj = (struct finfo_object*)zend_object_store_get_object(_object TSRMLS_CC); \
|
||||
obj->ptr = _ptr; \
|
||||
}
|
||||
|
||||
#define FILEINFO_FROM_OBJECT(finfo, object) \
|
||||
{ \
|
||||
struct finfo_object *obj = zend_object_store_get_object(object TSRMLS_CC); \
|
||||
finfo = obj->ptr; \
|
||||
if (!finfo) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The invalid fileinfo object."); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* {{{ finfo_objects_dtor
|
||||
*/
|
||||
static void finfo_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
|
||||
{
|
||||
struct finfo_object *intern = (struct finfo_object *) object;
|
||||
|
||||
if (intern->ptr) {
|
||||
magic_close(intern->ptr->magic);
|
||||
efree(intern->ptr);
|
||||
}
|
||||
|
||||
efree(intern);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ finfo_objects_new
|
||||
*/
|
||||
PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
zend_object_value retval;
|
||||
struct finfo_object *intern;
|
||||
|
||||
intern = emalloc(sizeof(struct finfo_object));
|
||||
intern->zo.ce = class_type;
|
||||
intern->zo.in_get = 0;
|
||||
intern->zo.in_set = 0;
|
||||
intern->zo.properties = NULL;
|
||||
intern->ptr = NULL;
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);
|
||||
retval.handlers = (zend_object_handlers *) &finfo_object_handlers;
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ finfo_class_functions
|
||||
*/
|
||||
function_entry finfo_class_functions[] = {
|
||||
ZEND_ME_MAPPING(finfo, finfo_open, NULL)
|
||||
ZEND_ME_MAPPING(set_flags, finfo_set_flags,NULL)
|
||||
ZEND_ME_MAPPING(file, finfo_file, NULL)
|
||||
ZEND_ME_MAPPING(buffer, finfo_buffer, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#else
|
||||
|
||||
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) {}
|
||||
#define FILEINFO_FROM_OBJECT(socket_id, object) {}
|
||||
|
||||
#define FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
#define object 0
|
||||
|
||||
#endif
|
||||
|
||||
#define FINFO_SET_OPTION(magic, options) \
|
||||
if (magic_setflags(magic, options) == -1) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
|
||||
options, magic_errno(magic), magic_error(magic)); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* True global resources - no need for thread safety here */
|
||||
static int le_fileinfo;
|
||||
|
||||
void finfo_resource_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
struct php_fileinfo *finfo = (struct php_fileinfo *) rsrc->ptr;
|
||||
magic_close(finfo->magic);
|
||||
efree(rsrc->ptr);
|
||||
rsrc->ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ fileinfo_functions[]
|
||||
*/
|
||||
function_entry fileinfo_functions[] = {
|
||||
PHP_FE(finfo_open, NULL)
|
||||
PHP_FE(finfo_close, NULL)
|
||||
PHP_FE(finfo_set_flags, NULL)
|
||||
PHP_FE(finfo_file, NULL)
|
||||
PHP_FE(finfo_buffer, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(finfo)
|
||||
{
|
||||
#ifdef ZEND_ENGINE_2
|
||||
zend_class_entry _finfo_class_entry;
|
||||
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
|
||||
_finfo_class_entry.create_object = finfo_objects_new;
|
||||
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC);
|
||||
|
||||
/* copy the standard object handlers to you handler table */
|
||||
memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
#endif /* ZEND_ENGINE_2 */
|
||||
|
||||
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
|
||||
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ fileinfo_module_entry
|
||||
*/
|
||||
zend_module_entry fileinfo_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"fileinfo",
|
||||
fileinfo_functions,
|
||||
PHP_MINIT(finfo),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(fileinfo),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#ifdef COMPILE_DL_FILENINFO
|
||||
ZEND_GET_MODULE(fileinfo)
|
||||
#endif
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(fileinfo)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "fileinfo support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource finfo_open([int options [, string arg]])
|
||||
Create a new fileinfo resource. */
|
||||
PHP_FUNCTION(finfo_open)
|
||||
{
|
||||
long options = MAGIC_NONE;
|
||||
char *file = PHP_DEFAULT_MAGIC_FILE;
|
||||
int file_len = 0;
|
||||
struct php_fileinfo *finfo;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
char resolved_path[MAXPATHLEN];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &options, &file, &file_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (file_len) { /* user specified filed, perform open_basedir checks */
|
||||
if (!VCWD_REALPATH(file, resolved_path)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
file = resolved_path;
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
finfo = emalloc(sizeof(struct php_fileinfo));
|
||||
|
||||
finfo->options = options;
|
||||
finfo->magic = magic_open(options);
|
||||
|
||||
if (finfo->magic == NULL) {
|
||||
efree(finfo);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (magic_load(finfo->magic, file) == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database at '%s'.", file);
|
||||
efree(finfo);
|
||||
magic_close(finfo->magic);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (object) {
|
||||
FILEINFO_REGISTER_OBJECT(object, finfo);
|
||||
} else {
|
||||
ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource finfo_close(resource finfo)
|
||||
Close fileinfo resource. */
|
||||
PHP_FUNCTION(finfo_close)
|
||||
{
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfinfo) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(zfinfo));
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool finfo_set_flags(resource finfo, int options)
|
||||
Set libmagic configuration options. */
|
||||
PHP_FUNCTION(finfo_set_flags)
|
||||
{
|
||||
long options;
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
|
||||
if (object) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
FILEINFO_FROM_OBJECT(finfo, object);
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zfinfo, &options) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
}
|
||||
|
||||
FINFO_SET_OPTION(finfo->magic, options)
|
||||
finfo->options = options;
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
{
|
||||
long options = 0;
|
||||
char *buffer, *tmp, *ret_val;
|
||||
int buffer_len;
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo, *zcontext = NULL;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
|
||||
if (object) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbz", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
FILEINFO_FROM_OBJECT(finfo, object);
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|lbz", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
}
|
||||
|
||||
/* Set options for the current file/buffer. */
|
||||
if (options) {
|
||||
FINFO_SET_OPTION(finfo->magic, options)
|
||||
}
|
||||
|
||||
if (mode) { /* file */
|
||||
/* determine if the file is a local file or remote URL */
|
||||
char *tmp2;
|
||||
php_stream_wrapper *wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_DC);
|
||||
if (wrap && wrap->is_url) {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
|
||||
#else
|
||||
php_stream_context *context = NULL;
|
||||
#endif
|
||||
php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb",
|
||||
ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
|
||||
if (!stream) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
buffer_len = php_stream_copy_to_mem(stream, &tmp, PHP_STREAM_COPY_ALL, 0);
|
||||
php_stream_close(stream);
|
||||
|
||||
if (buffer_len == 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else { /* local file */
|
||||
char resolved_path[MAXPATHLEN];
|
||||
if (!VCWD_REALPATH(buffer, resolved_path)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret_val = (char *) magic_file(finfo->magic, buffer);
|
||||
goto common;
|
||||
}
|
||||
} else { /* buffer */
|
||||
tmp = buffer;
|
||||
}
|
||||
|
||||
ret_val = (char *) magic_buffer(finfo->magic, tmp, buffer_len);
|
||||
if (mode) {
|
||||
efree(tmp);
|
||||
}
|
||||
common:
|
||||
/* Restore options */
|
||||
if (options) {
|
||||
FINFO_SET_OPTION(finfo->magic, finfo->options)
|
||||
}
|
||||
|
||||
if (!ret_val) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify data %d:%s",
|
||||
magic_errno(finfo->magic), magic_error(finfo->magic));
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRING(ret_val, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto string finfo_file(resource finfo, char *file_name [, int options [, resource context]])
|
||||
Return information about a file. */
|
||||
PHP_FUNCTION(finfo_file)
|
||||
{
|
||||
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string finfo_buffer(resource finfo, char *string [, int options])
|
||||
Return infromation about a string buffer. */
|
||||
PHP_FUNCTION(finfo_buffer)
|
||||
{
|
||||
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
if(!extension_loaded('fileinfo')) {
|
||||
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
|
||||
}
|
||||
if(!extension_loaded('fileinfo')) {
|
||||
die("fileinfo extension is not avaliable, please compile it.\n");
|
||||
}
|
||||
|
||||
// normal operation
|
||||
$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
|
||||
$files = glob("*");
|
||||
foreach ($files as $file) {
|
||||
echo finfo_file($res, $file) . "\n";
|
||||
}
|
||||
finfo_close($res);
|
||||
|
||||
// OO mode
|
||||
/*
|
||||
* FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
|
||||
* FILEINFO_SYMLINK - follow symlinks
|
||||
* FILEINFO_DEVICES - look at the contents of blocks or character special devices
|
||||
* FILEINFO_COMPRESS - decompress compressed files
|
||||
*/
|
||||
$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
|
||||
$files = glob("*");
|
||||
foreach ($files as $file) {
|
||||
echo $fi->buffer(file_get_contents($file)) . "\n";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>Fileinfo</name>
|
||||
<summary>libmagic bindings</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>iliaa</user>
|
||||
<name>Ilia Alshanetsky</name>
|
||||
<email>ilia@php.net</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>
|
||||
This extension allows retrieval of information regarding vast majority of file.
|
||||
This information may include dimensions, quality, length etc...
|
||||
|
||||
Additionally it can also be used to retrieve the mime type for a particular
|
||||
file and for text files proper language encoding.
|
||||
</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>0.1</version>
|
||||
<date>2004-02-12</date>
|
||||
<notes>Initial release</notes>
|
||||
<filelist>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="fileinfo.c"/>
|
||||
<file role="src" name="php_fileinfo.h"/>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<file role="doc" name="EXPERIMENTAL"/>
|
||||
<file role="doc" name="fileinfo.php"/>
|
||||
</filelist>
|
||||
<deps>
|
||||
</deps>
|
||||
</release>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Ilia Alshanetsky <ilia@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_FILENINFO_H
|
||||
#define PHP_FILENINFO_H
|
||||
|
||||
extern zend_module_entry fileinfo_module_entry;
|
||||
#define phpext_fileinfo_ptr &fileinfo_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_FILEINFO_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_FILEINFO_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
PHP_MINFO_FUNCTION(fileinfo);
|
||||
|
||||
PHP_FUNCTION(finfo_open);
|
||||
PHP_FUNCTION(finfo_close);
|
||||
PHP_FUNCTION(finfo_set_flags);
|
||||
PHP_FUNCTION(finfo_file);
|
||||
PHP_FUNCTION(finfo_buffer);
|
||||
|
||||
#ifdef ZTS
|
||||
#define FILEINFO_G(v) TSRMG(fileinfo_globals_id, zend_fileinfo_globals *, v)
|
||||
#else
|
||||
#define FILEINFO_G(v) (fileinfo_globals.v)
|
||||
#endif
|
||||
|
||||
#endif /* PHP_FILEINFO_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -1,2 +0,0 @@
|
||||
OCI8
|
||||
Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong, Christopher Jones, Oracle Corporation
|
||||
-454
@@ -1,454 +0,0 @@
|
||||
Installing OCI8
|
||||
---------------
|
||||
|
||||
0. Overview
|
||||
1. Common requirements
|
||||
2. Installing as a shared extension
|
||||
3. Installing as a statically compiled extension
|
||||
4. Installing from PECL to an existing PHP
|
||||
5. Testing OCI8
|
||||
6. Oracle DRCP and FAN Support
|
||||
|
||||
|
||||
0. Overview
|
||||
-----------
|
||||
|
||||
The OCI8 extension allows you to access Oracle databases. It can be
|
||||
built using Oracle 9.2, 10.2 or 11.1 client libraries, and allows
|
||||
Oracle's standard cross-version connectivity. This release can be
|
||||
used with PHP versions 4.3.9 to 5.x.
|
||||
|
||||
The OCI8 extension is not related to, or used by, PDO_OCI, the PHP
|
||||
Data Objects (PDO) extension for Oracle.
|
||||
|
||||
1. Common requirements
|
||||
----------------------
|
||||
|
||||
This version of PHP OCI8:
|
||||
|
||||
- Will build with Oracle 9.2 (or more recent) client libraries. The
|
||||
same (or more recent) version of Oracle libraries used when
|
||||
building OCI8 must also be used at runtime.
|
||||
|
||||
- Can be used with PHP versions 4.3.9 to 5.x.
|
||||
|
||||
If you build PHP with the "ORACLE_HOME" Oracle database or full Oracle
|
||||
client libraries:
|
||||
|
||||
- you MUST set at least the ORACLE_HOME environment variable and
|
||||
make it visible for your web server BEFORE it starts.
|
||||
|
||||
- the Oracle software must be readable by the web server. With
|
||||
Oracle 10.2, see the $ORACLE_HOME/install/changePerm.sh script
|
||||
included in patch releases.
|
||||
|
||||
If you build PHP with Oracle Instant Client libraries from
|
||||
http://www.oracle.com/technology/tech/oci/instantclient/index.html
|
||||
|
||||
- either the "basic" or "basic-lite" package is required.
|
||||
|
||||
- the "devel" package is required.
|
||||
|
||||
- you don't have to set ORACLE_HOME and many of the other
|
||||
environment variables to build PHP with OCI8 support.
|
||||
|
||||
For both ORACLE_HOME and Instant Client installs you may have to set:
|
||||
|
||||
- LD_LIBRARY_PATH: it must include the $ORACLE_HOME/lib or Instant
|
||||
Client library directory
|
||||
|
||||
- NLS_LANG: if you want to change the default encoding used during
|
||||
interaction with Oracle servers
|
||||
|
||||
The most appropriate places to add the environment variables are:
|
||||
|
||||
/etc/profile
|
||||
/etc/profile.local
|
||||
/etc/profile.d
|
||||
|
||||
|
||||
2. Installing as a shared extension
|
||||
-----------------------------------
|
||||
|
||||
Configure OCI8 using one of the the following configure options:
|
||||
|
||||
a) if you use an Oracle server or Oracle Client installation:
|
||||
|
||||
./configure --with-oci8=shared,$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client:
|
||||
|
||||
./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib
|
||||
|
||||
If you use an RPM-based installation of Oracle Instant Client,
|
||||
your configure line will look like this:
|
||||
|
||||
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<version>/client/lib
|
||||
|
||||
Follow the usual building procedure, e.g. "make install". The OCI8
|
||||
shared extension oci8.so will be created. It may need to be manually
|
||||
moved to the PHP extension directory, specified by the extension_dir
|
||||
option in your php.ini file.
|
||||
|
||||
Edit php.ini file and add the line:
|
||||
|
||||
extension=oci8.so
|
||||
|
||||
|
||||
3. Installing as a statically compiled extension
|
||||
------------------------------------------------
|
||||
|
||||
Configure OCI8 using one of the the following configure options:
|
||||
|
||||
a) with a common Oracle server or full Oracle client installation
|
||||
|
||||
./configure --with-oci8=$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client
|
||||
|
||||
./configure --with-oci8=instantclient,/path/to/instant/client/lib
|
||||
|
||||
Run "make install".
|
||||
|
||||
After successful compile, you do not need to add oci8.so to php.ini.
|
||||
The module will be usable without any additional actions.
|
||||
|
||||
|
||||
4. Installing from PECL to an existing PHP
|
||||
------------------------------------------
|
||||
|
||||
The OCI8 extension is also available as a PECL module on
|
||||
http://pecl.php.net/package/oci8.
|
||||
|
||||
Install using either (a) or (b) below.
|
||||
|
||||
a) Do an automated download and install:
|
||||
|
||||
Set PEARs proxy, if necessary:
|
||||
|
||||
pear config-set http_proxy http://my-proxy.example.com:80/
|
||||
|
||||
Run
|
||||
|
||||
pecl install oci8
|
||||
|
||||
When prompted, enter either the value of $ORACLE_HOME, or
|
||||
"instantclient,/path/to/instant/client/lib" (without quotes).
|
||||
|
||||
b) Alternatively, manually download the PECL package, e.g. oci8-1.3.5.tgz
|
||||
|
||||
Extract the package:
|
||||
|
||||
tar -zxf oci8-1.3.5.tgz
|
||||
cd oci8-1.3.5
|
||||
|
||||
Prepare the package:
|
||||
|
||||
phpize
|
||||
|
||||
Configure the package, either using $ORACLE_HOME or Instant Client
|
||||
|
||||
./configure -with-oci8=shared,$ORACLE_HOME
|
||||
|
||||
or
|
||||
|
||||
./configure -with-oci8=shared,instantclient,/path/to/instant/client/lib
|
||||
|
||||
Install the package:
|
||||
|
||||
make install
|
||||
|
||||
After either install, edit your php.ini file, e.g. /etc/php.ini, and
|
||||
add the line:
|
||||
|
||||
extension=oci8.so
|
||||
|
||||
Make sure php.ini's "extension_dir" includes the directory that
|
||||
oci8.so was installed in.
|
||||
|
||||
|
||||
5. Testing OCI8
|
||||
---------------
|
||||
|
||||
OCI8 tests are in ext/oci8/tests. When OCI8 tests are run this
|
||||
directory will contain logs of any failures.
|
||||
|
||||
5.1. Running OCI8 tests on Linux
|
||||
|
||||
5.1.1. Edit ext/oci8/tests/details.inc
|
||||
|
||||
Set the username, password and connection string for the database.
|
||||
Most tests have been developed using the SYSTEM account: some tests
|
||||
might fail unless the user has permissions to create necessary
|
||||
tables, views, procedures etc.
|
||||
|
||||
If the database is on the same machine as PHP, set
|
||||
$oracle_on_localhost to TRUE.
|
||||
|
||||
If Oracle 11g Database Resident Connection Pooling is being tested,
|
||||
set $test_drcp to TRUE and ensure the connection string uses an
|
||||
appropriate pooled server (see section 6.2.2).
|
||||
|
||||
An alternative to editing details.inc is the set the environment
|
||||
variables
|
||||
|
||||
PHP_OCI8_TEST_USER
|
||||
PHP_OCI8_TEST_PASS
|
||||
PHP_OCI8_TEST_DB
|
||||
PHP_OCI8_TEST_DB_ON_LOCALHOST
|
||||
PHP_OCI8_TEST_DRCP
|
||||
|
||||
for example:
|
||||
|
||||
$ export PHP_OCI8_TEST_USER=system
|
||||
$ export PHP_OCI8_TEST_PASS=oracle
|
||||
$ export PHP_OCI8_TEST_DB=localhost/XE
|
||||
$ export PHP_OCI8_TEST_DB_ON_LOCALHOST=TRUE
|
||||
$ export PHP_OCI8_TEST_DRCP=FALSE
|
||||
|
||||
5.1.2. Set any necessary environment variables for the Oracle
|
||||
database. With Oracle 10g XE do:
|
||||
|
||||
$ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
|
||||
|
||||
For other versions of the Oracle database do:
|
||||
|
||||
$ . /usr/local/bin/oraenv
|
||||
|
||||
5.1.3. Check your php.ini has E in the variables_order parameter, for
|
||||
example:
|
||||
|
||||
variables_order = "EGPCS"
|
||||
|
||||
5.1.4. Run the tests:
|
||||
|
||||
$ cd <your php src directory>
|
||||
$ make test TESTS=ext/oci8
|
||||
|
||||
5.2. The tests execute rapidly. On fast machines with a local
|
||||
database configured for light load (e.g. Oracle 10g XE) you might
|
||||
see random tests fail with ORA-12516 or ORA-12520 errors. To
|
||||
prevent this, increase the database PROCESSES parameter using the
|
||||
following steps.
|
||||
|
||||
5.2.1. Connect as the oracle software owner:
|
||||
|
||||
$ su - oracle
|
||||
|
||||
5.2.2. Set the necessary environment variables as in 5.1.2.
|
||||
|
||||
5.2.3. Start the SQL*Plus command line tool and increase PROCESSES
|
||||
|
||||
$ sqlplus / as sysdba
|
||||
SQL> alter system set processes=100 scope=spfile
|
||||
|
||||
5.2.4. Restart the database:
|
||||
|
||||
SQL> startup force
|
||||
|
||||
|
||||
6. Oracle DRCP and FAN Support
|
||||
------------------------------
|
||||
|
||||
The PHP OCI8 extension has support for the Oracle Database Resident
|
||||
Connection Pool (DRCP) and Fast Application Notification (FAN).
|
||||
|
||||
Questions and issues can be raised on the Oracle OTN forum (free
|
||||
registration required):
|
||||
http://www.oracle.com/technology/forums/php.html
|
||||
|
||||
|
||||
6.1. Oracle Version Compatibility
|
||||
|
||||
The OCI8 extension will compile with Oracle libraries from version
|
||||
9iR2 onwards. However, full functionality (e.g. DRCP support) is only
|
||||
available when Oracle 11g is used.
|
||||
|
||||
For general database functionality the version of the Oracle libraries
|
||||
used by PHP does not necessarily have to match the version of the
|
||||
database.
|
||||
|
||||
|
||||
6.2. Database Resident Connection Pooling (DRCP)
|
||||
|
||||
DRCP allows more efficient use of database machine memory and provides
|
||||
high scalability.
|
||||
|
||||
For DRCP to be available in OCI8, Oracle client libraries used by PHP
|
||||
and the version of the Oracle Database must both be 11g.
|
||||
|
||||
Documentation on DRCP is found in several Oracle manuals. For example,
|
||||
see "Configuring Database Resident Connection Pooling" in the Oracle
|
||||
Database Administrator's Guide 11g Release 1 (11.1)
|
||||
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/manproc004.htm#CHDGIDBA
|
||||
for usage information. A whitepaper
|
||||
http://www.oracle.com/technology/tech/oci/pdf/oracledrcp11g.pdf
|
||||
contains background information on DRCP.
|
||||
|
||||
After building PHP with the OCI8 extension and 11g libraries, follow
|
||||
these steps:
|
||||
|
||||
6.2.0 Important: if Oracle Database 11.1.0.6 with DRCP connections is
|
||||
used, then the Oracle database patch for bug 6474441 must be
|
||||
applied (see section 6.5). Without this patch, "ORA-01000:
|
||||
maximum open cursors exceeded", "ORA-01001 invalid cursor" or
|
||||
"ORA-01002 fetch out of sequence" errors may occur.
|
||||
|
||||
If the Oracle 11.1.0.6 database patch cannot be applied, one of
|
||||
the following three workarounds can be used to disable statement
|
||||
caching instead:
|
||||
|
||||
(i) Connect using Oracle dedicated or shared servers instead of DRCP.
|
||||
|
||||
(ii) Set PHP's oci8.statement_cache_size to 0.
|
||||
|
||||
(iii) Set an event in the database initialization parameter file:
|
||||
event="56699 trace name context forever, level 128".
|
||||
|
||||
|
||||
6.2.1. As a privileged database administrator, use a program like
|
||||
SQL*Plus to start the connection pool in the database:
|
||||
|
||||
SQL> execute dbms_connection_pool.start_pool;
|
||||
|
||||
Optional settings control the size and characteristics of the
|
||||
pool.
|
||||
|
||||
6.2.2. For PHP applications that currently connect using a Network Alias
|
||||
like:
|
||||
|
||||
$c = oci_pconnect("myuser", "mypassword", "MYDB");
|
||||
|
||||
Modify your tnsnames.ora file and add the "(SERVER=POOLED)"
|
||||
clause, for example:
|
||||
|
||||
MYDB = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.dom.com)
|
||||
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales)
|
||||
(SERVER=POOLED)))
|
||||
|
||||
Alternatively, modify the Easy Connect syntax in PHP and add
|
||||
":POOLED" after the service name:
|
||||
|
||||
$c = oci_pconnect("myuser", "mypassword",
|
||||
"myhost.dom.com:1521/sales:POOLED");
|
||||
|
||||
6.2.3. Edit php.ini and choose a connection class name. This name
|
||||
indicates a logical division of the connection pool and can be
|
||||
used to isolate pooling for separate applications. Any PHP
|
||||
instance with the same connection class value will share
|
||||
connections in the pool.
|
||||
|
||||
oci8.connection_class = "MY_APPLICATION_NAME"
|
||||
|
||||
6.2.4. Run your application, connecting to the 11g database.
|
||||
|
||||
|
||||
6.3. Fast Application Notification (FAN) Support
|
||||
|
||||
FAN support gives fast connection failover, a high availability
|
||||
feature. This allows PHP OCI8 scripts to be notified when a database
|
||||
machine or database instance becomes unavailable. Without FAN, OCI8
|
||||
can hang until a TCP timeout occurs and an error is returned, which
|
||||
might be several minutes. Enabling FAN in OCI8 can allow your
|
||||
applications to detect errors and re-connect to an available database
|
||||
instance without the web user being aware of an outage.
|
||||
|
||||
FAN support is available when the Oracle client libraries that PHP
|
||||
links with and the Oracle Database are either version 10gR2 or 11g.
|
||||
|
||||
FAN benefits users of Oracle's clustering technology (RAC) because
|
||||
connections to surviving database instances can be immediately made.
|
||||
Users of Oracle's Data Guard with a broker will see the FAN events
|
||||
generated when the standby database goes online. Standalone databases
|
||||
will send FAN events when the database restarts.
|
||||
|
||||
For active connections, when a machine or database instance becomes
|
||||
unavailable, a connection failure error will be returned by the OCI8
|
||||
extension function currently being called. On a subsequent PHP script
|
||||
re-connect, a connection to a surviving database instance will be
|
||||
established. The OCI8 extension also transparently cleans up any idle
|
||||
connections affected by a database machine or instance failure so PHP
|
||||
connect calls will establish a fresh connection without the script
|
||||
being aware of any service disruption.
|
||||
|
||||
When oci8.events is On, it is suggested to set oci8.ping_interval to
|
||||
-1 to disable pinging, since enabling FAN events provide pro-active
|
||||
connection management of idle connections made invalid by a service
|
||||
disruption.
|
||||
|
||||
To enable FAN support in PHP, after building PHP with Oracle 10gR2 or
|
||||
11g libraries follow these steps:
|
||||
|
||||
6.3.1. As a privileged database administrator, use a program like
|
||||
SQL*Plus to enable the database service to post FAN events, for
|
||||
example:
|
||||
|
||||
SQL> execute dbms_service.modify_service(
|
||||
SERVICE_NAME => 'sales',
|
||||
AQ_HA_NOTIFICATIONS => TRUE);
|
||||
|
||||
6.3.2. Edit php.ini and add
|
||||
|
||||
oci8.events = On
|
||||
|
||||
6.3.3. If your application does not already handle OCI8 error
|
||||
conditions, modify it to detect failures and take appropriate
|
||||
action. This may include re-connecting and re-executing
|
||||
statements.
|
||||
|
||||
6.3.4. Run your application, connecting to a 10gR2 or 11g database.
|
||||
|
||||
|
||||
6.4. Recommendations and Known Limitations
|
||||
|
||||
6.4.1 Changing Password for DRCP connections
|
||||
|
||||
Changing a password over DRCP connections will fail with the error
|
||||
"ORA-56609: Usage not supported with DRCP". This is an documented
|
||||
restriction of Oracle Database 11g.
|
||||
|
||||
6.4.2 Closing Connections
|
||||
|
||||
With the PHP OCI8 extension, persistent connections can now be closed
|
||||
by the user, allowing greater control over connection resource usage.
|
||||
Persistent connections will now also be closed automatically when
|
||||
there is no PHP variable referencing them, such as at the end of scope
|
||||
of a PHP user function. This will rollback any uncommitted
|
||||
transaction. These changes to persistent connections make them behave
|
||||
similarly to non-persistent connections, simplifying the interface,
|
||||
allowing for greater application consistency and predictability. Use
|
||||
oci8.old_oci_close_semantics=1 to retain the historical behavior.
|
||||
|
||||
6.4.3 LOGON Triggers can be used to set session properties
|
||||
|
||||
The patch for Oracle Database 11.1.0.6 bug 6474441 (see section 6.5)
|
||||
allows PHP applications with DRCP connection to use a database LOGON
|
||||
trigger to set session properties at the time of session creation.
|
||||
Examples of such settings are the NLS language and the date format.
|
||||
|
||||
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
|
||||
following workarounds can be used:
|
||||
|
||||
(i) After logon, explicitly set the session properties using PHP
|
||||
application code.
|
||||
|
||||
(ii) Connect using Oracle dedicated or shared servers instead of DRCP.
|
||||
|
||||
With DRCP there is an connection management relationship between (i)
|
||||
DRCP's automatic pool expansion and reduction, (ii) PHP's persistent
|
||||
connection caching, (iii) with the way LOGON triggers fire with DRCP
|
||||
authentication. Because of this interplay, LOGON triggers in PHP
|
||||
(when DRCP is used) are only recommended for setting session
|
||||
attributes and not for per-PHP connection events.
|
||||
|
||||
|
||||
6.5. Patching Oracle Database 11g
|
||||
|
||||
The patch for bug 6474441 is available from Oracle Support's Metalink
|
||||
system.
|
||||
|
||||
The bug is specific to Oracle 11.1.0.6 with DRCP connections. The
|
||||
issues it fixes do not affect connections using Oracle's dedicated
|
||||
(the default connection mode) or shared servers. They do not affect
|
||||
earlier versions of Oracle. The bug is intended to be fixed in Oracle
|
||||
Database 11.1.0.7 (as yet unreleased).
|
||||
@@ -1,360 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
if test -z "$SED"; then
|
||||
PHP_OCI8_SED="sed";
|
||||
else
|
||||
PHP_OCI8_SED="$SED";
|
||||
fi
|
||||
|
||||
AC_DEFUN([PHP_OCI_IF_DEFINED],[
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS=$3
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <oci.h>
|
||||
#if defined($1)
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
$2
|
||||
],[
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
|
||||
AC_MSG_CHECKING([ORACLE_HOME library validity])
|
||||
if test ! -d "$OCI8_DIR"; then
|
||||
AC_MSG_ERROR([${OCI8_DIR} is not a directory])
|
||||
fi
|
||||
if test -d "$OCI8_DIR/lib" && test ! -d "$OCI8_DIR/lib32"; then
|
||||
OCI8_LIB_DIR=lib
|
||||
elif test ! -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
|
||||
OCI8_LIB_DIR=lib32
|
||||
elif test -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
|
||||
OCI8_LIB_DIR=$PHP_OCI8_OH_LIBDIR
|
||||
else
|
||||
dnl This isn't an ORACLE_HOME. Try heuristic examination of the dir to help the user
|
||||
if test -f "$OCI8_DIR/libociei.so"; then
|
||||
AC_MSG_ERROR([Expected an ORACLE_HOME top level directory but ${OCI8_DIR} appears to be an Instant Client directory. Try --with-oci8=instantclient,${OCI8_DIR}])
|
||||
else
|
||||
AC_MSG_ERROR([Oracle library directory not found in ${OCI8_DIR}])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_LIB_DIR)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_OCI8IC_VERSION],[
|
||||
AC_MSG_CHECKING([Oracle Instant Client version])
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz11.$SHLIB_SUFFIX_NAME; then
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||
if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.11.1 not found])
|
||||
fi
|
||||
OCI8_ORACLE_VERSION=11.1
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client library version not supported])
|
||||
fi
|
||||
elif test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.10.1 not found])
|
||||
fi
|
||||
OCI8_ORACLE_VERSION=10.1
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client library version not supported])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client libraries not found])
|
||||
fi
|
||||
AC_MSG_RESULT([$OCI8_ORACLE_VERSION])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
|
||||
AC_MSG_CHECKING([Oracle version])
|
||||
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
|
||||
OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||
OCI8_ORACLE_VERSION=11.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
dnl There is no case for Oracle 10.2. Oracle 10.2 libraries have a 10.1 suffix for drop-in compatibility with Oracle 10.1
|
||||
OCI8_ORACLE_VERSION=10.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
|
||||
dnl There is no case for Oracle 9.2. Oracle 9.2 libraries have a 9.0 suffix for drop-in compatibility with Oracle 9.0
|
||||
OCI8_ORACLE_VERSION=9.0
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
||||
OCI8_ORACLE_VERSION=8.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
|
||||
OCI8_ORACLE_VERSION=8.0
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
|
||||
if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
|
||||
OCI8_ORACLE_VERSION=8.0
|
||||
else
|
||||
OCI8_ORACLE_VERSION=8.1
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR(Oracle client libraries not found)
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_ORACLE_VERSION)
|
||||
])
|
||||
|
||||
|
||||
dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
|
||||
dnl or
|
||||
dnl --with-oci8=shared,/path/to/oracle/home
|
||||
PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
|
||||
[ --with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to \$ORACLE_HOME.
|
||||
Use --with-oci8=instantclient,/path/to/instant/client/lib
|
||||
to use an Oracle Instant Client installation])
|
||||
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
|
||||
if test -z "$PHP_OCI8"; then
|
||||
dnl --with-oci8=$ORACLE_HOME where ORACLE_HOME isn't set (or is mistyped) will match this case
|
||||
AC_MSG_ERROR([Empty parameter value passed to --with-oci8])
|
||||
fi
|
||||
|
||||
dnl Check PHP version is compatible with this extension
|
||||
|
||||
AC_MSG_CHECKING([PHP version])
|
||||
|
||||
tmp_version=$PHP_VERSION
|
||||
if test -z "$tmp_version"; then
|
||||
if test -z "$PHP_CONFIG"; then
|
||||
AC_MSG_ERROR([php-config not found])
|
||||
fi
|
||||
php_version=`$PHP_CONFIG --version 2>/dev/null|head -n 1|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
|
||||
else
|
||||
php_version=`echo "$tmp_version"|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
|
||||
fi
|
||||
|
||||
if test -z "$php_version"; then
|
||||
AC_MSG_ERROR([failed to detect PHP version, please report])
|
||||
fi
|
||||
|
||||
ac_IFS=$IFS
|
||||
IFS="."
|
||||
set $php_version
|
||||
IFS=$ac_IFS
|
||||
oci8_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
|
||||
|
||||
if test "$oci8_php_version" -lt "4003009"; then
|
||||
AC_MSG_ERROR([You need at least PHP 4.3.9 to be able to use this version of OCI8. PHP $php_version found])
|
||||
elif test "$oci8_php_version" -ge "6000000"; then
|
||||
AC_MSG_ERROR([This version of OCI8 is not compatible with PHP 6 or higher])
|
||||
else
|
||||
AC_MSG_RESULT([$php_version, ok])
|
||||
fi
|
||||
|
||||
dnl Set some port specific directory components for use later
|
||||
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
AC_MSG_CHECKING([checking if we're on a 64-bit platform])
|
||||
if test "$ac_cv_sizeof_long_int" = "4"; then
|
||||
AC_MSG_RESULT([no])
|
||||
PHP_OCI8_OH_LIBDIR=lib32
|
||||
PHP_OCI8_IC_LIBDIR_SUFFIX=""
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
PHP_OCI8_OH_LIBDIR=lib
|
||||
PHP_OCI8_IC_LIBDIR_SUFFIX=64
|
||||
fi
|
||||
|
||||
dnl Determine if the user wants to use Oracle Instant Client libraries
|
||||
|
||||
PHP_OCI8_INSTANT_CLIENT="no"
|
||||
|
||||
dnl PECL Bug 14268 (Allow "pecl install oci8" command to "autodetect"
|
||||
dnl an Instant Client RPM install). This also has a benefit for non
|
||||
dnl "pecl install" builds: if the user does --with-oci8 or
|
||||
dnl --with-oci8=shared but the ORACLE_HOME environment variable is not
|
||||
dnl actually set, the install tries to locate the Instant Client RPM
|
||||
if test "$PHP_OCI8" = "yes" && test -z "$ORACLE_HOME"; then
|
||||
AC_MSG_WARN([OCI8 extension: ORACLE_HOME is not set, looking for default Oracle Instant Client instead])
|
||||
PHP_OCI8=instantclient
|
||||
fi
|
||||
|
||||
if test "`echo $PHP_OCI8`" = "instantclient"; then
|
||||
PHP_OCI8_INSTANT_CLIENT="yes"
|
||||
elif test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
|
||||
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
|
||||
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
|
||||
PHP_OCI8_INSTANT_CLIENT="yes"
|
||||
fi
|
||||
if test -z "$PHP_OCI8"; then
|
||||
PHP_OCI8=yes
|
||||
fi
|
||||
elif test "`echo $PHP_OCI8 | cut -d, -f1`" = "instantclient"; then
|
||||
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`"
|
||||
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f3,4`"
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
|
||||
PHP_OCI8_INSTANT_CLIENT="yes"
|
||||
fi
|
||||
if test -z "$PHP_OCI8"; then
|
||||
PHP_OCI8=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
|
||||
dnl ***************************************
|
||||
dnl Branch for using an ORACLE_HOME install
|
||||
dnl ***************************************
|
||||
|
||||
AC_MSG_CHECKING([Oracle ORACLE_HOME install directory])
|
||||
|
||||
if test "$PHP_OCI8" = "yes"; then
|
||||
OCI8_DIR=$ORACLE_HOME
|
||||
else
|
||||
OCI8_DIR=$PHP_OCI8
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_DIR)
|
||||
|
||||
AC_OCI8_CHECK_LIB_DIR($OCI8_DIR)
|
||||
|
||||
if test -d "$OCI8_DIR/rdbms/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/rdbms/demo"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/network/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/network/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/plsql/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public"
|
||||
fi
|
||||
|
||||
if test -f "$OCI8_DIR/$OCI8_LIB_DIR/sysliblist"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCI8_DIR/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
|
||||
elif test -f "$OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
|
||||
fi
|
||||
|
||||
AC_OCI8_ORACLE_VERSION($OCI8_DIR)
|
||||
|
||||
case $OCI8_ORACLE_VERSION in
|
||||
7.3|8.0|8.1)
|
||||
AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
|
||||
;;
|
||||
|
||||
9.0)
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
|
||||
[
|
||||
OCI8_ORACLE_VERSION=9.2
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
|
||||
], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
;;
|
||||
|
||||
10.1|11.1)
|
||||
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Oracle version $OCI8_ORACLE_VERSION is not supported])
|
||||
;;
|
||||
esac
|
||||
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||
|
||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||
PHP_SUBST_OLD(OCI8_DIR)
|
||||
PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
|
||||
|
||||
dnl Fix Bug #46623
|
||||
AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_DIR, "$OCI8_DIR", [ ])
|
||||
AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_SHARED_LIBADD, "$OCI8_SHARED_LIBADD", [ ])
|
||||
|
||||
else
|
||||
dnl ***************************************************
|
||||
dnl Branch for using an Oracle Instant Client directory
|
||||
dnl ***************************************************
|
||||
|
||||
AC_MSG_CHECKING([Oracle Instant Client directory])
|
||||
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
|
||||
dnl Find the directory if user specified "instantclient" but did not
|
||||
dnl give a dir. Generally the Instant Client can be anywhere so the
|
||||
dnl user must pass in the library directory. But on Linux we default
|
||||
dnl to the most recent version in /usr/lib which is where the Oracle
|
||||
dnl Instant Client RPM gets installed.
|
||||
PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'`
|
||||
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
|
||||
AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib libraries not found. Try --with-oci8=instantclient,DIR])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
|
||||
|
||||
OCI8_DIR=$PHP_OCI8_INSTANT_CLIENT
|
||||
|
||||
AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
|
||||
|
||||
dnl Header directory for Instant Client SDK RPM install
|
||||
OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
|
||||
|
||||
dnl Header directory for Instant Client SDK zip file install
|
||||
OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
|
||||
|
||||
dnl Header directory for manual installation
|
||||
OCISDKMANINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!\(.*\)/lib[/]*$!\1/include!'`
|
||||
|
||||
if test -f "$OCISDKRPMINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKRPMINC)
|
||||
PHP_ADD_INCLUDE($OCISDKRPMINC)
|
||||
OCI8INCDIR=$OCISDKRPMINC
|
||||
elif test -f "$OCISDKZIPINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKZIPINC)
|
||||
PHP_ADD_INCLUDE($OCISDKZIPINC)
|
||||
OCI8INCDIR=$OCISDKZIPINC
|
||||
elif test -f "$OCISDKMANINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKMANINC)
|
||||
PHP_ADD_INCLUDE($OCISDKMANINC)
|
||||
OCI8INCDIR=$OCISDKMANINC
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client SDK header files not found])
|
||||
fi
|
||||
|
||||
OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI8_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'`
|
||||
if test -f "$OCISYSLIBLIST"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB)
|
||||
fi
|
||||
|
||||
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
|
||||
case $OCI8_ORACLE_VERSION in
|
||||
10.1|11.1)
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Oracle Instant Client version $PHP_OCI8_INSTANT_CLIENT is not supported])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
|
||||
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||
|
||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||
PHP_SUBST_OLD(OCI8_DIR)
|
||||
PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
|
||||
|
||||
fi
|
||||
fi
|
||||
@@ -1,82 +0,0 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
if (PHP_OCI8 != "no" && PHP_OCI8_11G != "no") {
|
||||
if (!PHP_OCI8_SHARED && !PHP_OCI8_11G_SHARED) {
|
||||
WARNING("oci8 and oci8-11g provide the same extension and cannot both be built statically");
|
||||
PHP_OCI8 = "no"
|
||||
PHP_OCI8_11G = "no"
|
||||
}
|
||||
}
|
||||
|
||||
ARG_WITH("oci8", "OCI8 support", "no");
|
||||
|
||||
if (PHP_OCI8 != "no") {
|
||||
|
||||
oci8_dirs = new Array(
|
||||
PHP_OCI8
|
||||
);
|
||||
|
||||
oci8_lib_paths = "";
|
||||
oci8_inc_paths = "";
|
||||
|
||||
// find the Oracle install
|
||||
for (i = 0; i < oci8_dirs.length; i++) {
|
||||
oci8_lib_paths += oci8_dirs[i] + "\\lib;";
|
||||
oci8_lib_paths += oci8_dirs[i] + "\\lib\\msvc;";
|
||||
oci8_inc_paths += oci8_dirs[i] + "\\include;";
|
||||
}
|
||||
|
||||
oci8_inc_paths += PHP_PHP_BUILD + "\\include\\instantclient;"
|
||||
oci8_lib_paths += PHP_PHP_BUILD + "\\lib\\instantclient;";
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8", oci8_inc_paths) &&
|
||||
CHECK_LIB("oci.lib", "oci8", oci8_lib_paths))
|
||||
{
|
||||
EXTENSION('oci8', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c');
|
||||
|
||||
AC_DEFINE('HAVE_OCI8', 1);
|
||||
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
|
||||
AC_DEFINE('HAVE_OCI_LOB_READ2', 1);
|
||||
|
||||
} else {
|
||||
WARNING("oci8 not enabled: Oracle Database libraries or Oracle 10g Instant Client not found");
|
||||
PHP_OCI8 = "no"
|
||||
}
|
||||
}
|
||||
|
||||
ARG_WITH("oci8-11g", "OCI8 support using Oracle 11g Instant Client", "no");
|
||||
|
||||
if (PHP_OCI8_11G != "no") {
|
||||
|
||||
oci8_11g_dirs = new Array(
|
||||
PHP_OCI8_11G
|
||||
);
|
||||
|
||||
oci8_11g_lib_paths = "";
|
||||
oci8_11g_inc_paths = "";
|
||||
|
||||
// find the Oracle install
|
||||
for (i = 0; i < oci8_11g_dirs.length; i++) {
|
||||
oci8_11g_lib_paths += oci8_11g_dirs[i] + "\\lib;";
|
||||
oci8_11g_lib_paths += oci8_11g_dirs[i] + "\\lib\\msvc;";
|
||||
oci8_11g_inc_paths += oci8_11g_dirs[i] + "\\include;";
|
||||
}
|
||||
|
||||
oci8_11g_inc_paths += PHP_PHP_BUILD + "\\include\\instantclient_11;"
|
||||
oci8_11g_lib_paths += PHP_PHP_BUILD + "\\lib\\instantclient_11;";
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8_11G", oci8_11g_inc_paths) &&
|
||||
CHECK_LIB("oci.lib", "oci8_11g", oci8_11g_lib_paths))
|
||||
{
|
||||
EXTENSION('oci8_11g', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c', null, null, null, "ext\\oci8_11g")
|
||||
|
||||
AC_DEFINE('HAVE_OCI8', 1);
|
||||
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
|
||||
AC_DEFINE('HAVE_OCI_LOB_READ2', 1);
|
||||
|
||||
} else {
|
||||
WARNING("oci8-11g not enabled: Oracle Database libraries or Oracle 11g Instant Client not found");
|
||||
PHP_OCI8_11G = "no"
|
||||
}
|
||||
}
|
||||
-3128
File diff suppressed because it is too large.
Load diff
@@ -1,133 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=oci8 - Win32 Release_TS
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "oci8.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "oci8 - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release_TS"
|
||||
# PROP BASE Intermediate_Dir "Release_TS"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS"
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x406 /d "NDEBUG"
|
||||
# ADD RSC /l 0x406 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\lib\instantclient" /libpath:"..\..\Release_TS_Inline"
|
||||
|
||||
!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "Debug_TS"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x406 /d "NDEBUG"
|
||||
# ADD RSC /l 0x406 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\instantclient"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "oci8 - Win32 Release_TS"
|
||||
# Name "oci8 - Win32 Debug_TS"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_collection.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_interface.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_lob.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_statement.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_oci8.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_oci8_int.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,793 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#if HAVE_OCI8
|
||||
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* {{{ php_oci_collection_create()
|
||||
Create and return connection handle */
|
||||
php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
|
||||
{
|
||||
dvoid *dschp1 = NULL;
|
||||
dvoid *parmp1;
|
||||
dvoid *parmp2;
|
||||
php_oci_collection *collection;
|
||||
|
||||
collection = emalloc(sizeof(php_oci_collection));
|
||||
|
||||
collection->connection = connection;
|
||||
collection->collection = NULL;
|
||||
zend_list_addref(collection->connection->rsrc_id);
|
||||
|
||||
/* get type handle by name */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
connection->svc,
|
||||
(text *) schema,
|
||||
(ub4) schema_len,
|
||||
(text *) tdo,
|
||||
(ub4) tdo_len,
|
||||
(CONST text *) 0,
|
||||
(ub4) 0,
|
||||
OCI_DURATION_SESSION,
|
||||
OCI_TYPEGET_ALL,
|
||||
&(collection->tdo)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* allocate describe handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* describe TDO */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
(dvoid *) collection->tdo,
|
||||
(ub4) 0,
|
||||
OCI_OTYPE_PTR,
|
||||
(ub1) OCI_DEFAULT,
|
||||
(ub1) OCI_PTYPE_TYPE,
|
||||
dschp1
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get first parameter handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the collection type code of the attribute */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp1,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->coll_typecode),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_COLLECTION_TYPECODE,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
switch(collection->coll_typecode) {
|
||||
case OCI_TYPECODE_TABLE:
|
||||
case OCI_TYPECODE_VARRAY:
|
||||
/* get collection element handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp1,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &parmp2,
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_COLLECTION_ELEMENT,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get REF of the TDO for the type */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp2,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->elem_ref),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_REF_TDO,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the TDO (only header) */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
collection->elem_ref,
|
||||
OCI_DURATION_SESSION,
|
||||
OCI_TYPEGET_HEADER,
|
||||
&(collection->element_type)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get typecode */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp2,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->element_typecode),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_TYPECODE,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
break;
|
||||
/* we only support VARRAYs and TABLEs */
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown collection type %d", collection->coll_typecode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create object to hold return table */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
connection->svc,
|
||||
OCI_TYPECODE_TABLE,
|
||||
collection->tdo,
|
||||
(dvoid *)0,
|
||||
OCI_DURATION_DEFAULT,
|
||||
TRUE,
|
||||
(dvoid **) &(collection->collection)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* free the describe handle (Bug #44113) */
|
||||
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
|
||||
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
|
||||
return collection;
|
||||
|
||||
CLEANUP:
|
||||
|
||||
if (dschp1) {
|
||||
/* free the describe handle (Bug #44113) */
|
||||
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
|
||||
}
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
php_oci_collection_close(collection TSRMLS_CC);
|
||||
return NULL;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_size()
|
||||
Return size of the collection */
|
||||
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_max()
|
||||
Return max number of elements in the collection */
|
||||
int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection));
|
||||
|
||||
/* error handling is not necessary here? */
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_trim()
|
||||
Trim collection to the given number of elements */
|
||||
int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_null()
|
||||
Append NULL element to the end of the collection */
|
||||
int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
|
||||
{
|
||||
OCIInd null_index = OCI_IND_NULL;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* append NULL element */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_date()
|
||||
Append DATE element to the end of the collection (use "DD-MON-YY" format) */
|
||||
int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIDate oci_date;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) &oci_date,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_number()
|
||||
Append NUMBER to the end of the collection */
|
||||
int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
double element_double;
|
||||
OCINumber oci_number;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
|
||||
/* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
|
||||
element_double = strtod(number, NULL);
|
||||
#else
|
||||
/* zend_strtod was introduced in PHP 4.3.10 */
|
||||
element_double = zend_strtod(number, NULL);
|
||||
#endif
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) &oci_number,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_string()
|
||||
Append STRING to the end of the collection */
|
||||
int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) ocistr,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append()
|
||||
Append wrapper. Appends any supported element to the end of the collection */
|
||||
int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
if (element_len == 0) {
|
||||
return php_oci_collection_append_null(collection TSRMLS_CC);
|
||||
}
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_append_date(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_append_string(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL : /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE : /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER : /* INT */
|
||||
case OCI_TYPECODE_SIGNED16 : /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32 : /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL : /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT : /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER : /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
|
||||
return php_oci_collection_append_number(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_get()
|
||||
Get the element with the given index */
|
||||
int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
dvoid *element;
|
||||
OCIInd *element_index;
|
||||
boolean exists;
|
||||
oratext buff[1024];
|
||||
ub4 buff_len = 1024;
|
||||
|
||||
MAKE_STD_ZVAL(*result_element);
|
||||
ZVAL_NULL(*result_element);
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
collection->collection,
|
||||
(ub4)index,
|
||||
&exists,
|
||||
&element,
|
||||
(dvoid **)&element_index
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (exists == 0) {
|
||||
/* element doesn't exist */
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*element_index == OCI_IND_NULL) {
|
||||
/* this is not an error, we're returning NULL here */
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(*result_element, (char *)buff, buff_len, 1);
|
||||
Z_STRVAL_P(*result_element)[buff_len] = '\0';
|
||||
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2:
|
||||
{
|
||||
OCIString *oci_string = *(OCIString **)element;
|
||||
text *str;
|
||||
|
||||
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
|
||||
|
||||
if (str) {
|
||||
ZVAL_STRING(*result_element, (char *)str, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL: /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE: /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER: /* INT */
|
||||
case OCI_TYPECODE_SIGNED16: /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32: /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL: /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT: /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER: /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT: /* SMALLINT */
|
||||
{
|
||||
double double_number;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZVAL_DOUBLE(*result_element, double_number);
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_null()
|
||||
Set the element with the given index to NULL */
|
||||
int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC)
|
||||
{
|
||||
OCIInd null_index = OCI_IND_NULL;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* set NULL element */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_date()
|
||||
Change element's value to the given DATE */
|
||||
int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIDate oci_date;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4)index,
|
||||
(dvoid *) &oci_date,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_number()
|
||||
Change element's value to the given NUMBER */
|
||||
int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
double element_double;
|
||||
OCINumber oci_number;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
|
||||
/* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
|
||||
element_double = strtod(number, NULL);
|
||||
#else
|
||||
/* zend_strtod was introduced in PHP 4.3.10 */
|
||||
element_double = zend_strtod(number, NULL);
|
||||
#endif
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4) index,
|
||||
(dvoid *) &oci_number,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_string()
|
||||
Change element's value to the given string */
|
||||
int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4)index,
|
||||
(dvoid *) ocistr,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set()
|
||||
Collection element setter */
|
||||
int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC)
|
||||
{
|
||||
if (value_len == 0) {
|
||||
return php_oci_collection_element_set_null(collection, index TSRMLS_CC);
|
||||
}
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_element_set_date(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_element_set_string(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL : /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE : /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER : /* INT */
|
||||
case OCI_TYPECODE_SIGNED16 : /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32 : /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL : /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT : /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER : /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
|
||||
return php_oci_collection_element_set_number(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_assign()
|
||||
Assigns a value to the collection from another collection */
|
||||
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection_dest->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_close()
|
||||
Destroy collection and all associated resources */
|
||||
void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
if (collection->collection) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
}
|
||||
}
|
||||
|
||||
zend_list_delete(collection->connection->rsrc_id);
|
||||
|
||||
efree(collection);
|
||||
return;
|
||||
} /* }}} */
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,927 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#if HAVE_OCI8
|
||||
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* for import/export functions */
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* {{{ php_oci_lob_create()
|
||||
Create LOB descriptor and allocate all the resources needed */
|
||||
php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC)
|
||||
{
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
switch (type) {
|
||||
case OCI_DTYPE_FILE:
|
||||
case OCI_DTYPE_LOB:
|
||||
case OCI_DTYPE_ROWID:
|
||||
/* these three are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld", type);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
|
||||
descriptor->type = type;
|
||||
descriptor->connection = connection;
|
||||
zend_list_addref(descriptor->connection->rsrc_id);
|
||||
|
||||
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (OCI_G(errcode) != OCI_SUCCESS) {
|
||||
OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode));
|
||||
efree(descriptor);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
|
||||
|
||||
descriptor->lob_current_position = 0;
|
||||
descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
|
||||
descriptor->charset_form = SQLCS_IMPLICIT; /* default value */
|
||||
descriptor->charset_id = connection->charset;
|
||||
descriptor->is_open = 0;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) {
|
||||
/* add Lobs & Files to hash. we'll flush them at the end */
|
||||
if (!connection->descriptors) {
|
||||
ALLOC_HASHTABLE(connection->descriptors);
|
||||
zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0);
|
||||
}
|
||||
|
||||
zend_hash_next_index_insert(connection->descriptors,&descriptor,sizeof(php_oci_descriptor *),NULL);
|
||||
}
|
||||
return descriptor;
|
||||
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_get_length()
|
||||
Get length of the LOB. The length is cached so we don't need to ask Oracle every time */
|
||||
int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
*length = 0;
|
||||
|
||||
if (descriptor->lob_size >= 0) {
|
||||
*length = descriptor->lob_size;
|
||||
return 0;
|
||||
} else {
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_size = *length;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_callback()
|
||||
Append LOB portion to a memory buffer */
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp)
|
||||
#else
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
|
||||
#endif
|
||||
{
|
||||
ub4 lenp = (ub4) len;
|
||||
php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
|
||||
|
||||
switch (piece)
|
||||
{
|
||||
case OCI_LAST_PIECE:
|
||||
if ((*(ctx->lob_len) + lenp) > (ctx->alloc_len)) {
|
||||
/* this should not happen ever */
|
||||
*(ctx->lob_data) = NULL;
|
||||
*(ctx->lob_len) = 0;
|
||||
return OCI_ERROR;
|
||||
}
|
||||
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
|
||||
*(ctx->lob_len) += lenp;
|
||||
*(*(ctx->lob_data) + *(ctx->lob_len)) = 0x00;
|
||||
return OCI_CONTINUE;
|
||||
|
||||
case OCI_FIRST_PIECE:
|
||||
case OCI_NEXT_PIECE:
|
||||
if ((*(ctx->lob_len) + lenp) > ctx->alloc_len) {
|
||||
/* this should not happen ever */
|
||||
*(ctx->lob_data) = NULL;
|
||||
*(ctx->lob_len) = 0;
|
||||
return OCI_ERROR;
|
||||
}
|
||||
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
|
||||
*(ctx->lob_len) += lenp;
|
||||
return OCI_CONTINUE;
|
||||
|
||||
default: {
|
||||
TSRMLS_FETCH();
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece);
|
||||
*(ctx->lob_data) = NULL;
|
||||
*(ctx->lob_len) = 0;
|
||||
return OCI_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_calculate_buffer() */
|
||||
static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
ub4 chunk_size;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
return read_length;
|
||||
}
|
||||
|
||||
if (!descriptor->chunk_size) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return read_length; /* we have to return original length here */
|
||||
}
|
||||
descriptor->chunk_size = chunk_size;
|
||||
}
|
||||
|
||||
if ((read_length % descriptor->chunk_size) != 0) {
|
||||
return descriptor->chunk_size * ((read_length / descriptor->chunk_size) + 1);
|
||||
}
|
||||
return read_length;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_read()
|
||||
Read specified portion of the LOB into the buffer */
|
||||
int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, char **data, ub4 *data_len TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
ub4 length = 0;
|
||||
int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
|
||||
php_oci_lob_ctx ctx;
|
||||
ub1 *bufp;
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
oraub8 bytes_read, offset = 0;
|
||||
oraub8 requested_len = read_length; /* this is by default */
|
||||
oraub8 chars_read = 0;
|
||||
#else
|
||||
int bytes_read, offset = 0;
|
||||
int requested_len = read_length; /* this is by default */
|
||||
#endif
|
||||
int is_clob = 0;
|
||||
sb4 bytes_per_char = 1;
|
||||
|
||||
*data_len = 0;
|
||||
*data = NULL;
|
||||
|
||||
ctx.lob_len = data_len;
|
||||
ctx.lob_data = data;
|
||||
ctx.alloc_len = 0;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (initial_offset > length) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (read_length == -1) {
|
||||
requested_len = length;
|
||||
}
|
||||
|
||||
if (requested_len > (length - initial_offset)) {
|
||||
requested_len = length - initial_offset;
|
||||
}
|
||||
|
||||
if (requested_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
offset = initial_offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
ub2 charset_id = 0;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
|
||||
is_clob = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_clob) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* BLOBs don't have encoding, so bytes_per_char == 1 */
|
||||
}
|
||||
|
||||
ctx.alloc_len = (requested_len + 1) * bytes_per_char;
|
||||
*data = ecalloc(bytes_per_char, requested_len + 1);
|
||||
|
||||
#ifdef HAVE_OCI_LOB_READ2
|
||||
if (is_clob) {
|
||||
chars_read = requested_len;
|
||||
bytes_read = 0;
|
||||
} else {
|
||||
chars_read = 0;
|
||||
bytes_read = requested_len;
|
||||
}
|
||||
|
||||
buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */
|
||||
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
|
||||
|
||||
bufp = (ub1 *) ecalloc(1, buffer_size);
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor->descriptor,
|
||||
(oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */
|
||||
(oraub8 *)&chars_read, /* IN/OUT chars toread/read */
|
||||
(oraub8) offset + 1, /* offset (starts with 1) */
|
||||
(dvoid *) bufp,
|
||||
(oraub8) buffer_size, /* size of buffer */
|
||||
OCI_FIRST_PIECE,
|
||||
(dvoid *)&ctx,
|
||||
(OCICallbackLobRead2) php_oci_lob_callback, /* callback... */
|
||||
(ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
|
||||
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
efree(bufp);
|
||||
|
||||
if (is_clob) {
|
||||
offset = descriptor->lob_current_position + chars_read;
|
||||
} else {
|
||||
offset = descriptor->lob_current_position + bytes_read;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bytes_read = requested_len;
|
||||
buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */
|
||||
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
|
||||
|
||||
bufp = (ub1 *) ecalloc(1, buffer_size);
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor->descriptor,
|
||||
&bytes_read, /* IN/OUT bytes toread/read */
|
||||
offset + 1, /* offset (starts with 1) */
|
||||
(dvoid *) bufp,
|
||||
(ub4) buffer_size, /* size of buffer */
|
||||
(dvoid *)&ctx,
|
||||
(OCICallbackLobRead) php_oci_lob_callback, /* callback... */
|
||||
(ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
|
||||
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
efree(bufp);
|
||||
offset = descriptor->lob_current_position + bytes_read;
|
||||
|
||||
#endif
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
if (*data) {
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
}
|
||||
*data_len = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_current_position = (int)offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
if (*data) {
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
}
|
||||
*data_len = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_write()
|
||||
Write data to the LOB */
|
||||
int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC)
|
||||
{
|
||||
OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
|
||||
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
|
||||
ub4 lob_length;
|
||||
|
||||
*bytes_written = 0;
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!data || data_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
if (offset > descriptor->lob_current_position) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
(ub4 *)&data_len,
|
||||
(ub4) offset + 1,
|
||||
(dvoid *) data,
|
||||
(ub4) data_len,
|
||||
OCI_ONE_PIECE,
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobWrite) 0,
|
||||
(ub2) descriptor->charset_id,
|
||||
(ub1) descriptor->charset_form
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
*bytes_written = 0;
|
||||
return 1;
|
||||
}
|
||||
*bytes_written = data_len;
|
||||
descriptor->lob_current_position += data_len;
|
||||
|
||||
if (descriptor->lob_current_position > descriptor->lob_size) {
|
||||
descriptor->lob_size = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
/* marking buffer as used */
|
||||
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) {
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_set_buffering()
|
||||
Turn buffering off/onn for this particular LOB */
|
||||
int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* disabling when it's already off */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* enabling when it's already on */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (on_off) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
} else {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
}
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_get_buffering()
|
||||
Return current buffering state for the LOB */
|
||||
int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
|
||||
{
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_copy()
|
||||
Copy one LOB (or its part) to another one */
|
||||
int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
ub4 length_dest, length_from, copy_len;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &length_from TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
copy_len = length_from - descriptor_from->lob_current_position;
|
||||
} else {
|
||||
copy_len = length;
|
||||
}
|
||||
|
||||
if ((int)copy_len <= 0) {
|
||||
/* silently fail, there is nothing to copy */
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor_dest->descriptor,
|
||||
descriptor_from->descriptor,
|
||||
copy_len,
|
||||
descriptor_dest->lob_current_position+1,
|
||||
descriptor_from->lob_current_position+1
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_close()
|
||||
Close LOB */
|
||||
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (descriptor->is_open) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
}
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_temp_lob_close()
|
||||
Close Temporary LOB */
|
||||
int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
int is_temporary;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_temporary) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
|
||||
/* {{{ php_oci_lob_flush()
|
||||
Flush buffers for the LOB (only if they have been used) */
|
||||
int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
|
||||
{
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (!lob) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (flush_flag) {
|
||||
case 0:
|
||||
case OCI_LOB_BUFFER_FREE:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* do not really flush buffer, but report success
|
||||
* to suppress OCI error when flushing not used buffer
|
||||
* */
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_USED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* marking buffer as enabled and not used */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_free()
|
||||
Close LOB descriptor and free associated resources */
|
||||
void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
if (!descriptor || !descriptor->connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (descriptor->connection->descriptors) {
|
||||
/* delete descriptor from the hash */
|
||||
zend_hash_apply_with_argument(descriptor->connection->descriptors, php_oci_descriptor_delete_from_hash, (void *)&descriptor->id TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* flushing Lobs & Files with buffering enabled */
|
||||
if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) {
|
||||
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_LOB) {
|
||||
php_oci_temp_lob_close(descriptor TSRMLS_CC);
|
||||
}
|
||||
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
|
||||
|
||||
zend_list_delete(descriptor->connection->rsrc_id);
|
||||
efree(descriptor);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_import()
|
||||
Import LOB contents from the given file */
|
||||
int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC)
|
||||
{
|
||||
int fp;
|
||||
ub4 loblen;
|
||||
OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
char buf[8192];
|
||||
ub4 offset = 1;
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open file %s", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode,
|
||||
OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
&loblen,
|
||||
offset,
|
||||
(dvoid *) &buf,
|
||||
loblen,
|
||||
OCI_ONE_PIECE,
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobWrite) 0,
|
||||
(ub2) descriptor->charset_id,
|
||||
(ub1) descriptor->charset_form
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
close(fp);
|
||||
return 1;
|
||||
}
|
||||
offset += loblen;
|
||||
}
|
||||
close(fp);
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_append()
|
||||
Append data to the end of the LOB */
|
||||
int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
OCILobLocator *lob_dest = descriptor_dest->descriptor;
|
||||
OCILobLocator *lob_from = descriptor_from->descriptor;
|
||||
ub4 dest_len, from_len;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &from_len TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (from_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_truncate()
|
||||
Truncate LOB to the given length */
|
||||
int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lob_length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (new_lob_length < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be greater than or equal to 0");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (new_lob_length > lob_length) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be less than or equal to the current LOB size");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_size = new_lob_length;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_erase()
|
||||
Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */
|
||||
int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
*bytes_erased = 0;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (offset == -1) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
length = lob_length;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
*bytes_erased = length;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_is_equal()
|
||||
Compare two LOB descriptors and figure out if they are pointing to the same LOB */
|
||||
int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_first->connection;
|
||||
OCILobLocator *first_lob = descriptor_first->descriptor;
|
||||
OCILobLocator *second_lob = descriptor_second->descriptor;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
|
||||
|
||||
if (connection->errcode) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_write_tmp()
|
||||
Create temporary LOB and write data to it */
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 bytes_written = 0;
|
||||
|
||||
switch (type) {
|
||||
case OCI_TEMP_BLOB:
|
||||
case OCI_TEMP_CLOB:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %d", type);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data_len < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
OCI_DEFAULT,
|
||||
OCI_DEFAULT,
|
||||
type,
|
||||
OCI_ATTR_NOCACHE,
|
||||
OCI_DURATION_SESSION
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
|
||||
|
||||
if (connection->errcode) {
|
||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->is_open = 1;
|
||||
|
||||
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,627 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package packagerversion="1.4.11" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>oci8</name>
|
||||
<channel>pecl.php.net</channel>
|
||||
<summary>Extension for Oracle Database</summary>
|
||||
<description>This extension allows you to access Oracle databases using the Oracle Call Interface (OCI8). It can be built with PHP 4.3.9 to 5.x. It can be linked with Oracle 9.2, 10.2 or 11.1 client libraries.
|
||||
</description>
|
||||
<lead>
|
||||
<name>Christopher Jones</name>
|
||||
<user>sixd</user>
|
||||
<email>sixd@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Antony Dovgal</name>
|
||||
<user>tony2001</user>
|
||||
<email>tony2001@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Wez Furlong</name>
|
||||
<user>wez</user>
|
||||
<email>wez@php.net</email>
|
||||
<active>no</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Andi Gutmans</name>
|
||||
<user>andi</user>
|
||||
<email>andi@zend.com</email>
|
||||
<active>no</active>
|
||||
</lead>
|
||||
|
||||
<date>2009-03-16</date>
|
||||
<time>10:00:00</time>
|
||||
|
||||
<version>
|
||||
<release>1.3.5</release>
|
||||
<api>1.3.4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed Bug #47243 (Crash at end of request shutdown on Windows)
|
||||
Fixed Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
|
||||
Fixed Bug #46623 (phpinfo doesn't show compile time ORACLE_HOME with phpize)
|
||||
Fixed bug #45458 (Numeric keys for associative arrays are not handled properly) Note: not fixed when building with PHP 4 due to lack of PHP internal helper.
|
||||
Fixed PECL Bug #16035 (oci_connect without ORACLE_HOME defined causes segfault)
|
||||
Fixed PECL Bug #15988 (sqlnet.ora isn't read with older Oracle libraries)
|
||||
Fixed PECL Bug #14268 (Allow "pecl install oci8" command to "autodetect" an Instant Client RPM install)
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<dir name="tests">
|
||||
<file name="array_bind_001.phpt" role="test" />
|
||||
<file name="array_bind_002.phpt" role="test" />
|
||||
<file name="array_bind_003.phpt" role="test" />
|
||||
<file name="array_bind_004.phpt" role="test" />
|
||||
<file name="array_bind_005.phpt" role="test" />
|
||||
<file name="array_bind_006.phpt" role="test" />
|
||||
<file name="array_bind_007.phpt" role="test" />
|
||||
<file name="array_bind_008.phpt" role="test" />
|
||||
<file name="array_bind_009.phpt" role="test" />
|
||||
<file name="array_bind_010.phpt" role="test" />
|
||||
<file name="array_bind_011.phpt" role="test" />
|
||||
<file name="array_bind_012.phpt" role="test" />
|
||||
<file name="array_bind_013.phpt" role="test" />
|
||||
<file name="array_bind_014.phpt" role="test" />
|
||||
<file name="array_bind_date1.phpt" role="test" />
|
||||
<file name="array_bind_date.phpt" role="test" />
|
||||
<file name="array_bind_float1.phpt" role="test" />
|
||||
<file name="array_bind_float.phpt" role="test" />
|
||||
<file name="array_bind_int1.phpt" role="test" />
|
||||
<file name="array_bind_int.phpt" role="test" />
|
||||
<file name="array_bind_str1.phpt" role="test" />
|
||||
<file name="array_bind_str.phpt" role="test" />
|
||||
<file name="b47243_1.phpt" role="test" />
|
||||
<file name="b47243_2.phpt" role="test" />
|
||||
<file name="b47243_3.phpt" role="test" />
|
||||
<file name="bind_char_1.phpt" role="test" />
|
||||
<file name="bind_char_2.phpt" role="test" />
|
||||
<file name="bind_char_3.phpt" role="test" />
|
||||
<file name="bind_char_4.phpt" role="test" />
|
||||
<file name="bind_empty.phpt" role="test" />
|
||||
<file name="bind_long.phpt" role="test" />
|
||||
<file name="bind_long_raw.phpt" role="test" />
|
||||
<file name="bind_raw.phpt" role="test" />
|
||||
<file name="bug26133.phpt" role="test" />
|
||||
<file name="bug27303_2.phpt" role="test" />
|
||||
<file name="bug27303_3.phpt" role="test" />
|
||||
<file name="bug27303_4.phpt" role="test" />
|
||||
<file name="bug27303.phpt" role="test" />
|
||||
<file name="bug32325.phpt" role="test" />
|
||||
<file name="bug35973.phpt" role="test" />
|
||||
<file name="bug36010.phpt" role="test" />
|
||||
<file name="bug36096.phpt" role="test" />
|
||||
<file name="bug37220.phpt" role="test" />
|
||||
<file name="bug37581.phpt" role="test" />
|
||||
<file name="bug38161.phpt" role="test" />
|
||||
<file name="bug38173.phpt" role="test" />
|
||||
<file name="bug40078.phpt" role="test" />
|
||||
<file name="bug40415.phpt" role="test" />
|
||||
<file name="bug41069.phpt" role="test" />
|
||||
<file name="bug42134.phpt" role="test" />
|
||||
<file name="bug42173.phpt" role="test" />
|
||||
<file name="bug42496_1.phpt" role="test" />
|
||||
<file name="bug42496_2.phpt" role="test" />
|
||||
<file name="bug42841.phpt" role="test" />
|
||||
<file name="bug43492_2.phpt" role="test" />
|
||||
<file name="bug43492.phpt" role="test" />
|
||||
<file name="bug43497_92.phpt" role="test" />
|
||||
<file name="bug43497.phpt" role="test" />
|
||||
<file name="bug44008.phpt" role="test" />
|
||||
<file name="bug44113.phpt" role="test" />
|
||||
<file name="bug44206.phpt" role="test" />
|
||||
<file name="bug45458.phpt" role="test" />
|
||||
<file name="bug46994.phpt" role="test" />
|
||||
<file name="bug47189.phpt" role="test" />
|
||||
<file name="bug6109.phpt" role="test" />
|
||||
<file name="close.phpt" role="test" />
|
||||
<file name="coll_001.phpt" role="test" />
|
||||
<file name="coll_002_func.phpt" role="test" />
|
||||
<file name="coll_002.phpt" role="test" />
|
||||
<file name="coll_003_func.phpt" role="test" />
|
||||
<file name="coll_003.phpt" role="test" />
|
||||
<file name="coll_004_func.phpt" role="test" />
|
||||
<file name="coll_004.phpt" role="test" />
|
||||
<file name="coll_005.phpt" role="test" />
|
||||
<file name="coll_006_func.phpt" role="test" />
|
||||
<file name="coll_006.phpt" role="test" />
|
||||
<file name="coll_007.phpt" role="test" />
|
||||
<file name="coll_008.phpt" role="test" />
|
||||
<file name="coll_009_func.phpt" role="test" />
|
||||
<file name="coll_009.phpt" role="test" />
|
||||
<file name="coll_010_func.phpt" role="test" />
|
||||
<file name="coll_010.phpt" role="test" />
|
||||
<file name="coll_011_func.phpt" role="test" />
|
||||
<file name="coll_011.phpt" role="test" />
|
||||
<file name="coll_012_func.phpt" role="test" />
|
||||
<file name="coll_012.phpt" role="test" />
|
||||
<file name="coll_013_func.phpt" role="test" />
|
||||
<file name="coll_013.phpt" role="test" />
|
||||
<file name="coll_014_func.phpt" role="test" />
|
||||
<file name="coll_014.phpt" role="test" />
|
||||
<file name="coll_015_func.phpt" role="test" />
|
||||
<file name="coll_015.phpt" role="test" />
|
||||
<file name="coll_016_func.phpt" role="test" />
|
||||
<file name="coll_016.phpt" role="test" />
|
||||
<file name="coll_017_func.phpt" role="test" />
|
||||
<file name="coll_017.phpt" role="test" />
|
||||
<file name="coll_018.phpt" role="test" />
|
||||
<file name="coll_019.phpt" role="test" />
|
||||
<file name="commit_old.phpt" role="test" />
|
||||
<file name="commit.phpt" role="test" />
|
||||
<file name="connect_1_old.phpt" role="test" />
|
||||
<file name="connect_1.phpt" role="test" />
|
||||
<file name="connect.inc" role="test" />
|
||||
<file name="connect_old.phpt" role="test" />
|
||||
<file name="connect.phpt" role="test" />
|
||||
<file name="connect_scope1.phpt" role="test" />
|
||||
<file name="connect_scope2.phpt" role="test" />
|
||||
<file name="connect_scope_try1.phpt" role="test" />
|
||||
<file name="connect_scope_try2.phpt" role="test" />
|
||||
<file name="connect_scope_try3.phpt" role="test" />
|
||||
<file name="connect_scope_try4.phpt" role="test" />
|
||||
<file name="connect_scope_try5.phpt" role="test" />
|
||||
<file name="connect_scope_try6.phpt" role="test" />
|
||||
<file name="connect_with_charset_001.phpt" role="test" />
|
||||
<file name="connect_without_oracle_home_old.phpt" role="test" />
|
||||
<file name="connect_without_oracle_home.phpt" role="test" />
|
||||
<file name="create_table.inc" role="test" />
|
||||
<file name="create_type.inc" role="test" />
|
||||
<file name="cursor_bind_err.phpt" role="test" />
|
||||
<file name="cursor_bind.phpt" role="test" />
|
||||
<file name="cursors_old.phpt" role="test" />
|
||||
<file name="cursors.phpt" role="test" />
|
||||
<file name="debug.phpt" role="test" />
|
||||
<file name="default_prefetch1.phpt" role="test" />
|
||||
<file name="default_prefetch2.phpt" role="test" />
|
||||
<file name="default_prefetch.phpt" role="test" />
|
||||
<file name="define1.phpt" role="test" />
|
||||
<file name="define2.phpt" role="test" />
|
||||
<file name="define3.phpt" role="test" />
|
||||
<file name="define4.phpt" role="test" />
|
||||
<file name="define5.phpt" role="test" />
|
||||
<file name="define_old.phpt" role="test" />
|
||||
<file name="define.phpt" role="test" />
|
||||
<file name="descriptors.phpt" role="test" />
|
||||
<file name="details.inc" role="test" />
|
||||
<file name="drcp_cclass1.phpt" role="test" />
|
||||
<file name="drcp_characterset.phpt" role="test" />
|
||||
<file name="drcp_conn_close1.phpt" role="test" />
|
||||
<file name="drcp_conn_close2.phpt" role="test" />
|
||||
<file name="drcp_connect1.phpt" role="test" />
|
||||
<file name="drcp_connection_class.phpt" role="test" />
|
||||
<file name="drcp_functions.inc" role="test" />
|
||||
<file name="drcp_newconnect.phpt" role="test" />
|
||||
<file name="drcp_pconn_close1.phpt" role="test" />
|
||||
<file name="drcp_pconn_close2.phpt" role="test" />
|
||||
<file name="drcp_privileged.phpt" role="test" />
|
||||
<file name="drcp_scope1.phpt" role="test" />
|
||||
<file name="drcp_scope2.phpt" role="test" />
|
||||
<file name="drcp_scope3.phpt" role="test" />
|
||||
<file name="drcp_scope4.phpt" role="test" />
|
||||
<file name="drcp_scope5.phpt" role="test" />
|
||||
<file name="drop_table.inc" role="test" />
|
||||
<file name="drop_type.inc" role="test" />
|
||||
<file name="error1.phpt" role="test" />
|
||||
<file name="error2.phpt" role="test" />
|
||||
<file name="error_old.phpt" role="test" />
|
||||
<file name="error.phpt" role="test" />
|
||||
<file name="exec_fetch.phpt" role="test" />
|
||||
<file name="execute_mode.phpt" role="test" />
|
||||
<file name="extauth_01.phpt" role="test" />
|
||||
<file name="extauth_02.phpt" role="test" />
|
||||
<file name="extauth_03.phpt" role="test" />
|
||||
<file name="extauth_04.phpt" role="test" />
|
||||
<file name="fetch_all2.phpt" role="test" />
|
||||
<file name="fetch_all3.phpt" role="test" />
|
||||
<file name="fetch_all.phpt" role="test" />
|
||||
<file name="fetch_array.phpt" role="test" />
|
||||
<file name="fetch_assoc.phpt" role="test" />
|
||||
<file name="fetch_into1.phpt" role="test" />
|
||||
<file name="fetch_into2.phpt" role="test" />
|
||||
<file name="fetch_into.phpt" role="test" />
|
||||
<file name="fetch_object.phpt" role="test" />
|
||||
<file name="fetch.phpt" role="test" />
|
||||
<file name="fetch_row.phpt" role="test" />
|
||||
<file name="field_funcs1.phpt" role="test" />
|
||||
<file name="field_funcs2.phpt" role="test" />
|
||||
<file name="field_funcs_old.phpt" role="test" />
|
||||
<file name="field_funcs.phpt" role="test" />
|
||||
<file name="function_aliases.phpt" role="test" />
|
||||
<file name="lob_001.phpt" role="test" />
|
||||
<file name="lob_002.phpt" role="test" />
|
||||
<file name="lob_003.phpt" role="test" />
|
||||
<file name="lob_004.phpt" role="test" />
|
||||
<file name="lob_005.phpt" role="test" />
|
||||
<file name="lob_006.phpt" role="test" />
|
||||
<file name="lob_007.phpt" role="test" />
|
||||
<file name="lob_008.phpt" role="test" />
|
||||
<file name="lob_009.phpt" role="test" />
|
||||
<file name="lob_009.txt" role="test" />
|
||||
<file name="lob_010.phpt" role="test" />
|
||||
<file name="lob_011.phpt" role="test" />
|
||||
<file name="lob_012.phpt" role="test" />
|
||||
<file name="lob_013.phpt" role="test" />
|
||||
<file name="lob_014.phpt" role="test" />
|
||||
<file name="lob_015.phpt" role="test" />
|
||||
<file name="lob_016.phpt" role="test" />
|
||||
<file name="lob_017.phpt" role="test" />
|
||||
<file name="lob_018.phpt" role="test" />
|
||||
<file name="lob_019.phpt" role="test" />
|
||||
<file name="lob_020.phpt" role="test" />
|
||||
<file name="lob_021.phpt" role="test" />
|
||||
<file name="lob_022.phpt" role="test" />
|
||||
<file name="lob_023.phpt" role="test" />
|
||||
<file name="lob_024.phpt" role="test" />
|
||||
<file name="lob_025.phpt" role="test" />
|
||||
<file name="lob_026.phpt" role="test" />
|
||||
<file name="lob_027.phpt" role="test" />
|
||||
<file name="lob_028.phpt" role="test" />
|
||||
<file name="lob_029.phpt" role="test" />
|
||||
<file name="lob_030.phpt" role="test" />
|
||||
<file name="lob_031.phpt" role="test" />
|
||||
<file name="lob_032.phpt" role="test" />
|
||||
<file name="lob_033.phpt" role="test" />
|
||||
<file name="lob_034.phpt" role="test" />
|
||||
<file name="lob_035.phpt" role="test" />
|
||||
<file name="lob_036.phpt" role="test" />
|
||||
<file name="lob_037.phpt" role="test" />
|
||||
<file name="lob_038.phpt" role="test" />
|
||||
<file name="lob_039.phpt" role="test" />
|
||||
<file name="lob_040.phpt" role="test" />
|
||||
<file name="lob_041.phpt" role="test" />
|
||||
<file name="lob_042.phpt" role="test" />
|
||||
<file name="lob_aliases.phpt" role="test" />
|
||||
<file name="lob_null.phpt" role="test" />
|
||||
<file name="lob_temp1.phpt" role="test" />
|
||||
<file name="lob_temp.phpt" role="test" />
|
||||
<file name="minfo.phpt" role="test" />
|
||||
<file name="num.phpt" role="test" />
|
||||
<file name="oci8safemode.phpt" role="test" />
|
||||
<file name="oci_execute_segfault.phpt" role="test" />
|
||||
<file name="old_oci_close1.phpt" role="test" />
|
||||
<file name="old_oci_close.phpt" role="test" />
|
||||
<file name="parse_error.phpt" role="test" />
|
||||
<file name="password_2.phpt" role="test" />
|
||||
<file name="password_new.phpt" role="test" />
|
||||
<file name="password_old.phpt" role="test" />
|
||||
<file name="password.phpt" role="test" />
|
||||
<file name="pecl_bug10194_blob_64.phpt" role="test" />
|
||||
<file name="pecl_bug10194_blob.phpt" role="test" />
|
||||
<file name="pecl_bug10194.phpt" role="test" />
|
||||
<file name="pecl_bug16035.phpt" role="test" />
|
||||
<file name="pecl_bug8816.phpt" role="test" />
|
||||
<file name="persistent.phpt" role="test" />
|
||||
<file name="prefetch_old.phpt" role="test" />
|
||||
<file name="prefetch.phpt" role="test" />
|
||||
<file name="privileged_connect1.phpt" role="test" />
|
||||
<file name="privileged_connect.phpt" role="test" />
|
||||
<file name="reflection1.phpt" role="test" />
|
||||
<file name="reflection2.phpt" role="test" />
|
||||
<file name="rowid_bind.phpt" role="test" />
|
||||
<file name="select_null.phpt" role="test" />
|
||||
<file name="serverversion.phpt" role="test" />
|
||||
<file name="skipif.inc" role="test" />
|
||||
<file name="statement_cache.phpt" role="test" />
|
||||
<file name="statement_type_old.phpt" role="test" />
|
||||
<file name="statement_type.phpt" role="test" />
|
||||
<file name="test.gif" role="test" />
|
||||
<file name="testping.phpt" role="test" />
|
||||
<file name="test.txt" role="test" />
|
||||
<file name="uncommitted.phpt" role="test" />
|
||||
<file name="xmltype_01.phpt" role="test" />
|
||||
</dir> <!-- //tests -->
|
||||
<file name="config.m4" role="src" />
|
||||
<file name="config.w32" role="src" />
|
||||
<file name="CREDITS" role="doc" />
|
||||
<file name="oci8.c" role="src" />
|
||||
<file name="oci8.dsp" role="src" />
|
||||
<file name="oci8_collection.c" role="src" />
|
||||
<file name="oci8_interface.c" role="src" />
|
||||
<file name="oci8_lob.c" role="src" />
|
||||
<file name="oci8_statement.c" role="src" />
|
||||
<file name="php_oci8.h" role="src" />
|
||||
<file name="php_oci8_int.h" role="src" />
|
||||
<file name="README" role="doc" />
|
||||
</dir> <!-- / -->
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>4.3.9</min>
|
||||
<max>6.0.0</max>
|
||||
<exclude>6.0.0</exclude>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.4.0b1</min>
|
||||
</pearinstaller>
|
||||
</required>
|
||||
</dependencies>
|
||||
<providesextension>oci8</providesextension>
|
||||
<extsrcrelease>
|
||||
<configureoption default="autodetect" name="with-oci8" prompt="Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client" />
|
||||
</extsrcrelease>
|
||||
<changelog>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.4</release>
|
||||
<api>1.3.4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Enhancement - Allow External Authentication (not supported on Windows)
|
||||
Enhancement - Reflection will show function and method arguments with PHP 5.x
|
||||
Increase default oci8.default_prefetch from 10 to 100
|
||||
Correctly define SQLT_BDOUBLE and SQLT_BFLOAT constants with Oracle 10g ORACLE_HOME builds
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.3</release>
|
||||
<api>1.3.3</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Changed OCI NLS initialization for consistency and technical correctness
|
||||
Removed obsolete macros
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.2</release>
|
||||
<api>1.3.2</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Refine DRCP connection pooling functionality
|
||||
Do scope-end release for oci_pconnect (oci8.old_oci_close_semantics=1 gives old behavior)
|
||||
Fixed bug #44372 (compilation with Oracle 10gR1 libraries)
|
||||
Fixed PECL bug #12431 (PEAR install using x86_64 RPM builds)
|
||||
Allow builds with PHP 4.3.9 onwards
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.1</release>
|
||||
<api>1.3.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed bug #44113 (New collection creation can fail with OCI-22303)
|
||||
Fixed bug #42841 (Crash with REF CURSORS when statement caching enabled)
|
||||
Fixed bug #42496 (Cursor leak selecting LOBs
|
||||
Fixed bug #43497 (Temporary LOB leak)
|
||||
Fixed PECL bug #12431 (ping functionality is broken)
|
||||
Allow compilation with 64bit Instant Client RPMs
|
||||
Allow -with-oci8=instantclient with no directory specified look for RPM install
|
||||
Refine DRCP functionality
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.0</release>
|
||||
<api>1.3.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Added DRCP and FAN support.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.5</release>
|
||||
<api>1.2.5</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
This release is based on the OCI8 included in PHP 5.2.6, with the addition of the fix for http://pecl.php.net/bugs/bug.php?id=13523.
|
||||
--------
|
||||
Fixed bug #42496 (cursor leak selecting LOBs http://bugs.php.net/bug.php?id=42496
|
||||
Fixed bug #42841 (crash with REF CURSORS when statement caching enabled) http://bugs.php.net/bug.php?id=42841
|
||||
Fixed bug #43497 (Temporary LOB leak) http://bugs.php.net/bug.php?id=43497
|
||||
Fixed bug #44206 (OCI8 selecting ref cursors leads to ORA-1000 maximum open cursors reached).
|
||||
Fixed bug #44008 (OCI8 incorrect usage of OCI-Lob->close crashes PHP).
|
||||
Fixed bug #44113 (new collection creation can fail with OCI-22303) http://bugs.php.net/bug.php?id=44113
|
||||
Enhancement - make -with-oci8=instantclient with no directory specified look for RPM install
|
||||
Enhancement - compile with 64bit Instant Client RPMs (bug http://bugs.php.net/bug.php?id=41941, http://pecl.php.net/bugs/bug.php?id=13523)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.4</release>
|
||||
<api>1.2.4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback)
|
||||
Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types)
|
||||
Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails)
|
||||
Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed)
|
||||
Fixed bug #41711 (Null temporary lobs not supported)
|
||||
Fixed bug #41594 (Statement cache is flushed too frequently)
|
||||
Fixed bug #40415 (oci_fetch_all and nested cursors, allocate descriptors dynamically)
|
||||
Fixed segfault on rebinding and re-executing a statement with LOBs.
|
||||
Fixed compile failure in ZTS mode when collections support is missing.
|
||||
Allowed statement cache size to be set for non-persistent connections.
|
||||
Improved oci_password_change() to close persistent connections on shutdown (to update hashed connection details)
|
||||
Changed oci_pconnect() to behave like oci_connect() when SYSDBA and SYSOPER privileges are used.
|
||||
Various minor improvements.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.3</release>
|
||||
<api>1.2.3</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2007-01-25</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
|
||||
Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
|
||||
Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
|
||||
Fixed bug #39732 (oci_bind_array_by_name doesn't work on Solaris 64bit).
|
||||
Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
|
||||
Various minor improvements.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.2</release>
|
||||
<api>1.2.2</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-08-24</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
|
||||
Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
|
||||
Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
|
||||
Fixed bug #37886 (oci_connect may crash when charset parameter is given)
|
||||
Fixed bug #37931 (possible crash after database restart when using persistent connections)
|
||||
Fixed bug #37531 (oci8 persistent connection corruption)
|
||||
Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
|
||||
Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
|
||||
Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
|
||||
Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
|
||||
Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.1</release>
|
||||
<api>1.2.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-05-02</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Added support for BINARY_DOUBLE and BINARY_FLOAT (see #36764)
|
||||
Changed oci_field_type() to return VARCHAR2 instead of VARCHAR (according to feature request #36800)
|
||||
Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields)
|
||||
Fixed bug #37055 (incorrect reference counting for persistent OCI8 connections)
|
||||
Fixed bug #36934 (OCILob->read() doesn't move internal pointer when reading 0's)
|
||||
Fixed bug #36851 (Documentation and code discrepancies for NULL data)
|
||||
Fixed bug #36820 (Privileged connection with an Oracle password file fails)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.0</release>
|
||||
<api>1.2.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-03-16</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version < 10.2
|
||||
Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch)
|
||||
Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed)
|
||||
Fixed bug #36055 (possible OCI8 crash in multithreaded environment)
|
||||
Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters)
|
||||
Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close())
|
||||
Fixed bug #33383 (crash when retrieving empty BLOBs)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.1.1</release>
|
||||
<api>1.1.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2005-09-22</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed segfault when binding empty values.
|
||||
Fixed problem with oci_error() without arguments.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.1</release>
|
||||
<api>1.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2005-09-07</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>This release fixes a huge amount of bugs and adds support of
|
||||
statement caching, external credentials etc.
|
||||
See official announce for details.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.0</release>
|
||||
<api>1.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2004-03-19</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>package.xml added to support installation using pear installer
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
</changelog>
|
||||
</package>
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#if HAVE_OCI8
|
||||
# ifndef PHP_OCI8_H
|
||||
# define PHP_OCI8_H
|
||||
|
||||
#ifdef ZTS
|
||||
# include "TSRM.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The version of the OCI8 extension.
|
||||
*/
|
||||
#ifdef PHP_OCI8_VERSION
|
||||
/* The definition of PHP_OCI8_VERSION changed in PHP 5.3 and building
|
||||
* this code with PHP 5.2 and earlier (e.g. when using OCI8 from PECL)
|
||||
* will conflict.
|
||||
*/
|
||||
#undef PHP_OCI8_VERSION
|
||||
#endif
|
||||
#define PHP_OCI8_VERSION "1.3.5"
|
||||
|
||||
extern zend_module_entry oci8_module_entry;
|
||||
#define phpext_oci8_ptr &oci8_module_entry
|
||||
#define phpext_oci8_11g_ptr &oci8_module_entry
|
||||
|
||||
|
||||
PHP_MINIT_FUNCTION(oci);
|
||||
PHP_RINIT_FUNCTION(oci);
|
||||
PHP_MSHUTDOWN_FUNCTION(oci);
|
||||
PHP_RSHUTDOWN_FUNCTION(oci);
|
||||
PHP_MINFO_FUNCTION(oci);
|
||||
|
||||
# endif /* !PHP_OCI8_H */
|
||||
#else /* !HAVE_OCI8 */
|
||||
|
||||
# define oci8_module_ptr NULL
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,505 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#if HAVE_OCI8
|
||||
# ifndef PHP_OCI8_INT_H
|
||||
# define PHP_OCI8_INT_H
|
||||
|
||||
/* misc defines {{{ */
|
||||
# if (defined(__osf__) && defined(__alpha))
|
||||
# ifndef A_OSF
|
||||
# define A_OSF
|
||||
# endif
|
||||
# ifndef OSF1
|
||||
# define OSF1
|
||||
# endif
|
||||
# ifndef _INTRINSICS
|
||||
# define _INTRINSICS
|
||||
# endif
|
||||
# endif /* osf alpha */
|
||||
|
||||
#if defined(min)
|
||||
#undef min
|
||||
#endif
|
||||
#if defined(max)
|
||||
#undef max
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
#include "ext/standard/php_string.h"
|
||||
#include <oci.h>
|
||||
|
||||
extern int le_connection;
|
||||
extern int le_pconnection;
|
||||
extern int le_statement;
|
||||
extern int le_descriptor;
|
||||
extern int le_collection;
|
||||
extern int le_server;
|
||||
extern int le_session;
|
||||
|
||||
extern zend_class_entry *oci_lob_class_entry_ptr;
|
||||
extern zend_class_entry *oci_coll_class_entry_ptr;
|
||||
|
||||
/* constants {{{ */
|
||||
#define PHP_OCI_SEEK_SET 0
|
||||
#define PHP_OCI_SEEK_CUR 1
|
||||
#define PHP_OCI_SEEK_END 2
|
||||
|
||||
#define PHP_OCI_MAX_NAME_LEN 64
|
||||
#define PHP_OCI_MAX_DATA_SIZE INT_MAX
|
||||
#define PHP_OCI_PIECE_SIZE ((64*1024)-1)
|
||||
#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */
|
||||
|
||||
#define PHP_OCI_ASSOC (1<<0)
|
||||
#define PHP_OCI_NUM (1<<1)
|
||||
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
|
||||
|
||||
#define PHP_OCI_RETURN_NULLS (1<<2)
|
||||
#define PHP_OCI_RETURN_LOBS (1<<3)
|
||||
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN (1<<4)
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_ROW (1<<5)
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
|
||||
|
||||
#define PHP_OCI_LOB_BUFFER_DISABLED 0
|
||||
#define PHP_OCI_LOB_BUFFER_ENABLED 1
|
||||
#define PHP_OCI_LOB_BUFFER_USED 2
|
||||
|
||||
/* The mode parameter for oci_connect() is overloaded and accepts both
|
||||
* privilege and external authentication flags OR'd together.
|
||||
* PHP_OCI_CRED_EXT must be distinct from the OCI_xxx privilege
|
||||
* values.
|
||||
*/
|
||||
#define PHP_OCI_CRED_EXT (1<<31)
|
||||
#if ((PHP_OCI_CRED_EXT == OCI_DEFAULT) || (PHP_OCI_CRED_EXT & (OCI_SYSOPER | OCI_SYSDBA)))
|
||||
#error Invalid value for PHP_OCI_CRED_EXT
|
||||
#endif
|
||||
|
||||
/* }}} */
|
||||
|
||||
typedef struct { /* php_oci_spool {{{ */
|
||||
OCIEnv *env; /*env of this session pool */
|
||||
OCIError *err; /* pool's error handle */
|
||||
OCISPool *poolh; /* pool handle */
|
||||
void *poolname; /* session pool name */
|
||||
unsigned int poolname_len; /* length of session pool name */
|
||||
char *spool_hash_key; /* Hash key for session pool in plist */
|
||||
} php_oci_spool; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_connection {{{ */
|
||||
OCIEnv *env; /* private env handle */
|
||||
ub2 charset; /* charset ID */
|
||||
OCIServer *server; /* private server handle */
|
||||
OCISvcCtx *svc; /* private service context handle */
|
||||
OCISession *session; /* private session handle */
|
||||
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
|
||||
OCIError *err; /* private error handle */
|
||||
php_oci_spool *private_spool; /* private session pool (for persistent) */
|
||||
sword errcode; /* last errcode */
|
||||
|
||||
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
|
||||
unsigned is_open:1; /* hels to determine if the connection is dead or not */
|
||||
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
|
||||
unsigned is_persistent:1; /* self-descriptive */
|
||||
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
|
||||
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
|
||||
unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
|
||||
unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */
|
||||
unsigned using_spool:1; /* Is this connection from session pool? */
|
||||
int rsrc_id; /* resource ID */
|
||||
time_t idle_expiry; /* time when the connection will be considered as expired */
|
||||
time_t *next_pingp; /* (pointer to) time of the next ping */
|
||||
char *hash_key; /* hashed details of the connection */
|
||||
} php_oci_connection; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_descriptor {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
dvoid *descriptor; /* OCI descriptor handle */
|
||||
ub4 type; /* descriptor type (FILE/LOB) */
|
||||
int lob_current_position; /* LOB internal pointer */
|
||||
int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */
|
||||
int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
|
||||
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
|
||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||
ub2 charset_id; /* charset ID */
|
||||
unsigned is_open:1; /* helps to determine if lob is open or not */
|
||||
} php_oci_descriptor; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_lob_ctx {{{ */
|
||||
char **lob_data; /* address of pointer to LOB data */
|
||||
ub4 *lob_len; /* address of LOB length variable (bytes) */
|
||||
ub4 alloc_len;
|
||||
} php_oci_lob_ctx; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_collection {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
OCIType *tdo; /* collection's type handle */
|
||||
OCITypeCode coll_typecode; /* collection's typecode handle */
|
||||
OCIRef *elem_ref; /* element's reference handle */
|
||||
OCIType *element_type; /* element's type handle */
|
||||
OCITypeCode element_typecode; /* element's typecode handle */
|
||||
OCIColl *collection; /* collection handle */
|
||||
} php_oci_collection; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_define {{{ */
|
||||
zval *zval; /* zval used in define */
|
||||
text *name; /* placeholder's name */
|
||||
ub4 name_len; /* placeholder's name length */
|
||||
ub4 type; /* define type */
|
||||
} php_oci_define; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_statement {{{ */
|
||||
int id;
|
||||
int parent_stmtid; /* parent statement id */
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
sword errcode; /* last errcode*/
|
||||
OCIError *err; /* private error handle */
|
||||
OCIStmt *stmt; /* statement handle */
|
||||
char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
|
||||
long last_query_len; /* last query length */
|
||||
HashTable *columns; /* hash containing all the result columns */
|
||||
HashTable *binds; /* binds hash */
|
||||
HashTable *defines; /* defines hash */
|
||||
int ncolumns; /* number of columns in the result */
|
||||
unsigned executed:1; /* statement executed flag */
|
||||
unsigned has_data:1; /* statement has more data flag */
|
||||
ub2 stmttype; /* statement type */
|
||||
} php_oci_statement; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_bind {{{ */
|
||||
OCIBind *bind; /* bind handle */
|
||||
zval *zval; /* value */
|
||||
dvoid *descriptor; /* used for binding of LOBS etc */
|
||||
OCIStmt *statement; /* used for binding REFCURSORs */
|
||||
php_oci_statement *parent_statement; /* pointer to the parent statement */
|
||||
struct {
|
||||
void *elements;
|
||||
sb2 *indicators;
|
||||
ub2 *element_lengths;
|
||||
ub4 current_length;
|
||||
ub4 old_length;
|
||||
ub4 max_length;
|
||||
long type;
|
||||
} array;
|
||||
sb2 indicator; /* -1 means NULL */
|
||||
ub2 retcode;
|
||||
ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
|
||||
} php_oci_bind; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_out_column {{{ */
|
||||
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
|
||||
php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
|
||||
OCIDefine *oci_define; /* define handle */
|
||||
char *name; /* column name */
|
||||
ub4 name_len; /* column name length */
|
||||
ub2 data_type; /* column data type */
|
||||
ub2 data_size; /* data size */
|
||||
ub4 storage_size4; /* size used when allocating buffers */
|
||||
sb2 indicator;
|
||||
ub2 retcode; /* code returned when fetching this particular column */
|
||||
ub2 retlen;
|
||||
ub4 retlen4;
|
||||
ub2 is_descr; /* column contains a descriptor */
|
||||
ub2 is_cursor; /* column contains a cursor */
|
||||
int stmtid; /* statement id for cursors */
|
||||
int descid; /* descriptor id for descriptors */
|
||||
void *data;
|
||||
php_oci_define *define; /* define handle */
|
||||
int piecewise; /* column is fetched piece-by-piece */
|
||||
ub4 cb_retlen;
|
||||
sb1 scale; /* column scale */
|
||||
sb2 precision; /* column precision */
|
||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||
ub2 charset_id; /* charset ID */
|
||||
} php_oci_out_column; /* }}} */
|
||||
|
||||
/* {{{ macros */
|
||||
|
||||
#define PHP_OCI_CALL(func, params) \
|
||||
do { \
|
||||
if (OCI_G(debug_mode)) { \
|
||||
php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
|
||||
} \
|
||||
OCI_G(in_call) = 1; \
|
||||
func params; \
|
||||
OCI_G(in_call) = 0; \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_CALL_RETURN(__retval, func, params) \
|
||||
do { \
|
||||
if (OCI_G(debug_mode)) { \
|
||||
php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
|
||||
} \
|
||||
OCI_G(in_call) = 1; \
|
||||
__retval = func params; \
|
||||
OCI_G(in_call) = 0; \
|
||||
} while (0)
|
||||
|
||||
/* Check for errors that indicate the connection to the DB is no
|
||||
* longer valid. If it isn't, then the PHP connection is marked to be
|
||||
* reopened by the next PHP OCI8 connect command. This is most useful
|
||||
* for persistent connections. The error number list is not
|
||||
* exclusive. The error number comparisons and the
|
||||
* OCI_ATTR_SERVER_STATUS check are done for maximum cross-version
|
||||
* compatibility. In the far future, only the attribute check will be
|
||||
* needed.
|
||||
*/
|
||||
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
|
||||
do { \
|
||||
switch (errcode) { \
|
||||
case 1013: \
|
||||
zend_bailout(); \
|
||||
break; \
|
||||
case 22: \
|
||||
case 378: \
|
||||
case 602: \
|
||||
case 603: \
|
||||
case 604: \
|
||||
case 609: \
|
||||
case 1012: \
|
||||
case 1033: \
|
||||
case 1041: \
|
||||
case 1043: \
|
||||
case 1089: \
|
||||
case 1090: \
|
||||
case 1092: \
|
||||
case 3113: \
|
||||
case 3114: \
|
||||
case 3122: \
|
||||
case 3135: \
|
||||
case 12153: \
|
||||
case 27146: \
|
||||
case 28511: \
|
||||
(connection)->is_open = 0; \
|
||||
break; \
|
||||
default: \
|
||||
{ \
|
||||
ub4 serverStatus = OCI_SERVER_NORMAL; \
|
||||
PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
|
||||
(ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
|
||||
if (serverStatus != OCI_SERVER_NORMAL) { \
|
||||
(connection)->is_open = 0; \
|
||||
} \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
|
||||
do { \
|
||||
resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
|
||||
ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
|
||||
ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
|
||||
ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
|
||||
ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
|
||||
|
||||
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
|
||||
do { \
|
||||
var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
|
||||
if (!var) { \
|
||||
return 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_STATEMENT_EX(zval, statement) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, statement, php_oci_statement *, "oci8 statement", le_statement)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(zval, descriptor) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, descriptor, php_oci_descriptor *, "oci8 descriptor", le_descriptor)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_COLLECTION_EX(zval, collection) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, collection, php_oci_collection *, "oci8 collection", le_collection)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* PROTOS */
|
||||
|
||||
/* main prototypes {{{ */
|
||||
|
||||
void php_oci_column_hash_dtor (void *data);
|
||||
void php_oci_define_hash_dtor (void *data);
|
||||
void php_oci_bind_hash_dtor (void *data);
|
||||
void php_oci_descriptor_flush_hash_dtor (void *data);
|
||||
int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC);
|
||||
|
||||
sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
|
||||
sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
|
||||
int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
|
||||
|
||||
void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
|
||||
php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
|
||||
|
||||
int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
|
||||
int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
|
||||
int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC);
|
||||
|
||||
int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
|
||||
int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
|
||||
|
||||
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
|
||||
int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* lob related prototypes {{{ */
|
||||
|
||||
php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
|
||||
int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
|
||||
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 *, long TSRMLS_DC);
|
||||
int php_oci_lob_set_buffering (php_oci_descriptor *, int 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);
|
||||
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
|
||||
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
|
||||
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC);
|
||||
int php_oci_lob_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
|
||||
#else
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
/* collection related prototypes {{{ */
|
||||
|
||||
php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
|
||||
int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
|
||||
int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
|
||||
int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
|
||||
int php_oci_collection_element_set(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
|
||||
int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
|
||||
void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
|
||||
int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
|
||||
int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
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 *, int TSRMLS_DC);
|
||||
int php_oci_statement_set_prefetch (php_oci_statement *, long 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 *, 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);
|
||||
int php_oci_bind_pre_exec(void *data TSRMLS_DC);
|
||||
int php_oci_bind_post_exec(void *data TSRMLS_DC);
|
||||
int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, ub2 TSRMLS_DC);
|
||||
sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
|
||||
sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
|
||||
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
|
||||
|
||||
int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
|
||||
int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
|
||||
int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
|
||||
sword errcode; /* global last error code (used when connect fails, for example) */
|
||||
OCIError *err; /* global error handle */
|
||||
|
||||
zend_bool debug_mode; /* debug mode flag */
|
||||
|
||||
long max_persistent; /* maximum number of persistent connections per process */
|
||||
long num_persistent; /* number of existing persistent connections */
|
||||
long num_links; /* non-persistent + persistent connections */
|
||||
long num_statements; /* number of statements open */
|
||||
long ping_interval; /* time interval between pings */
|
||||
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
|
||||
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
|
||||
long default_prefetch; /* default prefetch setting */
|
||||
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
|
||||
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
|
||||
|
||||
int shutdown; /* in shutdown flag */
|
||||
|
||||
OCIEnv *env; /* global environment handle */
|
||||
|
||||
zend_bool in_call;
|
||||
char *connection_class;
|
||||
zend_bool events;
|
||||
ZEND_END_MODULE_GLOBALS(oci) /* }}} */
|
||||
|
||||
#ifdef ZTS
|
||||
#define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v)
|
||||
#else
|
||||
#define OCI_G(v) (oci_globals.v)
|
||||
#endif
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(oci)
|
||||
|
||||
# endif /* !PHP_OCI8_INT_H */
|
||||
#else /* !HAVE_OCI8 */
|
||||
|
||||
# define oci8_module_ptr NULL
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,69 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 1
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = "";
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
}
|
||||
Done
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 2
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 0, 0, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "06-DEC-05"
|
||||
[1]=>
|
||||
string(9) "10-DEC-80"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "26-OCT-17"
|
||||
[4]=>
|
||||
string(9) "05-NOV-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 3
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): OCI_NO_DATA in %s on line %d
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(9) "06-DEC-05"
|
||||
[1]=>
|
||||
string(9) "10-DEC-80"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "26-OCT-17"
|
||||
}
|
||||
Done
|
||||
@@ -1,65 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 4
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): OCI_NO_DATA in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 5
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("", "", "", "", "");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(0) ""
|
||||
[4]=>
|
||||
string(0) ""
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR and default max_length
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 7
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, -1);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
Done
|
||||
@@ -1,78 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 8
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-06550: line %d, column %d:
|
||||
PLS-00418: array bind type must match PL/SQL table row type
|
||||
ORA-06550: line %d, column %d:
|
||||
PL/SQL: Statement ignored in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "2"
|
||||
[2]=>
|
||||
string(1) "3"
|
||||
[3]=>
|
||||
string(1) "4"
|
||||
[4]=>
|
||||
string(1) "5"
|
||||
}
|
||||
Done
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 9
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 8
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "2"
|
||||
[2]=>
|
||||
string(1) "3"
|
||||
[3]=>
|
||||
string(1) "4"
|
||||
[4]=>
|
||||
string(1) "5"
|
||||
}
|
||||
Done
|
||||
@@ -1,67 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = array();
|
||||
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0));
|
||||
|
||||
@oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and NUMBERs
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
for ($i = 1; $i < 6; $i++) {
|
||||
$statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
|
||||
oci_execute($statement);
|
||||
}
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
$array = Array();
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(1)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_ODT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
[1]=>
|
||||
string(9) "26-OCT-17"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "10-DEC-80"
|
||||
[4]=>
|
||||
string(9) "06-DEC-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_ODT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
[1]=>
|
||||
string(9) "26-OCT-17"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "10-DEC-80"
|
||||
[4]=>
|
||||
string(9) "06-DEC-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_FLT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name FLOAT)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1.243,2.5658,3.4234,4.2123,5.9999);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_FLT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
[1]=>
|
||||
float(4.2123)
|
||||
[2]=>
|
||||
float(3.4234)
|
||||
[3]=>
|
||||
float(2.5658)
|
||||
[4]=>
|
||||
float(1.243)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_FLT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name FLOAT)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1.243,2.5658,3.4234,4.2123,5.9999);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_FLT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
[1]=>
|
||||
float(4.2123)
|
||||
[2]=>
|
||||
float(3.4234)
|
||||
[3]=>
|
||||
float(2.5658)
|
||||
[4]=>
|
||||
float(1.243)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_INT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_NUM);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(1)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_INT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_INT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(1)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_AVC
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_AVC
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #47243 (Crash on exit with ZTS mode)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
|
||||
oci_execute($s);
|
||||
oci_fetch_all($s, $r);
|
||||
|
||||
// No explicit free or close
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===DONE===
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #47243 (Crash on exit with ZTS mode)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
|
||||
oci_execute($s);
|
||||
oci_fetch_all($s, $r);
|
||||
|
||||
oci_free_statement($s);
|
||||
// no explicit close
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===DONE===
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #47243 (Crash on exit with ZTS mode)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
|
||||
oci_execute($s);
|
||||
oci_fetch_all($s, $r);
|
||||
|
||||
// With explicit free and close
|
||||
oci_free_statement($s);
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===DONE===
|
||||
@@ -1,295 +0,0 @@
|
||||
--TEST--
|
||||
SELECT oci_bind_by_name with SQLT_AFC aka CHAR
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab",
|
||||
"create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
|
||||
"insert into bind_char_tab values (1, 'abc', NULL)",
|
||||
"insert into bind_char_tab values (2, NULL, 'abc')",
|
||||
"insert into bind_char_tab values (3, NULL, 'abc ')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "*** Non-null Data Tests against CHAR***\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
|
||||
echo "Test 1.1: Type: default. Length: default\n";
|
||||
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.2: Type: AFC. Length: default\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.3: Type: AFC: Length: 0\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.4: Type: AFC: Length: strlen\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "\n\n*** NULL data tests against CHAR ***\n";
|
||||
|
||||
$bv1 = null;
|
||||
|
||||
echo "Test 2.1: Type: default. Length: default\n";
|
||||
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 2.2: Type: AFC. Length: default\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 2.3: Type: AFC: Length: 0\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 2.4: Type: AFC: Length: strlen\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 2.5: Type: AFC. Length: strlen-1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 2.6: Type: AFC. Length: strlen+1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
|
||||
echo "\n\n*** Non-null Data Tests against VARCHAR2***\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
|
||||
echo "Test 3.1: Type: default. Length: default\n";
|
||||
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 3.2: Type: AFC. Length: default\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 3.3: Type: AFC: Length: 0\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 3.4: Type: AFC: Length: strlen\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 3.5: Type: AFC. Length: strlen-1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 3.6: Type: AFC. Length: strlen+1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
|
||||
echo "\n\n*** NULL data tests against VARCHAR2 ***\n";
|
||||
|
||||
$bv1 = null;
|
||||
|
||||
echo "Test 4.1: Type: default. Length: default\n";
|
||||
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 4.2: Type: AFC. Length: default\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 4.3: Type: AFC: Length: 0\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 4.4: Type: AFC: Length: strlen\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 4.5: Type: AFC. Length: strlen-1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 4.6: Type: AFC. Length: strlen+1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
|
||||
|
||||
function do_e_q($s)
|
||||
{
|
||||
echo " Querying:\n";
|
||||
|
||||
$r = @oci_execute($s);
|
||||
if (!$r) {
|
||||
$m = oci_error($s);
|
||||
echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
|
||||
return;
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
|
||||
foreach ($row as $item) {
|
||||
echo " :" . $item . ":\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Non-null Data Tests against CHAR***
|
||||
Test 1.1: Type: default. Length: default
|
||||
Querying:
|
||||
Test 1.2: Type: AFC. Length: default
|
||||
Querying:
|
||||
:1:
|
||||
:abc :
|
||||
::
|
||||
Test 1.3: Type: AFC: Length: 0
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 1.4: Type: AFC: Length: strlen
|
||||
Querying:
|
||||
:1:
|
||||
:abc :
|
||||
::
|
||||
Test 1.5: Type: AFC. Length: strlen-1
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 1.6: Type: AFC. Length: strlen+1
|
||||
Querying:
|
||||
:1:
|
||||
:abc :
|
||||
::
|
||||
|
||||
|
||||
*** NULL data tests against CHAR ***
|
||||
Test 2.1: Type: default. Length: default
|
||||
Querying:
|
||||
Test 2.2: Type: AFC. Length: default
|
||||
Querying:
|
||||
Test 2.3: Type: AFC: Length: 0
|
||||
Querying:
|
||||
Test 2.4: Type: AFC: Length: strlen
|
||||
Querying:
|
||||
Test 2.5: Type: AFC. Length: strlen-1
|
||||
Querying:
|
||||
Test 2.6: Type: AFC. Length: strlen+1
|
||||
Querying:
|
||||
|
||||
|
||||
*** Non-null Data Tests against VARCHAR2***
|
||||
Test 3.1: Type: default. Length: default
|
||||
Querying:
|
||||
:2:
|
||||
::
|
||||
:abc:
|
||||
Test 3.2: Type: AFC. Length: default
|
||||
Querying:
|
||||
:2:
|
||||
::
|
||||
:abc:
|
||||
Test 3.3: Type: AFC: Length: 0
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 3.4: Type: AFC: Length: strlen
|
||||
Querying:
|
||||
:2:
|
||||
::
|
||||
:abc:
|
||||
Test 3.5: Type: AFC. Length: strlen-1
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 3.6: Type: AFC. Length: strlen+1
|
||||
Querying:
|
||||
:2:
|
||||
::
|
||||
:abc:
|
||||
|
||||
|
||||
*** NULL data tests against VARCHAR2 ***
|
||||
Test 4.1: Type: default. Length: default
|
||||
Querying:
|
||||
Test 4.2: Type: AFC. Length: default
|
||||
Querying:
|
||||
Test 4.3: Type: AFC: Length: 0
|
||||
Querying:
|
||||
Test 4.4: Type: AFC: Length: strlen
|
||||
Querying:
|
||||
Test 4.5: Type: AFC. Length: strlen-1
|
||||
Querying:
|
||||
Test 4.6: Type: AFC. Length: strlen+1
|
||||
Querying:
|
||||
Done
|
||||
@@ -1,123 +0,0 @@
|
||||
--TEST--
|
||||
SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"alter session set nls_date_format='YYYY-MM-DD'",
|
||||
"drop table bind_char_tab",
|
||||
"create table bind_char_tab (id number, c1 date)",
|
||||
"insert into bind_char_tab values (1, '2008-04-20')",
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
$bv1 = '2008-04-20';
|
||||
|
||||
echo "Test 1.1: Type: default. Length: default\n";
|
||||
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.2: Type: AFC. Length: default\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.3: Type: AFC: Length: 0\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.4: Type: AFC: Length: strlen\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
|
||||
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e_q($s);
|
||||
|
||||
|
||||
function do_e_q($s)
|
||||
{
|
||||
echo " Querying:\n";
|
||||
|
||||
$r = @oci_execute($s);
|
||||
if (!$r) {
|
||||
$m = oci_error($s);
|
||||
echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
|
||||
return;
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
|
||||
foreach ($row as $item) {
|
||||
echo " :" . $item . ":\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test 1.1: Type: default. Length: default
|
||||
Querying:
|
||||
:1:
|
||||
:2008-04-20:
|
||||
Test 1.2: Type: AFC. Length: default
|
||||
Querying:
|
||||
:1:
|
||||
:2008-04-20:
|
||||
Test 1.3: Type: AFC: Length: 0
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 1.4: Type: AFC: Length: strlen
|
||||
Querying:
|
||||
:1:
|
||||
:2008-04-20:
|
||||
Test 1.5: Type: AFC. Length: strlen-1
|
||||
Querying:
|
||||
Oci_execute error ORA-1460 Exiting Query
|
||||
Test 1.6: Type: AFC. Length: strlen+1
|
||||
Querying:
|
||||
:1:
|
||||
:2008-04-20:
|
||||
Done
|
||||
@@ -1,344 +0,0 @@
|
||||
--TEST--
|
||||
PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n";
|
||||
|
||||
$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "\n\nTests with ''\n\n";
|
||||
|
||||
echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "\n\nTests with NULL\n";
|
||||
|
||||
echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
function do_e($s)
|
||||
{
|
||||
echo " Executing:\n";
|
||||
|
||||
$r = @oci_execute($s);
|
||||
if (!$r) {
|
||||
$m = oci_error($s);
|
||||
echo " Oci_execute error ORA-".$m['code']."\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
//require(dirname(__FILE__).'/drop_table.inc');
|
||||
|
||||
$stmtarray = array(
|
||||
"drop function bind_char_3_fn"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
string(3) "abc"
|
||||
NULL
|
||||
Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(10) "abc "
|
||||
Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(4) "abc "
|
||||
|
||||
|
||||
Tests with ''
|
||||
|
||||
Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
|
||||
|
||||
Tests with NULL
|
||||
Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Done
|
||||
@@ -1,346 +0,0 @@
|
||||
--TEST--
|
||||
PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n";
|
||||
|
||||
$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = 'abc';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "\n\nTests with ''\n\n";
|
||||
|
||||
echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = '';
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "\n\nTests with NULL\n";
|
||||
|
||||
echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
|
||||
echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
|
||||
|
||||
$bv1 = null;
|
||||
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
|
||||
if ($r)
|
||||
do_e($s);
|
||||
var_dump($bv1, $bv2);
|
||||
|
||||
|
||||
function do_e($s)
|
||||
{
|
||||
echo " Executing:\n";
|
||||
|
||||
$r = @oci_execute($s);
|
||||
if (!$r) {
|
||||
$m = oci_error($s);
|
||||
echo " Oci_execute error ORA-".$m['code']."\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
//require(dirname(__FILE__).'/drop_table.inc');
|
||||
|
||||
$stmtarray = array(
|
||||
"drop function bind_char_3_fn"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
string(3) "abc"
|
||||
NULL
|
||||
Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(10) "abc "
|
||||
Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
string(3) "abc"
|
||||
string(3) "abc"
|
||||
Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC
|
||||
Executing:
|
||||
string(3) "abc"
|
||||
string(4) "abc "
|
||||
|
||||
|
||||
Tests with ''
|
||||
|
||||
Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC
|
||||
Executing:
|
||||
string(0) ""
|
||||
NULL
|
||||
|
||||
|
||||
Tests with NULL
|
||||
Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC
|
||||
Executing:
|
||||
NULL
|
||||
NULL
|
||||
Done
|
||||
@@ -1,104 +0,0 @@
|
||||
--TEST--
|
||||
binding empty values
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(10))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
$name = null;
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
|
||||
oci_bind_by_name($stmt, ":name", $name);
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
echo "Test 2\n";
|
||||
|
||||
$name = "";
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
|
||||
oci_bind_by_name($stmt, ":name", $name);
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
echo "Test 3\n";
|
||||
|
||||
$stmt = oci_parse($c, "INSERT INTO bind_test (NAME) VALUES ('abc')");
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse($c, "INSERT INTO bind_test (NAME) VALUES ('def')");
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$name = null;
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name WHERE NAME = 'abc'");
|
||||
oci_bind_by_name($stmt, ":name", $name);
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
$stid = oci_parse($c, "select * from bind_test order by 1");
|
||||
oci_execute($stid);
|
||||
oci_fetch_all($stid, $res);
|
||||
var_dump($res);
|
||||
|
||||
echo "Test 4\n";
|
||||
|
||||
$name = "";
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name WHERE NAME = 'def'");
|
||||
oci_bind_by_name($stmt, ":name", $name);
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
$stid = oci_parse($c, "select * from bind_test order by 1");
|
||||
oci_execute($stid);
|
||||
oci_fetch_all($stid, $res);
|
||||
var_dump($res);
|
||||
|
||||
|
||||
// Clean up
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
bool(true)
|
||||
Test 2
|
||||
bool(true)
|
||||
Test 3
|
||||
bool(true)
|
||||
array(1) {
|
||||
["NAME"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "def"
|
||||
[1]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
Test 4
|
||||
bool(true)
|
||||
array(1) {
|
||||
["NAME"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
bind LONG field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
|
||||
$i=1;
|
||||
$filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestlng");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "da852396d08c9ef9fbdf914db1d6d5bb"
|
||||
int(276)
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
bind LONG RAW field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
|
||||
$i=1;
|
||||
$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestlngraw");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
|
||||
int(2523)
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
bind RAW field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
|
||||
$i=1;
|
||||
$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
|
||||
$fileimage = substr($fileimage, 0, 300);
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestrawtable");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "88b274d7a257ac6f70435b83abd4e26e"
|
||||
int(300)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26133 (ocifreedesc() segfault)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
if ($c) {
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (id, value)
|
||||
VALUES ('1','1')
|
||||
RETURNING
|
||||
ROWID
|
||||
INTO :v_rowid ";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
$rowid = OCINewDescriptor($c,OCI_D_ROWID);
|
||||
OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
|
||||
if (OCIExecute($statement)) {
|
||||
OCICommit($c);
|
||||
}
|
||||
OCIFreeStatement($statement);
|
||||
$rowid->free();
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,260 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
@oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
//$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
Done
|
||||
@@ -1,260 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(2) "10"
|
||||
string(2) "11"
|
||||
string(2) "12"
|
||||
string(2) "13"
|
||||
string(2) "14"
|
||||
string(2) "15"
|
||||
string(2) "16"
|
||||
string(2) "17"
|
||||
string(2) "18"
|
||||
string(2) "19"
|
||||
string(2) "20"
|
||||
string(2) "21"
|
||||
string(2) "22"
|
||||
string(2) "23"
|
||||
string(2) "24"
|
||||
string(2) "25"
|
||||
string(2) "26"
|
||||
string(2) "27"
|
||||
string(2) "28"
|
||||
string(2) "29"
|
||||
string(2) "30"
|
||||
string(2) "31"
|
||||
string(2) "32"
|
||||
string(2) "33"
|
||||
string(2) "34"
|
||||
string(2) "35"
|
||||
string(2) "36"
|
||||
string(2) "37"
|
||||
string(2) "38"
|
||||
string(2) "39"
|
||||
string(2) "40"
|
||||
string(2) "41"
|
||||
string(2) "42"
|
||||
string(2) "43"
|
||||
string(2) "44"
|
||||
string(2) "45"
|
||||
string(2) "46"
|
||||
string(2) "47"
|
||||
string(2) "48"
|
||||
string(2) "49"
|
||||
string(2) "50"
|
||||
string(2) "51"
|
||||
string(2) "52"
|
||||
string(2) "53"
|
||||
string(2) "54"
|
||||
string(2) "55"
|
||||
string(2) "56"
|
||||
string(2) "57"
|
||||
string(2) "58"
|
||||
string(2) "59"
|
||||
string(2) "60"
|
||||
string(2) "61"
|
||||
string(2) "62"
|
||||
string(2) "63"
|
||||
string(2) "64"
|
||||
string(2) "65"
|
||||
string(2) "66"
|
||||
string(2) "67"
|
||||
string(2) "68"
|
||||
string(2) "69"
|
||||
string(2) "70"
|
||||
string(2) "71"
|
||||
string(2) "72"
|
||||
string(2) "73"
|
||||
string(2) "74"
|
||||
string(2) "75"
|
||||
string(2) "76"
|
||||
string(2) "77"
|
||||
string(2) "78"
|
||||
string(2) "79"
|
||||
string(2) "80"
|
||||
string(2) "81"
|
||||
string(2) "82"
|
||||
string(2) "83"
|
||||
string(2) "84"
|
||||
string(2) "85"
|
||||
string(2) "86"
|
||||
string(2) "87"
|
||||
string(2) "88"
|
||||
string(2) "89"
|
||||
string(2) "90"
|
||||
string(2) "91"
|
||||
string(2) "92"
|
||||
string(2) "93"
|
||||
string(2) "94"
|
||||
string(2) "95"
|
||||
string(2) "96"
|
||||
string(2) "97"
|
||||
string(2) "98"
|
||||
string(2) "99"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "10"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "11"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "12"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "13"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "14"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "15"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "16"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "17"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "18"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
string(2) "19"
|
||||
Done
|
||||
@@ -1,252 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
@oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
int(5)
|
||||
int(6)
|
||||
int(7)
|
||||
int(8)
|
||||
int(9)
|
||||
int(10)
|
||||
int(11)
|
||||
int(12)
|
||||
int(13)
|
||||
int(14)
|
||||
int(15)
|
||||
int(16)
|
||||
int(17)
|
||||
int(18)
|
||||
int(19)
|
||||
int(20)
|
||||
int(21)
|
||||
int(22)
|
||||
int(23)
|
||||
int(24)
|
||||
int(25)
|
||||
int(26)
|
||||
int(27)
|
||||
int(28)
|
||||
int(29)
|
||||
int(30)
|
||||
int(31)
|
||||
int(32)
|
||||
int(33)
|
||||
int(34)
|
||||
int(35)
|
||||
int(36)
|
||||
int(37)
|
||||
int(38)
|
||||
int(39)
|
||||
int(40)
|
||||
int(41)
|
||||
int(42)
|
||||
int(43)
|
||||
int(44)
|
||||
int(45)
|
||||
int(46)
|
||||
int(47)
|
||||
int(48)
|
||||
int(49)
|
||||
int(50)
|
||||
int(51)
|
||||
int(52)
|
||||
int(53)
|
||||
int(54)
|
||||
int(55)
|
||||
int(56)
|
||||
int(57)
|
||||
int(58)
|
||||
int(59)
|
||||
int(60)
|
||||
int(61)
|
||||
int(62)
|
||||
int(63)
|
||||
int(64)
|
||||
int(65)
|
||||
int(66)
|
||||
int(67)
|
||||
int(68)
|
||||
int(69)
|
||||
int(70)
|
||||
int(71)
|
||||
int(72)
|
||||
int(73)
|
||||
int(74)
|
||||
int(75)
|
||||
int(76)
|
||||
int(77)
|
||||
int(78)
|
||||
int(79)
|
||||
int(80)
|
||||
int(81)
|
||||
int(82)
|
||||
int(83)
|
||||
int(84)
|
||||
int(85)
|
||||
int(86)
|
||||
int(87)
|
||||
int(88)
|
||||
int(89)
|
||||
int(90)
|
||||
int(91)
|
||||
int(92)
|
||||
int(93)
|
||||
int(94)
|
||||
int(95)
|
||||
int(96)
|
||||
int(97)
|
||||
int(98)
|
||||
int(99)
|
||||
int(100)
|
||||
int(101)
|
||||
int(102)
|
||||
int(103)
|
||||
int(104)
|
||||
int(105)
|
||||
int(106)
|
||||
int(107)
|
||||
int(108)
|
||||
int(109)
|
||||
int(110)
|
||||
int(111)
|
||||
int(112)
|
||||
int(113)
|
||||
int(114)
|
||||
int(115)
|
||||
int(116)
|
||||
int(117)
|
||||
int(118)
|
||||
int(119)
|
||||
int(120)
|
||||
int(121)
|
||||
int(122)
|
||||
int(123)
|
||||
int(124)
|
||||
int(125)
|
||||
int(126)
|
||||
int(127)
|
||||
int(128)
|
||||
int(129)
|
||||
int(130)
|
||||
int(131)
|
||||
int(132)
|
||||
int(133)
|
||||
int(134)
|
||||
int(135)
|
||||
int(136)
|
||||
int(137)
|
||||
int(138)
|
||||
int(139)
|
||||
int(140)
|
||||
int(141)
|
||||
int(142)
|
||||
int(143)
|
||||
int(144)
|
||||
int(145)
|
||||
int(146)
|
||||
int(147)
|
||||
int(148)
|
||||
int(149)
|
||||
int(150)
|
||||
int(151)
|
||||
int(152)
|
||||
int(153)
|
||||
int(154)
|
||||
int(155)
|
||||
int(156)
|
||||
int(157)
|
||||
int(158)
|
||||
int(159)
|
||||
int(160)
|
||||
int(161)
|
||||
int(162)
|
||||
int(163)
|
||||
int(164)
|
||||
int(165)
|
||||
int(166)
|
||||
int(167)
|
||||
int(168)
|
||||
int(169)
|
||||
int(170)
|
||||
int(171)
|
||||
int(172)
|
||||
int(173)
|
||||
int(174)
|
||||
int(175)
|
||||
int(176)
|
||||
int(177)
|
||||
int(178)
|
||||
int(179)
|
||||
int(180)
|
||||
int(181)
|
||||
int(182)
|
||||
int(183)
|
||||
int(184)
|
||||
int(185)
|
||||
int(186)
|
||||
int(187)
|
||||
int(188)
|
||||
int(189)
|
||||
int(190)
|
||||
int(191)
|
||||
int(192)
|
||||
int(193)
|
||||
int(194)
|
||||
int(195)
|
||||
int(196)
|
||||
int(197)
|
||||
int(198)
|
||||
int(199)
|
||||
Done
|
||||
@@ -1,260 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/connect.inc");
|
||||
$sv = oci_server_version($c);
|
||||
$sv = preg_match('/11.1/', $sv, $matches);
|
||||
if ($sv !== 1) {
|
||||
die ("skip expected output only valid when using Oracle 11g database");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
//$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "9"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #32325 (Can't retrieve collection using OCI8)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$create_stmt = oci_parse($c, "create or replace type ut_num_list_t as table of number");
|
||||
oci_execute($create_stmt);
|
||||
|
||||
$collection = oci_new_collection($c, "UT_NUM_LIST_T");
|
||||
|
||||
$sql = "
|
||||
begin
|
||||
select ut_num_list_t(1,2,3,4) into :list from dual;
|
||||
end;";
|
||||
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
oci_bind_by_name($stmt, ":list", $collection, -1, OCI_B_NTY);
|
||||
oci_execute($stmt);
|
||||
|
||||
var_dump($collection->size());
|
||||
var_dump($collection->getelem(1));
|
||||
var_dump($collection->getelem(2));
|
||||
|
||||
$drop_stmt = oci_parse($c, "drop type ut_num_list_t");
|
||||
oci_execute($drop_stmt);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4)
|
||||
float(2)
|
||||
float(3)
|
||||
Done
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$s1 = oci_parse($c, "drop table test_nclob");
|
||||
@oci_execute($s1);
|
||||
|
||||
$s2 = oci_parse($c, "create table test_nclob (nc NCLOB)");
|
||||
oci_execute($s2);
|
||||
|
||||
$s3 = oci_parse($c, "insert into test_nclob (nc) values ('12345data')");
|
||||
oci_execute($s3);
|
||||
|
||||
$s3 = oci_parse($c, "select * from test_nclob");
|
||||
oci_execute($s3);
|
||||
|
||||
var_dump($data = oci_fetch_assoc($s3));
|
||||
$d = $data['NC'];
|
||||
|
||||
var_dump($d->read(5));
|
||||
var_dump($d->read(4));
|
||||
|
||||
$s1 = oci_parse($c, "drop table test_nclob");
|
||||
@oci_execute($s1);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["NC"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
string(%d) "%s5"
|
||||
string(%d) "%sa"
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #36010 (Crash when executing SQL statment with lob parameter twice)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function f($conn)
|
||||
{
|
||||
$sql = "begin :p_clob := 'lob string'; end;";
|
||||
$stid = oci_parse($conn, $sql);
|
||||
$clob = oci_new_descriptor($conn, OCI_D_LOB);
|
||||
oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB);
|
||||
$r = oci_execute($stid, OCI_DEFAULT);
|
||||
}
|
||||
|
||||
f($c);
|
||||
f($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #36096 (oci_result() returns garbage after oci_fetch() failed)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
|
||||
var_dump(oci_fetch($stmt));
|
||||
var_dump(oci_result($stmt, 1));
|
||||
var_dump(oci_field_name($stmt, 1));
|
||||
var_dump(oci_field_type($stmt, 1));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(5) "'ABC'"
|
||||
string(4) "CHAR"
|
||||
Done
|
||||
@@ -1,68 +0,0 @@
|
||||
--TEST--
|
||||
Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create table bug37220_tab( mycolumn xmltype not null)",
|
||||
"insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Now let's update the row where myId = 1234 and change the tag
|
||||
// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
|
||||
// bug37220_tab a normal Oracle table)
|
||||
|
||||
$query = "UPDATE bug37220_tab
|
||||
SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data))
|
||||
WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1";
|
||||
$stmt = oci_parse ($c, $query);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB);
|
||||
$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
|
||||
oci_free_statement($stmt);
|
||||
$clob->close();
|
||||
|
||||
// Query back the change
|
||||
|
||||
$query = "select * from bug37220_tab";
|
||||
$stmt = oci_parse ($c, $query);
|
||||
|
||||
oci_execute($stmt);
|
||||
|
||||
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
|
||||
foreach ($row as $item) {
|
||||
echo $item."\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop table bug37220_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
<MYTAG/>
|
||||
|
||||
Done
|
||||
@@ -1,69 +0,0 @@
|
||||
--TEST--
|
||||
Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$p1 = "create or replace package ARRAYBINDPKG1 as
|
||||
type str_array is table of char(2) index by binary_integer;
|
||||
procedure array_bind(in_str in str_array, out_str out string);
|
||||
end ARRAYBINDPKG1;";
|
||||
|
||||
$p2 = "create or replace package body ARRAYBINDPKG1 as
|
||||
procedure array_bind(in_str in str_array, out_str out string) is
|
||||
begin
|
||||
for i in 1 .. in_str.count loop
|
||||
out_str := in_str(i);
|
||||
end loop;
|
||||
end array_bind;
|
||||
end ARRAYBINDPKG1;";
|
||||
|
||||
$s1 = oci_parse($c, $p1);
|
||||
$s2 = oci_parse($c, $p2);
|
||||
oci_execute($s1);
|
||||
oci_execute($s2);
|
||||
|
||||
|
||||
$stmt = oci_parse($c,'begin ARRAYBINDPKG1.array_bind(:in_arr, :out_str); end;');
|
||||
$strings = array('A','B','C','D','E');
|
||||
|
||||
oci_bind_array_by_name($stmt,':in_arr',$strings,5,1,SQLT_AFC);
|
||||
oci_bind_by_name($stmt,':out_str',$result,10);
|
||||
|
||||
oci_execute($stmt);
|
||||
var_dump($strings);
|
||||
|
||||
oci_execute($stmt);
|
||||
var_dump($strings);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "A"
|
||||
[1]=>
|
||||
string(1) "B"
|
||||
[2]=>
|
||||
string(1) "C"
|
||||
[3]=>
|
||||
string(1) "D"
|
||||
[4]=>
|
||||
string(1) "E"
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "A"
|
||||
[1]=>
|
||||
string(1) "B"
|
||||
[2]=>
|
||||
string(1) "C"
|
||||
[3]=>
|
||||
string(1) "D"
|
||||
[4]=>
|
||||
string(1) "E"
|
||||
}
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$query = "begin if false then :bv := 1; end if; end;";
|
||||
$stid = oci_parse($c, $query);
|
||||
oci_bind_by_name($stid, ":bv", $bv, 22);
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
|
||||
var_dump($bv);
|
||||
unset($bv);
|
||||
|
||||
$query = "begin if false then :bv := 1; end if; end;";
|
||||
$stid = oci_parse($c, $query);
|
||||
oci_bind_by_name($stid, ":bv", $bv, 22, SQLT_INT);
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
|
||||
var_dump($bv);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
int(0)
|
||||
Done
|
||||
@@ -1,79 +0,0 @@
|
||||
--TEST--
|
||||
Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$create_1 = "CREATE TABLE t1 (id INTEGER)";
|
||||
$create_2 = "CREATE TABLE t2 (id INTEGER)";
|
||||
$drop_1 = "DROP TABLE t1";
|
||||
$drop_2 = "DROP TABLE t2";
|
||||
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
$s1 = oci_parse($c, $create_1);
|
||||
$s2 = oci_parse($c, $create_2);
|
||||
oci_execute($s1);
|
||||
oci_execute($s2);
|
||||
|
||||
for($i=0; $i < 5; $i++) {
|
||||
$insert = "INSERT INTO t1 VALUES(".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
for($i=0; $i < 5; $i++) {
|
||||
$insert = "INSERT INTO t2 VALUES(".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
$query ="
|
||||
SELECT
|
||||
t1.*,
|
||||
CURSOR( SELECT * FROM t2 ) as cursor
|
||||
FROM
|
||||
t1
|
||||
";
|
||||
|
||||
$sth = oci_parse($c, $query);
|
||||
oci_execute($sth);
|
||||
|
||||
// dies on oci_free_statement on 2nd pass through loop
|
||||
while ( $row = oci_fetch_assoc($sth) ) {
|
||||
print "Got row!\n";
|
||||
var_dump(oci_execute($row['CURSOR']));
|
||||
var_dump(oci_free_statement($row['CURSOR']));
|
||||
}
|
||||
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,55 +0,0 @@
|
||||
--TEST--
|
||||
Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE nullbind(c1 OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
PROCEDURE nullbind(c1 OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
c1(1) := 'one';
|
||||
c1(2) := 'two';
|
||||
c1(3) := '';
|
||||
c1(4) := 'four';
|
||||
c1(5) := 'five';
|
||||
END nullbind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(3) "one"
|
||||
[1]=>
|
||||
string(3) "two"
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(4) "four"
|
||||
[4]=>
|
||||
string(4) "five"
|
||||
}
|
||||
Done
|
||||
@@ -1,200 +0,0 @@
|
||||
--TEST--
|
||||
Bug #40415 (Using oci_fetchall with nested cursors)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
// Setup
|
||||
|
||||
$create_1 = "CREATE TABLE t1 (id1 INTEGER)";
|
||||
$create_2 = "CREATE TABLE t2 (id2 INTEGER)";
|
||||
$drop_1 = "DROP TABLE t1";
|
||||
$drop_2 = "DROP TABLE t2";
|
||||
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
$s1 = oci_parse($c, $create_1);
|
||||
$s2 = oci_parse($c, $create_2);
|
||||
oci_execute($s1);
|
||||
oci_execute($s2);
|
||||
|
||||
for($i=1; $i < 4; $i++) {
|
||||
$insert = "INSERT INTO t1 VALUES(1".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
for($i=1; $i < 4; $i++) {
|
||||
$insert = "INSERT INTO t2 VALUES(2".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
|
||||
function do_assoc($c)
|
||||
{
|
||||
$query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
oci_execute($stmt);
|
||||
|
||||
while ($row = oci_fetch_assoc($stmt)) {
|
||||
print "Got row \"".$row['ID1']."\". Now getting nested cursor:\n";
|
||||
var_dump(oci_execute($row['CURSOR']));
|
||||
while ($row_n = oci_fetch_assoc($row['CURSOR']) ) {
|
||||
var_dump($row_n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function do_all($c)
|
||||
{
|
||||
$query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
oci_execute($stmt);
|
||||
|
||||
$rc1 = oci_fetch_all($stmt, $res);
|
||||
|
||||
echo "Rows returned $rc1\n";
|
||||
|
||||
var_dump($res);
|
||||
|
||||
foreach ($res['CURSOR'] as $cv) {
|
||||
echo "Getting nested cursor\n";
|
||||
var_dump(oci_execute($cv));
|
||||
$rc2 = oci_fetch_all($cv, $res2);
|
||||
var_dump($res2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "Test 1: Associate fetch of nested cursor\n";
|
||||
do_assoc($c);
|
||||
|
||||
echo "\nTest 2: fetchall of nested cursor\n";
|
||||
do_all($c);
|
||||
|
||||
|
||||
// Cleanup
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1: Associate fetch of nested cursor
|
||||
Got row "11". Now getting nested cursor:
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "21"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "22"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "23"
|
||||
}
|
||||
Got row "12". Now getting nested cursor:
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "21"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "22"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "23"
|
||||
}
|
||||
Got row "13". Now getting nested cursor:
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "21"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "22"
|
||||
}
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
string(2) "23"
|
||||
}
|
||||
|
||||
Test 2: fetchall of nested cursor
|
||||
Rows returned 3
|
||||
array(2) {
|
||||
["ID1"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "11"
|
||||
[1]=>
|
||||
string(2) "12"
|
||||
[2]=>
|
||||
string(2) "13"
|
||||
}
|
||||
["CURSOR"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
resource(%d) of type (oci8 statement)
|
||||
[1]=>
|
||||
resource(%d) of type (oci8 statement)
|
||||
[2]=>
|
||||
resource(%d) of type (oci8 statement)
|
||||
}
|
||||
}
|
||||
Getting nested cursor
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "21"
|
||||
[1]=>
|
||||
string(2) "22"
|
||||
[2]=>
|
||||
string(2) "23"
|
||||
}
|
||||
}
|
||||
Getting nested cursor
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "21"
|
||||
[1]=>
|
||||
string(2) "22"
|
||||
[2]=>
|
||||
string(2) "23"
|
||||
}
|
||||
}
|
||||
Getting nested cursor
|
||||
bool(true)
|
||||
array(1) {
|
||||
["ID2"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "21"
|
||||
[1]=>
|
||||
string(2) "22"
|
||||
[2]=>
|
||||
string(2) "23"
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,275 +0,0 @@
|
||||
--TEST--
|
||||
Bug #41069 (Oracle crash with certain data over a DB-link when prefetch memory limit used - Oracle bug 6039623)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__).'/details.inc');
|
||||
if (empty($dbase)) die ("skip requires network connection alias for DB link loopback");
|
||||
if ($test_drcp) die("skip DRCP does not support shared database links");
|
||||
?>
|
||||
--INI--
|
||||
oci8.default_prefetch=5
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"alter session set nls_date_format = 'MM/DD/YYYY'",
|
||||
|
||||
"drop database link bug41069_dblink",
|
||||
|
||||
"drop table bug41069_tab",
|
||||
|
||||
"create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'",
|
||||
|
||||
"create table bug41069_tab
|
||||
(
|
||||
c1 number(20),
|
||||
c2 varchar2(60 byte),
|
||||
c3 varchar2(1000 byte),
|
||||
c4 varchar2(255 byte),
|
||||
c5 varchar2(2 byte),
|
||||
c6 varchar2(1 byte),
|
||||
c7 varchar2(255 byte),
|
||||
c8 varchar2(50 byte),
|
||||
c9 date,
|
||||
c10 date,
|
||||
c12 number(20),
|
||||
c13 varchar2(20 byte),
|
||||
c15 varchar2(50 byte)
|
||||
)",
|
||||
|
||||
"insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values
|
||||
(111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')",
|
||||
|
||||
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values
|
||||
(112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')",
|
||||
|
||||
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
|
||||
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
|
||||
// Run Tests
|
||||
|
||||
echo "Test 1: non-DB link case that always worked\n";
|
||||
$stid = oci_parse($c, 'select * from bug41069_tab order by c1');
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
oci_fetch_all($stid, $results, 0, -1, OCI_ASSOC+OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($results);
|
||||
|
||||
echo "Test 2: Should not crash\n";
|
||||
$stid = oci_parse($c, 'select * from bug41069_tab@bug41069_dblink order by c1');
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
oci_fetch_all($stid, $results, 0, -1, OCI_ASSOC+OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($results);
|
||||
|
||||
// Cleanup
|
||||
|
||||
$c = oci_new_connect($user, $password, $dbase);
|
||||
|
||||
$stmtarray = array(
|
||||
"drop database link bug41069_dblink",
|
||||
"drop table bug41069_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test 1: non-DB link case that always worked
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "111"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
NULL
|
||||
["C4"]=>
|
||||
NULL
|
||||
["C5"]=>
|
||||
string(1) "b"
|
||||
["C6"]=>
|
||||
string(1) "c"
|
||||
["C7"]=>
|
||||
NULL
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "01/17/2008"
|
||||
["C10"]=>
|
||||
string(10) "01/07/2017"
|
||||
["C12"]=>
|
||||
string(4) "2222"
|
||||
["C13"]=>
|
||||
NULL
|
||||
["C15"]=>
|
||||
string(10) "zzzzzzzzzz"
|
||||
}
|
||||
[1]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "112"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
string(8) "bbbbbbbb"
|
||||
["C4"]=>
|
||||
string(7) "ccccccc"
|
||||
["C5"]=>
|
||||
string(1) "d"
|
||||
["C6"]=>
|
||||
string(1) "e"
|
||||
["C7"]=>
|
||||
string(7) "rrrrrrr"
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "04/16/2007"
|
||||
["C10"]=>
|
||||
string(10) "04/16/2007"
|
||||
["C12"]=>
|
||||
string(4) "2223"
|
||||
["C13"]=>
|
||||
string(8) "xxxxxxxx"
|
||||
["C15"]=>
|
||||
string(8) "zzzzzzzz"
|
||||
}
|
||||
[2]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "113"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
string(10) "bbbbbbbbbb"
|
||||
["C4"]=>
|
||||
string(6) "cccccc"
|
||||
["C5"]=>
|
||||
string(1) "e"
|
||||
["C6"]=>
|
||||
string(1) "f"
|
||||
["C7"]=>
|
||||
string(4) "dddd"
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "12/04/2006"
|
||||
["C10"]=>
|
||||
string(10) "12/04/2006"
|
||||
["C12"]=>
|
||||
string(4) "2224"
|
||||
["C13"]=>
|
||||
NULL
|
||||
["C15"]=>
|
||||
string(7) "zzzzzzz"
|
||||
}
|
||||
}
|
||||
Test 2: Should not crash
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "111"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
NULL
|
||||
["C4"]=>
|
||||
NULL
|
||||
["C5"]=>
|
||||
string(1) "b"
|
||||
["C6"]=>
|
||||
string(1) "c"
|
||||
["C7"]=>
|
||||
NULL
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "01/17/2008"
|
||||
["C10"]=>
|
||||
string(10) "01/07/2017"
|
||||
["C12"]=>
|
||||
string(4) "2222"
|
||||
["C13"]=>
|
||||
NULL
|
||||
["C15"]=>
|
||||
string(10) "zzzzzzzzzz"
|
||||
}
|
||||
[1]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "112"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
string(8) "bbbbbbbb"
|
||||
["C4"]=>
|
||||
string(7) "ccccccc"
|
||||
["C5"]=>
|
||||
string(1) "d"
|
||||
["C6"]=>
|
||||
string(1) "e"
|
||||
["C7"]=>
|
||||
string(7) "rrrrrrr"
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "04/16/2007"
|
||||
["C10"]=>
|
||||
string(10) "04/16/2007"
|
||||
["C12"]=>
|
||||
string(4) "2223"
|
||||
["C13"]=>
|
||||
string(8) "xxxxxxxx"
|
||||
["C15"]=>
|
||||
string(8) "zzzzzzzz"
|
||||
}
|
||||
[2]=>
|
||||
array(13) {
|
||||
["C1"]=>
|
||||
string(3) "113"
|
||||
["C2"]=>
|
||||
string(7) "aaaaaaa"
|
||||
["C3"]=>
|
||||
string(10) "bbbbbbbbbb"
|
||||
["C4"]=>
|
||||
string(6) "cccccc"
|
||||
["C5"]=>
|
||||
string(1) "e"
|
||||
["C6"]=>
|
||||
string(1) "f"
|
||||
["C7"]=>
|
||||
string(4) "dddd"
|
||||
["C8"]=>
|
||||
NULL
|
||||
["C9"]=>
|
||||
string(10) "12/04/2006"
|
||||
["C10"]=>
|
||||
string(10) "12/04/2006"
|
||||
["C12"]=>
|
||||
string(4) "2224"
|
||||
["C13"]=>
|
||||
NULL
|
||||
["C15"]=>
|
||||
string(7) "zzzzzzz"
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,100 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42134 (Collection error for invalid collection name)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/details.inc');
|
||||
|
||||
// Test collection creation error for normal connection
|
||||
|
||||
if (!empty($dbase)) {
|
||||
$c = oci_connect($user,$password,$dbase);
|
||||
}
|
||||
else {
|
||||
$c = oci_connect($user,$password);
|
||||
}
|
||||
|
||||
$collection = oci_new_collection($c, "ABC");
|
||||
if (!$collection) {
|
||||
echo "Normal connection: New Collection error\n";
|
||||
$m = oci_error($c);
|
||||
var_dump($m);
|
||||
}
|
||||
|
||||
// Test collection creation error for new connection
|
||||
|
||||
if (!empty($dbase)) {
|
||||
$c = oci_new_connect($user,$password,$dbase);
|
||||
}
|
||||
else {
|
||||
$c = oci_new_connect($user,$password);
|
||||
}
|
||||
|
||||
$collection = oci_new_collection($c, "DEF");
|
||||
if (!$collection) {
|
||||
echo "New connection: New Collection error\n";
|
||||
$m = oci_error($c);
|
||||
var_dump($m);
|
||||
}
|
||||
|
||||
// Test collection creation error for persistent connection
|
||||
|
||||
if (!empty($dbase)) {
|
||||
$c = oci_pconnect($user,$password,$dbase);
|
||||
}
|
||||
else {
|
||||
$c = oci_pconnect($user,$password);
|
||||
}
|
||||
|
||||
$collection = oci_new_collection($c, "GHI");
|
||||
if (!$collection) {
|
||||
echo "Persistent connection: New Collection error\n";
|
||||
$m = oci_error($c);
|
||||
var_dump($m);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_new_collection(): OCI-22303: type ""."ABC" not found in %s on line %d
|
||||
Normal connection: New Collection error
|
||||
array(4) {
|
||||
["code"]=>
|
||||
int(22303)
|
||||
["message"]=>
|
||||
string(34) "OCI-22303: type ""."ABC" not found"
|
||||
["offset"]=>
|
||||
int(0)
|
||||
["sqltext"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
Warning: oci_new_collection(): OCI-22303: type ""."DEF" not found in %s on line %d
|
||||
New connection: New Collection error
|
||||
array(4) {
|
||||
["code"]=>
|
||||
int(22303)
|
||||
["message"]=>
|
||||
string(34) "OCI-22303: type ""."DEF" not found"
|
||||
["offset"]=>
|
||||
int(0)
|
||||
["sqltext"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
Warning: oci_new_collection(): OCI-22303: type ""."GHI" not found in %s on line %d
|
||||
Persistent connection: New Collection error
|
||||
array(4) {
|
||||
["code"]=>
|
||||
int(22303)
|
||||
["message"]=>
|
||||
string(34) "OCI-22303: type ""."GHI" not found"
|
||||
["offset"]=>
|
||||
int(0)
|
||||
["sqltext"]=>
|
||||
string(0) ""
|
||||
}
|
||||
Done
|
||||
@@ -1,168 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
$stmts = array(
|
||||
|
||||
"drop table ts_test",
|
||||
|
||||
"create table ts_test (
|
||||
c1 TIMESTAMP,
|
||||
c2 TIMESTAMP (5),
|
||||
c3 TIMESTAMP WITH TIME ZONE,
|
||||
c4 TIMESTAMP (2) WITH TIME ZONE,
|
||||
c5 TIMESTAMP WITH LOCAL TIME ZONE,
|
||||
c6 INTERVAL YEAR TO MONTH,
|
||||
c7 INTERVAL YEAR(2) TO MONTH,
|
||||
c8 INTERVAL DAY TO SECOND,
|
||||
c9 INTERVAL DAY(2) TO SECOND(3)
|
||||
)",
|
||||
|
||||
"insert into ts_test values (
|
||||
timestamp'1999-01-03 10:00:00.123',
|
||||
timestamp'1999-01-04 10:00:00.123456',
|
||||
timestamp'1999-01-05 10:00:00.123456+1:0',
|
||||
timestamp'1999-01-06 10:00:00.123456-1:0',
|
||||
timestamp'1999-01-06 10:00:00.123456-1:0',
|
||||
interval'1-2' year to month,
|
||||
interval'10-4' year to month,
|
||||
interval'1 2:20:20.123' day to second,
|
||||
interval'1 2:20:20.12345' day to second)");
|
||||
|
||||
foreach ($stmts as $sql) {
|
||||
$s = oci_parse($c, $sql);
|
||||
$r = @oci_execute($s);
|
||||
}
|
||||
|
||||
$s = oci_parse($c, "select * from ts_test");
|
||||
$r = oci_execute($s);
|
||||
$row = oci_fetch_array($s, OCI_ASSOC);
|
||||
var_dump($row);
|
||||
|
||||
foreach ($row as $name => $field) {
|
||||
echo "\nColumn $name\n";
|
||||
var_dump(oci_field_is_null($s, $name));
|
||||
var_dump(oci_field_name($s, $name));
|
||||
var_dump(oci_field_type($s, $name));
|
||||
var_dump(oci_field_type_raw($s, $name));
|
||||
var_dump(oci_field_scale($s, $name));
|
||||
var_dump(oci_field_precision($s, $name));
|
||||
var_dump(oci_field_size($s, $name));
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
$s = oci_parse($c, "drop table ts_test");
|
||||
$r = @oci_execute($s);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(9) {
|
||||
["C1"]=>
|
||||
string(28) "03-JAN-99 10.00.00.123000 AM"
|
||||
["C2"]=>
|
||||
string(27) "04-JAN-99 10.00.00.12346 AM"
|
||||
["C3"]=>
|
||||
string(35) "05-JAN-99 10.00.00.123456 AM +01:00"
|
||||
["C4"]=>
|
||||
string(31) "06-JAN-99 10.00.00.12 AM -01:00"
|
||||
["C5"]=>
|
||||
string(28) "%s"
|
||||
["C6"]=>
|
||||
string(6) "+01-02"
|
||||
["C7"]=>
|
||||
string(6) "+10-04"
|
||||
["C8"]=>
|
||||
string(19) "+01 02:20:20.123000"
|
||||
["C9"]=>
|
||||
string(16) "+01 02:20:20.123"
|
||||
}
|
||||
|
||||
Column C1
|
||||
bool(false)
|
||||
string(2) "C1"
|
||||
string(9) "TIMESTAMP"
|
||||
int(187)
|
||||
int(6)
|
||||
int(0)
|
||||
int(11)
|
||||
|
||||
Column C2
|
||||
bool(false)
|
||||
string(2) "C2"
|
||||
string(9) "TIMESTAMP"
|
||||
int(187)
|
||||
int(5)
|
||||
int(0)
|
||||
int(11)
|
||||
|
||||
Column C3
|
||||
bool(false)
|
||||
string(2) "C3"
|
||||
string(23) "TIMESTAMP WITH TIMEZONE"
|
||||
int(188)
|
||||
int(6)
|
||||
int(0)
|
||||
int(13)
|
||||
|
||||
Column C4
|
||||
bool(false)
|
||||
string(2) "C4"
|
||||
string(23) "TIMESTAMP WITH TIMEZONE"
|
||||
int(188)
|
||||
int(2)
|
||||
int(0)
|
||||
int(13)
|
||||
|
||||
Column C5
|
||||
bool(false)
|
||||
string(2) "C5"
|
||||
string(29) "TIMESTAMP WITH LOCAL TIMEZONE"
|
||||
int(232)
|
||||
int(6)
|
||||
int(0)
|
||||
int(11)
|
||||
|
||||
Column C6
|
||||
bool(false)
|
||||
string(2) "C6"
|
||||
string(22) "INTERVAL YEAR TO MONTH"
|
||||
int(189)
|
||||
int(0)
|
||||
int(2)
|
||||
int(5)
|
||||
|
||||
Column C7
|
||||
bool(false)
|
||||
string(2) "C7"
|
||||
string(22) "INTERVAL YEAR TO MONTH"
|
||||
int(189)
|
||||
int(0)
|
||||
int(2)
|
||||
int(5)
|
||||
|
||||
Column C8
|
||||
bool(false)
|
||||
string(2) "C8"
|
||||
string(22) "INTERVAL DAY TO SECOND"
|
||||
int(190)
|
||||
int(6)
|
||||
int(2)
|
||||
int(11)
|
||||
|
||||
Column C9
|
||||
bool(false)
|
||||
string(2) "C9"
|
||||
string(22) "INTERVAL DAY TO SECOND"
|
||||
int(190)
|
||||
int(3)
|
||||
int(2)
|
||||
int(11)
|
||||
Done
|
||||
@@ -1,61 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab",
|
||||
"CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
|
||||
"INSERT INTO bug42496_tab VALUES('test1', 'test1')",
|
||||
"INSERT INTO bug42496_tab VALUES('test2', 'test2')",
|
||||
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
for ($i = 0; $i < 15000; $i++) {
|
||||
$s = oci_parse($c, "SELECT * from bug42496_tab");
|
||||
oci_define_by_name($s, "C1", $col1);
|
||||
oci_define_by_name($s, "C2", $col2);
|
||||
if (oci_execute($s)) {
|
||||
$arr = array();
|
||||
while ($arr = oci_fetch_assoc($s)) {
|
||||
$arr['C1']->free();
|
||||
$arr['C2']->free();
|
||||
}
|
||||
}
|
||||
oci_free_statement($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
Done
|
||||
@@ -1,59 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab",
|
||||
"CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
|
||||
"INSERT INTO bug42496_tab VALUES('test1', 'test1')",
|
||||
"INSERT INTO bug42496_tab VALUES('test2', 'test2')",
|
||||
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 2\n";
|
||||
|
||||
for ($i = 0; $i < 15000; $i++) {
|
||||
$s = oci_parse($c, "SELECT * from bug42496_tab");
|
||||
if (oci_execute($s)) {
|
||||
$arr = array();
|
||||
while ($arr = oci_fetch_assoc($s)) {
|
||||
$arr['C1']->free();
|
||||
$arr['C2']->free();
|
||||
}
|
||||
}
|
||||
oci_free_statement($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 2
|
||||
Done
|
||||
@@ -1,187 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--INI--
|
||||
oci8.statement_cache_size=20
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/details.inc';
|
||||
|
||||
// note a oci_new_connect() occurs lower in the script
|
||||
$c = oci_connect($user, $password, $dbase);
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
|
||||
begin
|
||||
open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
|
||||
end bug42841_proc;",
|
||||
|
||||
"create or replace package bug43449_pkg is
|
||||
type cursortype is ref Cursor;
|
||||
function testcursor return cursortype;
|
||||
end bug43449_pkg;",
|
||||
|
||||
"create or replace package body bug43449_pkg is
|
||||
function testcursor return cursortype is
|
||||
retCursor cursorType;
|
||||
begin
|
||||
Open retCursor For 'select * from dual';
|
||||
return retCursor;
|
||||
end;
|
||||
end bug43449_pkg;"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Main code
|
||||
|
||||
function do_bug42841($c)
|
||||
{
|
||||
echo "First attempt\n";
|
||||
|
||||
$sql = "BEGIN bug42841_proc(:cursor); END;";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
$cursor = oci_new_cursor($c);
|
||||
oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
|
||||
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cursor);
|
||||
|
||||
while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
|
||||
$data1[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($stmt);
|
||||
oci_free_statement($cursor);
|
||||
var_dump($data1);
|
||||
|
||||
echo "Second attempt\n";
|
||||
|
||||
$sql = "BEGIN bug42841_proc(:cursor); END;";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
$cursor = oci_new_cursor($c);
|
||||
oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
|
||||
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cursor);
|
||||
|
||||
while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
|
||||
$data2[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($stmt);
|
||||
oci_free_statement($cursor);
|
||||
var_dump($data2);
|
||||
}
|
||||
|
||||
function do_bug43449($c)
|
||||
{
|
||||
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
var_dump(bug43449_getCur($c));
|
||||
}
|
||||
}
|
||||
|
||||
function bug43449_getCur($c)
|
||||
{
|
||||
$cur = oci_new_cursor($c);
|
||||
$stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
|
||||
oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cur, OCI_DEFAULT);
|
||||
|
||||
$ret = array();
|
||||
|
||||
while (ocifetchinto($cur, $row, OCI_ASSOC)) {
|
||||
$ret[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($cur);
|
||||
oci_free_statement($stmt);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
echo "Test bug 42841: Procedure with OUT cursor parameter\n";
|
||||
do_bug42841($c);
|
||||
|
||||
$c = oci_new_connect($user, $password, $dbase);
|
||||
|
||||
echo "Test bug 43449: Cursor as function result\n";
|
||||
do_bug43449($c);
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop procedure bug42841_proc",
|
||||
"drop package bug43449_pkg"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test bug 42841: Procedure with OUT cursor parameter
|
||||
First attempt
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "11"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "12"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "13"
|
||||
}
|
||||
}
|
||||
Second attempt
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "11"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "12"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "13"
|
||||
}
|
||||
}
|
||||
Test bug 43449: Cursor as function result
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,378 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43492 (Nested cursor leaks)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab",
|
||||
"CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
|
||||
"INSERT INTO bug43492_tab VALUES ('A')",
|
||||
"INSERT INTO bug43492_tab VALUES ('B')",
|
||||
"INSERT INTO bug43492_tab VALUES ('C')",
|
||||
"INSERT INTO bug43492_tab VALUES ('D')",
|
||||
"INSERT INTO bug43492_tab VALUES ('E')",
|
||||
"INSERT INTO bug43492_tab VALUES ('F')",
|
||||
"INSERT INTO bug43492_tab VALUES ('G')",
|
||||
"INSERT INTO bug43492_tab VALUES ('H')",
|
||||
"INSERT INTO bug43492_tab VALUES ('I')",
|
||||
"INSERT INTO bug43492_tab VALUES ('J')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
While fetching data from a ref cursor, the parent statement needs to
|
||||
be around. Also when the parent statement goes out of scope, it is
|
||||
not automatically released which causes a cursor leak.
|
||||
|
||||
If either or both of the lines marked (*) are removed, then the script
|
||||
will fail with the error "ORA-01000: maximum open cursors exceeded".
|
||||
|
||||
*/
|
||||
|
||||
function fetch($c, $i) {
|
||||
global $s; // (*) Allow parent statement to be available when child is used
|
||||
$s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
|
||||
ociexecute($s, OCI_DEFAULT);
|
||||
ocifetchinto($s, $result, OCI_ASSOC);
|
||||
ociexecute($result['C'], OCI_DEFAULT);
|
||||
return $result['C'];
|
||||
}
|
||||
|
||||
for($i = 0; $i < 300; $i++) {
|
||||
$cur = fetch($c, $i);
|
||||
for($j = 0; $j < 10; $j++) {
|
||||
ocifetchinto($cur, $row, OCI_NUM);
|
||||
echo "$row[0] ";
|
||||
}
|
||||
echo "\n";
|
||||
ocifreestatement($cur);
|
||||
ocifreestatement($s); // (*) Free the parent statement cleanly
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
Done
|
||||
@@ -1,369 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// This test is similar to bug43492.phpt without the explict free.
|
||||
// Now that bug 44206 is fixed an automatic clean up will occur -
|
||||
// though it is still recommended in practice.
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab",
|
||||
"CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
|
||||
"INSERT INTO bug43492_tab VALUES ('A')",
|
||||
"INSERT INTO bug43492_tab VALUES ('B')",
|
||||
"INSERT INTO bug43492_tab VALUES ('C')",
|
||||
"INSERT INTO bug43492_tab VALUES ('D')",
|
||||
"INSERT INTO bug43492_tab VALUES ('E')",
|
||||
"INSERT INTO bug43492_tab VALUES ('F')",
|
||||
"INSERT INTO bug43492_tab VALUES ('G')",
|
||||
"INSERT INTO bug43492_tab VALUES ('H')",
|
||||
"INSERT INTO bug43492_tab VALUES ('I')",
|
||||
"INSERT INTO bug43492_tab VALUES ('J')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
function fetch($c, $i) {
|
||||
$s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
|
||||
ociexecute($s, OCI_DEFAULT);
|
||||
ocifetchinto($s, $result, OCI_ASSOC);
|
||||
ociexecute($result['C'], OCI_DEFAULT);
|
||||
return $result['C'];
|
||||
}
|
||||
|
||||
for($i = 0; $i < 300; $i++) {
|
||||
$cur = fetch($c, $i);
|
||||
for($j = 0; $j < 10; $j++) {
|
||||
ocifetchinto($cur, $row, OCI_NUM);
|
||||
echo "$row[0] ";
|
||||
}
|
||||
echo "\n";
|
||||
ocifreestatement($cur);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
Done
|
||||
@@ -1,303 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_clean();
|
||||
$ov = preg_match('/Oracle Version => 9/', $phpinfo);
|
||||
if ($ov === 1) {
|
||||
die ("skip expected output only valid for Oracle clients from 10g onwards");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function sessionid($c) // determines and returns current session ID
|
||||
{
|
||||
$query = "select sid from v\$session where audsid = userenv('sessionid')";
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
return oci_result($stmt, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function templobs($c, $sid) // returns number of temporary LOBs
|
||||
{
|
||||
$query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
$val = oci_result($stmt, 1);
|
||||
oci_free_statement($stmt);
|
||||
return $val;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Read all XML data using explicit LOB locator
|
||||
function readxmltab_ex($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
$result[0]->free(); // cleanup properly
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using explicit LOB locator but without freeing the temp lobs
|
||||
function readxmltab_ex_nofree($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using implicit LOB locator
|
||||
function readxmltab_im($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
function createxmltab($c) // create table w/ field of XML type
|
||||
{
|
||||
@dropxmltab($c);
|
||||
$stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
function dropxmltab($c) // delete table
|
||||
{
|
||||
$stmt = oci_parse($c, "drop table bug43497_tab");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
|
||||
function fillxmltab($c)
|
||||
{
|
||||
for ($id = 1; $id <= 100; $id++) {
|
||||
|
||||
// create an XML element string with random data
|
||||
$s = "<data>";
|
||||
for ($j = 0; $j < 128; $j++) {
|
||||
$s .= rand();
|
||||
}
|
||||
$s .= "</data>\n";
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
$s .= $s;
|
||||
}
|
||||
$data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
|
||||
|
||||
// insert XML data into database
|
||||
|
||||
$stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
|
||||
oci_bind_by_name($stmt, ":id", $id);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary($data);
|
||||
oci_execute($stmt);
|
||||
|
||||
$clob->close();
|
||||
$clob->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
|
||||
createxmltab($c);
|
||||
fillxmltab($c);
|
||||
|
||||
// Run Test
|
||||
|
||||
$sid = sessionid($c);
|
||||
|
||||
echo "Explicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex($c);
|
||||
}
|
||||
|
||||
echo "\nImplicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_im($c);
|
||||
}
|
||||
|
||||
echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex_nofree($c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cleanup
|
||||
|
||||
dropxmltab($c);
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Explicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Implicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Explicit LOB with no free (i.e. a temp lob leak)
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 99
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 198
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 297
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 396
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 495
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 594
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 693
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 792
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 891
|
||||
Loop count check = 100
|
||||
Done
|
||||
@@ -1,303 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_clean();
|
||||
$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
|
||||
if ($ov !== 1) {
|
||||
die ("skip expected output only valid for Oracle 9.2 clients");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function sessionid($c) // determines and returns current session ID
|
||||
{
|
||||
$query = "select sid from v\$session where audsid = userenv('sessionid')";
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
return oci_result($stmt, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function templobs($c, $sid) // returns number of temporary LOBs
|
||||
{
|
||||
$query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
$val = oci_result($stmt, 1);
|
||||
oci_free_statement($stmt);
|
||||
return $val;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Read all XML data using explicit LOB locator
|
||||
function readxmltab_ex($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
$result[0]->free(); // cleanup properly
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using explicit LOB locator but without freeing the temp lobs
|
||||
function readxmltab_ex_nofree($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using implicit LOB locator
|
||||
function readxmltab_im($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
function createxmltab($c) // create table w/ field of XML type
|
||||
{
|
||||
@dropxmltab($c);
|
||||
$stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
function dropxmltab($c) // delete table
|
||||
{
|
||||
$stmt = oci_parse($c, "drop table bug43497_tab");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
|
||||
function fillxmltab($c)
|
||||
{
|
||||
for ($id = 1; $id <= 100; $id++) {
|
||||
|
||||
// create an XML element string with random data
|
||||
$s = "<data>";
|
||||
for ($j = 0; $j < 128; $j++) {
|
||||
$s .= rand();
|
||||
}
|
||||
$s .= "</data>\n";
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
$s .= $s;
|
||||
}
|
||||
$data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
|
||||
|
||||
// insert XML data into database
|
||||
|
||||
$stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
|
||||
oci_bind_by_name($stmt, ":id", $id);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary($data);
|
||||
oci_execute($stmt);
|
||||
|
||||
$clob->close();
|
||||
$clob->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
|
||||
createxmltab($c);
|
||||
fillxmltab($c);
|
||||
|
||||
// Run Test
|
||||
|
||||
$sid = sessionid($c);
|
||||
|
||||
echo "Explicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex($c);
|
||||
}
|
||||
|
||||
echo "\nImplicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_im($c);
|
||||
}
|
||||
|
||||
echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex_nofree($c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cleanup
|
||||
|
||||
dropxmltab($c);
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Explicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 100
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 200
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 300
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 400
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 500
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 600
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 700
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 800
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 900
|
||||
Loop count check = 100
|
||||
|
||||
Implicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 1000
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 1100
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 1200
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 1300
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 1400
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 1500
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 1600
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 1700
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 1800
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 1900
|
||||
Loop count check = 100
|
||||
|
||||
Explicit LOB with no free (i.e. a temp lob leak)
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 2000
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 2100
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 2200
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 2300
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 2400
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 2500
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 2600
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 2700
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 2800
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 2900
|
||||
Loop count check = 100
|
||||
Done
|
||||
@@ -1,54 +0,0 @@
|
||||
--TEST--
|
||||
Bug #44008 (Incorrect usage of OCI-Lob->close doesn't crash PHP)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace procedure bug44008_proc (p in out clob)
|
||||
as begin p := 'A';
|
||||
end;"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
$s = oci_parse($c, 'begin bug44008_proc(:data); end;');
|
||||
$textLob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($s, ":data", $textLob, -1, OCI_B_CLOB);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
$r = $textLob->load();
|
||||
echo "$r\n";
|
||||
|
||||
// Incorrectly closing the lob doesn't cause a crash.
|
||||
// OCI-LOB->close() is documented for use only with OCI-Lob->writeTemporary()
|
||||
$textLob->close();
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop procedure bug44008_proc"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
A
|
||||
Done
|
||||
@@ -1,52 +0,0 @@
|
||||
--TEST--
|
||||
Bug #44113 (New collection creation can fail with OCI-22303)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace type bug44113_list_t as table of number"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
// The test can take some time to complete and can exceed PHP's test
|
||||
// timout limit on slow networks.
|
||||
|
||||
for ($x = 0; $x < 70000; $x++) {
|
||||
if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
|
||||
print "Failed new collection creation on $x\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print "Completed $x\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop type bug44113_list_t"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Completed 70000
|
||||
Done
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Run Test
|
||||
|
||||
for ($x = 0; $x < 400; $x++)
|
||||
{
|
||||
$stmt = "select cursor (select $x from dual) a,
|
||||
cursor (select $x from dual) b
|
||||
from dual";
|
||||
$s = oci_parse($c, $stmt);
|
||||
$r = oci_execute($s);
|
||||
if (!$r) {
|
||||
echo "Exiting $x\n";
|
||||
exit;
|
||||
}
|
||||
$mode = OCI_ASSOC | OCI_RETURN_NULLS;
|
||||
$result = oci_fetch_array($s, $mode);
|
||||
oci_execute($result['A']);
|
||||
oci_execute($result['B']);
|
||||
oci_fetch_array($result['A'], $mode);
|
||||
oci_fetch_array($result['B'], $mode);
|
||||
oci_free_statement($result['A']);
|
||||
oci_free_statement($result['B']);
|
||||
oci_free_statement($s);
|
||||
}
|
||||
|
||||
echo "Completed $x\n";
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Completed 400
|
||||
Done
|
||||
@@ -1,84 +0,0 @@
|
||||
--TEST--
|
||||
Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
$stmt = 'select dummy "a", dummy "20" from dual';
|
||||
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($data);
|
||||
var_dump($data[0]);
|
||||
var_dump($data[0]["a"]);
|
||||
var_dump($data[0]["20"]);
|
||||
oci_free_statement($s);
|
||||
|
||||
echo "Test 2\n";
|
||||
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
|
||||
var_dump($data);
|
||||
var_dump($data["a"]);
|
||||
var_dump($data["20"]);
|
||||
var_dump($data["a"][0]);
|
||||
var_dump($data["20"][0]);
|
||||
oci_free_statement($s);
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
Test 1
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["a"]=>
|
||||
string(1) "X"
|
||||
[20]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
["a"]=>
|
||||
string(1) "X"
|
||||
[20]=>
|
||||
string(1) "X"
|
||||
}
|
||||
string(1) "X"
|
||||
string(1) "X"
|
||||
Test 2
|
||||
array(2) {
|
||||
["a"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "X"
|
||||
}
|
||||
[20]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "X"
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "X"
|
||||
}
|
||||
string(1) "X"
|
||||
string(1) "X"
|
||||
===DONE===
|
||||
@@ -1,86 +0,0 @@
|
||||
--TEST--
|
||||
Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
|
||||
begin
|
||||
dbms_lob.trim(p1, 0);
|
||||
dbms_lob.writeappend(p1, 26, 'This should be the output.');
|
||||
end bug46994_proc1;",
|
||||
"create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
|
||||
begin
|
||||
dbms_lob.trim(p1, 0);
|
||||
dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
|
||||
end bug46994_proc2;"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
$myclob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
$myclob->writeTemporary("some data", OCI_TEMP_CLOB);
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
|
||||
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
var_dump($myclob->load());
|
||||
|
||||
echo "Test 2\n";
|
||||
|
||||
$s = oci_parse($c, "begin bug46994_proc2(:myclob); end;");
|
||||
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
var_dump($myclob->load());
|
||||
|
||||
echo "Test 3\n";
|
||||
|
||||
$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
|
||||
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
var_dump($myclob->load());
|
||||
|
||||
echo "Test 4\n";
|
||||
|
||||
var_dump($myclob->load()); // Use cached size code path
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop procedure bug46994_proc1",
|
||||
"drop procedure bug46994_proc2"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
string(26) "This should be the output."
|
||||
Test 2
|
||||
string(37) "The output should be even longer now."
|
||||
Test 3
|
||||
string(26) "This should be the output."
|
||||
Test 4
|
||||
string(26) "This should be the output."
|
||||
===DONE===
|
||||
@@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
Bug #47189 (Multiple oci_fetch_all calls)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
$s = oci_parse($c, "select * from dual");
|
||||
oci_execute($s);
|
||||
oci_fetch_all($s, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($rs);
|
||||
oci_fetch_all($s, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($rs1);
|
||||
|
||||
$s = oci_parse($c, "select * from dual");
|
||||
oci_execute($s);
|
||||
oci_fetch_all($s, $rs, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($rs);
|
||||
oci_fetch_all($s, $rs1, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
|
||||
var_dump($rs1);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
|
||||
Warning: oci_fetch_all(): ORA-01002: %s in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
===DONE===
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
PECL Bug #6109 (Error messages not kept)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
echo "Once Oracle has popped the message from its stack, the message is\n";
|
||||
echo "no longer available.\n";
|
||||
|
||||
|
||||
$s = oci_parse($c, 'delete from table_does_not_exist');
|
||||
$r = @oci_execute($s);
|
||||
|
||||
if ($r) {
|
||||
echo "whoops - table does exist\n";
|
||||
} else {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$err = oci_error($s);
|
||||
echo ($i) .' -> '.$err['message'] ."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
Once Oracle has popped the message from its stack, the message is
|
||||
no longer available.
|
||||
0 -> ORA-00942: %s
|
||||
1 ->
|
||||
2 ->
|
||||
3 ->
|
||||
4 ->
|
||||
Done
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
connect/close/connect
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
oci_close($c);
|
||||
|
||||
oci_connect($user, $password, $dbase);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump(oci_new_collection($c, $type_name));
|
||||
var_dump(oci_new_collection($c, "NONEXISTENT"));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
|
||||
Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = oci_new_collection($c, $type_name));
|
||||
|
||||
var_dump($coll1->free());
|
||||
var_dump($coll1->size());
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = oci_new_collection($c, $type_name));
|
||||
|
||||
var_dump(oci_free_collection($coll1));
|
||||
var_dump(oci_collection_size($coll1));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->size());
|
||||
var_dump($coll1->max());
|
||||
var_dump($coll1->trim(3));
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->getElem(0));
|
||||
var_dump($coll1->assignElem(0,2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_size($coll1));
|
||||
var_dump(oci_collection_max($coll1));
|
||||
var_dump(oci_collection_trim($coll1, 3));
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
var_dump(oci_collection_element_assign($coll1, 0, 2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: oci_collection_trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
$coll2 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(1)
|
||||
Done
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
$coll2 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(1)
|
||||
Done
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
ocinewcollection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump(ocinewcollection($c, $type_name));
|
||||
var_dump(ocinewcollection($c, "NONEXISTENT"));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
|
||||
Warning: ocinewcollection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
Loaded 100 of 377 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user