THREAD_LS birdstep_module php_birdstep_module;
THREAD_LS static HENV henv;
+#define PHP_GET_BIRDSTEP_RES_IDX(id) convert_to_long_ex(id); if (!(res = birdstep_find_result(list, Z_LVAL_PP(id)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d)", Z_LVAL_PP(id)); RETURN_FALSE; }
+#define PHP_BIRDSTEP_CHK_LNK(id) convert_to_long_ex(id); if (!(conn = birdstep_find_conn(list,Z_LVAL_PP(id)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)", Z_LVAL_PP(id)); RETURN_FALSE; }
+
+
static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
VConn *conn = (VConn *)rsrc->ptr;
/* Users functions */
-/* {{{ proto int birdstep_connect(string server, string user, sting pass)
+/* {{{ proto int birdstep_connect(string server, string user, string pass)
*/
PHP_FUNCTION(birdstep_connect)
{
- pval *serv,*user,*pass;
+ zval **serv,**user,**pass;
char *Serv = NULL;
char *User = NULL;
char *Pass = NULL;
long ind;
if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) {
- php_error(E_WARNING,"Birdstep: Too many open connections (%d)",php_birdstep_module.num_links);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links);
RETURN_FALSE;
}
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht,3,&serv,&user,&pass) == FAILURE ) {
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &serv, &user, &pass) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_string(serv);
- convert_to_string(user);
- convert_to_string(pass);
- Serv = Z_STRVAL_P(serv);
- User = Z_STRVAL_P(user);
- Pass = Z_STRVAL_P(pass);
+ convert_to_string_ex(serv);
+ convert_to_string_ex(user);
+ convert_to_string_ex(pass);
+ Serv = Z_STRVAL_PP(serv);
+ User = Z_STRVAL_PP(user);
+ Pass = Z_STRVAL_PP(pass);
stat = SQLAllocConnect(henv,&hdbc);
if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Birdstep: Could not allocate connection handle");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not allocate connection handle");
RETURN_FALSE;
}
stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: Could not connect to server \"%s\" for %s",Serv,User);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s",Serv,User);
SQLFreeConnect(hdbc);
RETURN_FALSE;
}
new = (VConn *)emalloc(sizeof(VConn));
- if ( new == NULL ) {
- php_error(E_WARNING,"Birdstep: Out of memory for store connection");
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
ind = birdstep_add_conn(list,new,hdbc);
php_birdstep_module.num_links++;
RETURN_LONG(ind);
*/
PHP_FUNCTION(birdstep_close)
{
- pval *id;
+ zval **id;
VConn *conn;
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(id);
- conn = birdstep_find_conn(list,Z_LVAL_P(id));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id));
- RETURN_FALSE;
- }
+ PHP_BIRDSTEP_CHK_LNK(id);
+
SQLDisconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
- birdstep_del_conn(list,Z_LVAL_P(id));
+ birdstep_del_conn(list,Z_LVAL_PP(id));
php_birdstep_module.num_links--;
RETURN_TRUE;
}
*/
PHP_FUNCTION(birdstep_exec)
{
- pval *ind,*exec_str;
+ zval **ind, **exec_str;
char *query = NULL;
int indx;
VConn *conn;
SWORD cols,i,colnamelen;
SDWORD rows,coldesc;
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&exec_str) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &exec_str) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- conn = birdstep_find_conn(list,Z_LVAL_P(ind));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(ind));
- RETURN_FALSE;
- }
- convert_to_string(exec_str);
- query = Z_STRVAL_P(exec_str);
+ PHP_BIRDSTEP_CHK_LNK(ind);
+
+ convert_to_string_ex(exec_str);
+ query = Z_STRVAL_PP(exec_str);
res = (Vresult *)emalloc(sizeof(Vresult));
- if ( res == NULL ) {
- php_error(E_WARNING,"Birdstep: Out of memory for result");
- RETURN_FALSE;
- }
stat = SQLAllocStmt(conn->hdbc,&res->hstmt);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: SQLAllocStmt return %d",stat);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat);
efree(res);
RETURN_FALSE;
}
stat = SQLExecDirect(res->hstmt,query,SQL_NTS);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: Can not execute \"%s\" query",query);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Can not execute \"%s\" query",query);
SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res);
RETURN_FALSE;
/* Success query */
stat = SQLNumResultCols(res->hstmt,&cols);
if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Birdstep: SQLNumResultCols return %d",stat);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res);
RETURN_FALSE;
if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */
stat = SQLRowCount(res->hstmt,&rows);
if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Birdstep: SQLNumResultCols return %d",stat);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res);
RETURN_FALSE;
RETURN_LONG(rows);
} else { /* Was SELECT query */
res->values = (VResVal *)emalloc(sizeof(VResVal)*cols);
- if ( res->values == NULL ) {
- php_error(E_WARNING,"Birdstep: Out of memory for result columns");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
res->numcols = cols;
for ( i = 0; i < cols; i++ ) {
SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME,
SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_DISPLAY_SIZE,
NULL,0,NULL,&coldesc);
res->values[i].value = (char *)emalloc(coldesc+1);
- if ( res->values[i].value != NULL ) {
- SQLBindCol(res->hstmt,i+1,SQL_C_CHAR,
- res->values[i].value,coldesc+1,
- &res->values[i].vallen);
- }
+ SQLBindCol(res->hstmt,i+1,SQL_C_CHAR, res->values[i].value,coldesc+1, &res->values[i].vallen);
}
}
res->fetched = 0;
*/
PHP_FUNCTION(birdstep_fetch)
{
- pval *ind;
+ zval **ind;
Vresult *res;
RETCODE stat;
UDWORD row;
UWORD RowStat[1];
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- res = birdstep_find_result(list,Z_LVAL_P(ind));
- if ( !res ) {
- php_error(E_WARNING,"Birdstep: Not result index (%d)",Z_LVAL_P(ind));
- RETURN_FALSE;
- }
+ PHP_GET_BIRDSTEP_RES_IDX(ind);
+
stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: SQLFetch return error");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
res->fetched = 1;
*/
PHP_FUNCTION(birdstep_result)
{
- pval *ind,*col;
+ zval **ind, **col;
Vresult *res;
RETCODE stat;
int i,sql_c_type;
SWORD indx = -1;
char *field = NULL;
- if ( ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &col) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- res = birdstep_find_result(list,Z_LVAL_P(ind));
- if ( !res ) {
- php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)");
- RETURN_FALSE;
- }
- if ( Z_TYPE_P(col) == IS_STRING ) {
- field = Z_STRVAL_P(col);
+ PHP_GET_BIRDSTEP_RES_IDX(ind);
+
+ if ( Z_TYPE_PP(col) == IS_STRING ) {
+ field = Z_STRVAL_PP(col);
} else {
- convert_to_long(col);
- indx = Z_LVAL_P(col);
+ convert_to_long_ex(col);
+ indx = Z_LVAL_PP(col);
}
if ( field ) {
for ( i = 0; i < res->numcols; i++ ) {
}
}
if ( indx < 0 ) {
- php_error(E_WARNING, "Field %s not found",field);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found",field);
RETURN_FALSE;
}
} else {
if ( indx < 0 || indx >= res->numcols ) {
- php_error(E_WARNING,"Birdstep: Field index not in range");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
RETURN_FALSE;
}
}
stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: SQLFetch return error");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
res->fetched = 1;
l1:
if ( !res->values[indx].value ) {
res->values[indx].value = emalloc(4096);
- if ( !res->values[indx].value ) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
}
stat = SQLGetData(res->hstmt,indx+1,sql_c_type,
res->values[indx].value,4095,&res->values[indx].vallen);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: SQLGetData return error");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( res->values[indx].valtype == SQL_LONGVARCHAR ) {
*/
PHP_FUNCTION(birdstep_freeresult)
{
- pval *ind;
+ zval **ind;
Vresult *res;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- res = birdstep_find_result(list,Z_LVAL_P(ind));
- if ( !res ) {
- php_error(E_WARNING,"Birdstep: Not result index (%d)",Z_LVAL_P(ind));
- RETURN_FALSE;
- }
+ PHP_GET_BIRDSTEP_RES_IDX(ind);
+
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_P(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_TRUE;
}
/* }}} */
*/
PHP_FUNCTION(birdstep_autocommit)
{
- pval *id;
+ zval **id;
RETCODE stat;
VConn *conn;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(id);
- conn = birdstep_find_conn(list,Z_LVAL_P(id));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id));
- RETURN_FALSE;
- }
+ PHP_BIRDSTEP_CHK_LNK(id);
+
stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: Set autocommit_on option failure");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_on option failure");
RETURN_FALSE;
}
RETURN_TRUE;
*/
PHP_FUNCTION(birdstep_off_autocommit)
{
- pval *id;
+ zval **id;
RETCODE stat;
VConn *conn;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(id);
- conn = birdstep_find_conn(list,Z_LVAL_P(id));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id));
- RETURN_FALSE;
- }
+ PHP_BIRDSTEP_CHK_LNK(id);
+
stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Birdstep: Set autocommit_off option failure");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_off option failure");
RETURN_FALSE;
}
RETURN_TRUE;
*/
PHP_FUNCTION(birdstep_commit)
{
- pval *id;
+ zval **id;
RETCODE stat;
VConn *conn;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(id);
- conn = birdstep_find_conn(list,Z_LVAL_P(id));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id));
- RETURN_FALSE;
- }
+ PHP_BIRDSTEP_CHK_LNK(id)
+
stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT);
if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Birdstep: Commit failure");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Commit failure");
RETURN_FALSE;
}
RETURN_TRUE;
*/
PHP_FUNCTION(birdstep_rollback)
{
- pval *id;
+ zval **id;
RETCODE stat;
VConn *conn;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(id);
- conn = birdstep_find_conn(list,Z_LVAL_P(id));
- if ( !conn ) {
- php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id));
- RETURN_FALSE;
- }
+ PHP_BIRDSTEP_CHK_LNK(id);
+
stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK);
if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Birdstep: Rollback failure");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Rollback failure");
RETURN_FALSE;
}
RETURN_TRUE;
*/
PHP_FUNCTION(birdstep_fieldname)
{
- pval *ind,*col;
+ zval **ind, **col;
Vresult *res;
SWORD indx;
- if ( ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &col) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- res = birdstep_find_result(list,Z_LVAL_P(ind));
- if ( !res ) {
- php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)");
- RETURN_FALSE;
- }
- convert_to_long(col);
- indx = Z_LVAL_P(col);
+ PHP_GET_BIRDSTEP_RES_IDX(ind);
+
+ convert_to_long_ex(col);
+ indx = Z_LVAL_PP(col);
if ( indx < 0 || indx >= res->numcols ) {
- php_error(E_WARNING,"Birdstep: Field index not in range");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
RETURN_FALSE;
}
RETURN_STRING(res->values[indx].name,TRUE);
*/
PHP_FUNCTION(birdstep_fieldnum)
{
- pval *ind;
+ zval **ind;
Vresult *res;
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
+ if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_long(ind);
- res = birdstep_find_result(list,Z_LVAL_P(ind));
- if ( !res ) {
- php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)");
- RETURN_FALSE;
- }
+ PHP_GET_BIRDSTEP_RES_IDX(ind);
+
RETURN_LONG(res->numcols);
}
/* }}} */
| 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@fast.no> |
+ | Authors: Stig Sæther Bakken <ssb@php.net> |
| Andreas Karajannis <Andreas.Karajannis@gmd.de> |
| Frank M. Kromann <frank@kromann.info> Support for DB/2 CLI |
| Kevin N. Shallow <kshallow@tampabay.rr.com> Birdstep Support|
memcpy(ODBCG(laststate), state, sizeof(state));
memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg));
if (func) {
- php_error(E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
} else {
- php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
}
/*
} while (SQL_SUCCEEDED(rc));
result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols);
- if (result->values == NULL) {
- php_error(E_WARNING, "Out of memory");
- SQLFreeStmt(result->stmt, SQL_DROP);
- return 0;
- }
-
result->longreadlen = ODBCG(defaultlrl);
result->binmode = ODBCG(defaultbinmode);
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto int odbc_binmode(int result_id, int mode)
+/* {{{ proto bool odbc_binmode(int result_id, int mode)
Handle binary column data */
PHP_FUNCTION(odbc_binmode)
{
}
/* }}} */
-/* {{{ proto int odbc_longreadlen(int result_id, int length)
+/* {{{ proto bool odbc_longreadlen(int result_id, int length)
Handle LONG columns */
PHP_FUNCTION(odbc_longreadlen)
{
}
/* }}} */
-/* {{{ proto int odbc_prepare(int connection_id, string query)
+/* {{{ proto resource odbc_prepare(resource connection_id, string query)
Prepares a statement for execution */
PHP_FUNCTION(odbc_prepare)
{
query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
result->numparams = 0;
* Execute prepared SQL statement. Supports only input parameters.
*/
-/* {{{ proto int odbc_execute(int result_id [, array parameters_array])
+/* {{{ proto bool odbc_execute(resource result_id [, array parameters_array])
Execute a prepared statement */
PHP_FUNCTION(odbc_execute)
{
/* XXX check for already bound parameters*/
if (result->numparams > 0 && numArgs == 1) {
- php_error(E_WARNING, "No parameters to SQL statement given");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No parameters to SQL statement given");
RETURN_FALSE;
}
if (result->numparams > 0) {
if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) {
- php_error(E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams);
RETURN_FALSE;
}
for(i = 1; i <= result->numparams; i++) {
if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) {
- php_error(E_WARNING,"Error getting parameter");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error getting parameter");
SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
efree(params);
RETURN_FALSE;
otype = (*tmp)->type;
convert_to_string(*tmp);
if (Z_TYPE_PP(tmp) != IS_STRING) {
- php_error(E_WARNING,"Error converting parameter");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
efree(params);
RETURN_FALSE;
}
if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
- php_error(E_WARNING,"Can't open file %s", filename);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't open file %s", filename);
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
for(i = 0; i < result->numparams; i++) {
if (params[i].fp != -1) {
}
/* }}} */
-/* {{{ proto string odbc_cursor(int result_id)
+/* {{{ proto string odbc_cursor(resource result_id)
Get cursor name */
PHP_FUNCTION(odbc_cursor)
{
if (max_len > 0) {
cursorname = emalloc(max_len + 1);
- if (cursorname == NULL) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
char state[6]; /* Not used */
RETVAL_STRING(cursorname,1);
}
} else {
- php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
RETVAL_FALSE;
}
} else {
/* }}} */
#ifdef HAVE_SQLDATASOURCES
-/* {{{ proto array odbc_data_source(int connection_id, int fetch_type)
+/* {{{ proto array odbc_data_source(resource connection_id, int fetch_type)
Return information about the currently connected data source */
PHP_FUNCTION(odbc_data_source)
{
}
if (zend_get_parameters_ex(2, &zv_conn, &zv_fetch_type) == FAILURE) {
- php_error(E_WARNING, "%s(): Unable to get parameters", get_active_function_name(TSRMLS_C));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to get parameters");
RETURN_FALSE;
}
/* }}} */
#endif /* HAVE_SQLDATASOURCES *
-/* {{{ proto int odbc_exec(int connection_id, string query [, int flags])
+/* {{{ proto resource odbc_exec(resource connection_id, string query [, int flags])
Prepare and execute an SQL statement */
/* XXX Use flags */
PHP_FUNCTION(odbc_exec)
query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
/* }}} */
#endif
-/* {{{ proto int odbc_fetch_into(int result_id, array result_array, [, int rownumber])
+/* {{{ proto int odbc_fetch_into(resource result_id, array result_array, [, int rownumber])
Fetch one result row into an array */
PHP_FUNCTION(odbc_fetch_into)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
if (Z_TYPE_PP(pv_res_arr) != IS_ARRAY) {
- if (array_init(*pv_res_arr) == FAILURE) {
- php_error(E_WARNING, "Can't convert to type Array");
- RETURN_FALSE;
- }
+ array_init(*pv_res_arr);
}
#ifdef HAVE_SQL_EXTENDED_FETCH
}
/* }}} */
-/* {{{ solid_fetch_prev */
+/* {{{ proto bool solid_fetch_prev(resource result_id)
+ */
#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
PHP_FUNCTION(solid_fetch_prev)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
rc = SQLFetchPrev(result->stmt);
#endif
/* }}} */
-/* {{{ proto int odbc_fetch_row(int result_id [, int row_number])
+/* {{{ proto bool odbc_fetch_row(resource result_id [, int row_number])
Fetch a row */
PHP_FUNCTION(odbc_fetch_row)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto string odbc_result(int result_id, mixed field)
+/* {{{ proto mixed odbc_result(resource result_id, mixed field)
Get result data */
PHP_FUNCTION(odbc_result)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if ((result->numcols == 0)) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
/* get field index if the field parameter was a string */
if (field != NULL) {
if (result->values == NULL) {
- php_error(E_WARNING, "Result set contains no data");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result set contains no data");
RETURN_FALSE;
}
}
if (field_ind < 0) {
- php_error(E_WARNING, "Field %s not found", field);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found", field);
RETURN_FALSE;
}
} else {
/* check for limits of field_ind if the field parameter was an int */
if (field_ind >= result->numcols || field_ind < 0) {
- php_error(E_WARNING, "Field index is larger than the number of fields");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index is larger than the number of fields");
RETURN_FALSE;
}
}
/* For char data, the length of the returned string will be longreadlen - 1 */
fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
field = emalloc(fieldsize);
- if (!field) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
/* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0.
* For binary data it is truncated to fieldsize bytes.
/* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
- if ((field = emalloc(fieldsize)) == NULL) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
+ field = emalloc(fieldsize);
/* Call SQLGetData() until SQL_SUCCESS is returned */
while(1) {
}
/* }}} */
-/* {{{ proto int odbc_result_all(int result_id [, string format])
+/* {{{ proto int odbc_result_all(resource result_id [, string format])
Print result as HTML table */
PHP_FUNCTION(odbc_result_all)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
#ifdef HAVE_SQL_EXTENDED_FETCH
}
/* }}} */
-/* {{{ proto int odbc_free_result(int result_id)
+/* {{{ proto bool odbc_free_result(resource result_id)
Free resources associated with a result */
PHP_FUNCTION(odbc_free_result)
{
}
/* }}} */
-/* {{{ proto int odbc_connect(string DSN, string user, string password [, int cursor_option])
+/* {{{ proto resource odbc_connect(string DSN, string user, string password [, int cursor_option])
Connect to a datasource */
PHP_FUNCTION(odbc_connect)
{
}
/* }}} */
-/* {{{ proto int odbc_pconnect(string DSN, string user, string password [, int cursor_option])
+/* {{{ proto resource odbc_pconnect(string DSN, string user, string password [, int cursor_option])
Establish a persistent connection to a datasource */
PHP_FUNCTION(odbc_pconnect)
{
#endif
#ifdef HAVE_OPENLINK
{
- char dsnbuf[300];
+ char dsnbuf[1024];
short dsnbuflen;
rc = SQLDriverConnect((*conn)->hdbc, NULL, db, SQL_NTS,
}
}
- if (direct)
- rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf, sizeof(dsnbuf),
- &dsnbuflen, SQL_DRIVER_NOPROMPT);
- else
+ if (direct) {
+ rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf,
+ sizeof(dsnbuf) - 1, &dsnbuflen, SQL_DRIVER_NOPROMPT);
+ } else {
rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
- if (ldb)
+ }
+
+ if (ldb) {
efree(ldb);
+ }
}
#else
rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
}
/* }}} */
-/* {{{ proto void odbc_close(int connection_id)
+/* {{{ proto void odbc_close(resource connection_id)
Close an ODBC connection */
PHP_FUNCTION(odbc_close)
{
}
/* }}} */
-/* {{{ proto int odbc_num_rows(int result_id)
+/* {{{ proto int odbc_num_rows(resource result_id)
Get number of rows in a result */
PHP_FUNCTION(odbc_num_rows)
{
/* }}} */
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-/* {{{ proto bool odbc_next_result(int result_id)
+/* {{{ proto bool odbc_next_result(resource result_id)
Checks if multiple results are avaiable */
PHP_FUNCTION(odbc_next_result)
{
/* }}} */
#endif
-/* {{{ proto int odbc_num_fields(int result_id)
+/* {{{ proto int odbc_num_fields(resource result_id)
Get number of columns in a result */
PHP_FUNCTION(odbc_num_fields)
{
}
/* }}} */
-/* {{{ proto string odbc_field_name(int result_id, int field_number)
+/* {{{ proto string odbc_field_name(resource result_id, int field_number)
Get a column name */
PHP_FUNCTION(odbc_field_name)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto string odbc_field_type(int result_id, int field_number)
+/* {{{ proto string odbc_field_type(resource result_id, int field_number)
Get the datatype of a column */
PHP_FUNCTION(odbc_field_type)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
if (Z_LVAL_PP(pv_num) < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto int odbc_field_len(int result_id, int field_number)
+/* {{{ proto int odbc_field_len(resource result_id, int field_number)
Get the length (precision) of a column */
PHP_FUNCTION(odbc_field_len)
{
}
/* }}} */
-/* {{{ proto int odbc_field_scale(int result_id, int field_number)
+/* {{{ proto int odbc_field_scale(resource result_id, int field_number)
Get the scale of a column */
PHP_FUNCTION(odbc_field_scale)
{
}
/* }}} */
-/* {{{ proto int odbc_field_num(int result_id, string field_name)
+/* {{{ proto int odbc_field_num(resource result_id, string field_name)
Return column number */
PHP_FUNCTION(odbc_field_num)
{
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto int odbc_autocommit(int connection_id [, int OnOff])
+/* {{{ proto mixed odbc_autocommit(resource connection_id [, int OnOff])
Toggle autocommit mode or get status */
/* There can be problems with pconnections!*/
PHP_FUNCTION(odbc_autocommit)
}
/* }}} */
-/* {{{ proto int odbc_commit(int connection_id)
+/* {{{ proto bool odbc_commit(resource connection_id)
Commit an ODBC transaction */
PHP_FUNCTION(odbc_commit)
{
}
/* }}} */
-/* {{{ proto int odbc_rollback(int connection_id)
+/* {{{ proto bool odbc_rollback(resource connection_id)
Rollback a transaction */
PHP_FUNCTION(odbc_rollback)
{
}
/* }}} */
-/* {{{ proto string odbc_error([int connection_id])
+/* {{{ proto string odbc_error([resource connection_id])
Get the last error code */
PHP_FUNCTION(odbc_error)
{
}
/* }}} */
-/* {{{ proto string odbc_errormsg([int connection_id])
+/* {{{ proto string odbc_errormsg([resource connection_id])
Get the last error message */
PHP_FUNCTION(odbc_errormsg)
{
}
/* }}} */
-/* {{{ proto int odbc_setoption(int conn_id|result_id, int which, int option, int value)
+/* {{{ proto bool odbc_setoption(resource conn_id|result_id, int which, int option, int value)
Sets connection or statement options */
/* This one has to be used carefully. We can't allow to set connection options for
persistent connections. I think that SetStmtOption is of little use, since most
case 1: /* SQLSetConnectOption */
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
if (conn->persistent) {
- php_error(E_WARNING, "Unable to set option for persistent connection");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set option for persistent connection");
RETURN_FALSE;
}
rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val));
* metadata functions
*/
-/* {{{ proto int odbc_tables(int connection_id [, string qualifier, string owner, string name, string table_types])
+/* {{{ proto resource odbc_tables(resource connection_id [, string qualifier, string owner, string name, string table_types])
Call the SQLTables function */
PHP_FUNCTION(odbc_tables)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
}
/* }}} */
-/* {{{ proto int odbc_columns(int connection_id, string qualifier, string owner, string table_name, string column_name)
+/* {{{ proto resource odbc_columns(resource connection_id, string qualifier, string owner, string table_name, string column_name)
Returns a result identifier that can be used to fetch a list of column names in specified tables */
PHP_FUNCTION(odbc_columns)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
/*
* Needed to make MS Access happy
*/
- if (table && strlen(table) && schema && !strlen(schema)) {
- schema = NULL;
- }
+ if (table && strlen(table) && schema && !strlen(schema)) schema = NULL;
rc = SQLColumns(result->stmt,
cat, cat_len,
/* }}} */
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_columnprivileges(int connection_id, string catalog, string schema, string table, string column)
+/* {{{ proto resource odbc_columnprivileges(resource connection_id, string catalog, string schema, string table, string column)
Returns a result identifier that can be used to fetch a list of columns and associated privileges for the specified table */
PHP_FUNCTION(odbc_columnprivileges)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
#endif /* HAVE_DBMAKER || HAVE_SOLID*/
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_foreignkeys(int connection_id, string pk_qualifier, string pk_owner, string pk_table, string fk_qualifier, string fk_owner, string fk_table)
+/* {{{ proto resource odbc_foreignkeys(resource connection_id, string pk_qualifier, string pk_owner, string pk_table, string fk_qualifier, string fk_owner, string fk_table)
Returns a result identifier to either a list of foreign keys in the specified table or a list of foreign keys in other tables that refer to the primary key in the specified table */
PHP_FUNCTION(odbc_foreignkeys)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
/* }}} */
#endif /* HAVE_SOLID */
-/* {{{ proto int odbc_gettypeinfo(int connection_id [, int data_type])
+/* {{{ proto resource odbc_gettypeinfo(resource connection_id [, int data_type])
Returns a result identifier containing information about data types supported by the data source */
PHP_FUNCTION(odbc_gettypeinfo)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
}
/* }}} */
-/* {{{ proto int odbc_primarykeys(int connection_id, string qualifier, string owner, string table)
+/* {{{ proto resource odbc_primarykeys(resource connection_id, string qualifier, string owner, string table)
Returns a result identifier listing the column names that comprise the primary key for a table */
PHP_FUNCTION(odbc_primarykeys)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
/* }}} */
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_procedurecolumns(int connection_id [, string qualifier, string owner, string proc, string column])
+/* {{{ proto resource odbc_procedurecolumns(resource connection_id [, string qualifier, string owner, string proc, string column])
Returns a result identifier containing the list of input and output parameters, as well as the columns that make up the result set for the specified procedures */
PHP_FUNCTION(odbc_procedurecolumns)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
#endif /* HAVE_SOLID */
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_procedures(int connection_id [, string qualifier, string owner, string name])
+/* {{{ proto resource odbc_procedures(resource connection_id [, string qualifier, string owner, string name])
Returns a result identifier containg the list of procedure names in a datasource */
PHP_FUNCTION(odbc_procedures)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
/* }}} */
#endif /* HAVE_SOLID */
-/* {{{ proto int odbc_specialcolumns(int connection_id, int type, string qualifier, string owner, string table, int scope, int nullable)
+/* {{{ proto resource odbc_specialcolumns(resource connection_id, int type, string qualifier, string owner, string table, int scope, int nullable)
Returns a result identifier containing either the optimal set of columns that uniquely identifies a row in the table or columns that are automatically updated when any value in the row is updated by a transaction */
PHP_FUNCTION(odbc_specialcolumns)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
}
/* }}} */
-/* {{{ proto int odbc_statistics(int connection_id, string qualifier, string owner, string name, int unique, int accuracy)
+/* {{{ proto resource odbc_statistics(resource connection_id, string qualifier, string owner, string name, int unique, int accuracy)
Returns a result identifier that contains statistics about a single table and the indexes associated with the table */
PHP_FUNCTION(odbc_statistics)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
/* }}} */
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_tableprivileges(int connection_id, string qualifier, string owner, string name)
+/* {{{ proto resource odbc_tableprivileges(resource connection_id, string qualifier, string owner, string name)
Returns a result identifier containing a list of tables and the privileges associated with each table */
PHP_FUNCTION(odbc_tableprivileges)
{
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {