ported ext/odbc

This commit is contained in:
Anatol Belski 2014-08-19 19:35:29 +02:00
parent 1899e6f9b9
commit e8fcd52ef1
4 changed files with 72 additions and 72 deletions

View file

@ -291,7 +291,7 @@ PHP_FUNCTION(birdstep_connect)
RETCODE stat;
HDBC hdbc;
VConn *new;
long ind;
php_int_t ind;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) {
return;
@ -324,10 +324,10 @@ PHP_FUNCTION(birdstep_connect)
*/
PHP_FUNCTION(birdstep_close)
{
long id;
php_int_t id;
VConn *conn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
return;
}
@ -346,7 +346,7 @@ PHP_FUNCTION(birdstep_close)
PHP_FUNCTION(birdstep_exec)
{
char *query;
long ind;
php_int_t ind;
int query_len, indx;
VConn *conn;
Vresult *res;
@ -354,7 +354,7 @@ PHP_FUNCTION(birdstep_exec)
SWORD cols,i,colnamelen;
SDWORD rows,coldesc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &ind, &query, &query_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &ind, &query, &query_len) == FAILURE) {
return;
}
@ -426,13 +426,13 @@ PHP_FUNCTION(birdstep_exec)
*/
PHP_FUNCTION(birdstep_fetch)
{
long ind;
php_int_t ind;
Vresult *res;
RETCODE stat;
UDWORD row;
UWORD RowStat[1];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
return;
}
@ -460,7 +460,7 @@ PHP_FUNCTION(birdstep_fetch)
PHP_FUNCTION(birdstep_result)
{
zval **col;
long ind;
php_int_t ind;
Vresult *res;
RETCODE stat;
int i,sql_c_type;
@ -469,7 +469,7 @@ PHP_FUNCTION(birdstep_result)
SWORD indx = -1;
char *field = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &ind, &col) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iZ", &ind, &col) == FAILURE) {
return;
}
@ -553,10 +553,10 @@ l1:
*/
PHP_FUNCTION(birdstep_freeresult)
{
long ind;
php_int_t ind;
Vresult *res;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
return;
}
@ -572,11 +572,11 @@ PHP_FUNCTION(birdstep_freeresult)
*/
PHP_FUNCTION(birdstep_autocommit)
{
long id;
php_int_t id;
RETCODE stat;
VConn *conn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
return;
}
@ -595,11 +595,11 @@ PHP_FUNCTION(birdstep_autocommit)
*/
PHP_FUNCTION(birdstep_off_autocommit)
{
long id;
php_int_t id;
RETCODE stat;
VConn *conn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
return;
}
@ -618,11 +618,11 @@ PHP_FUNCTION(birdstep_off_autocommit)
*/
PHP_FUNCTION(birdstep_commit)
{
long id;
php_int_t
RETCODE stat;
VConn *conn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
return;
}
@ -641,11 +641,11 @@ PHP_FUNCTION(birdstep_commit)
*/
PHP_FUNCTION(birdstep_rollback)
{
long id;
php_int_t id;
RETCODE stat;
VConn *conn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
return;
}
@ -664,11 +664,11 @@ PHP_FUNCTION(birdstep_rollback)
*/
PHP_FUNCTION(birdstep_fieldname)
{
long ind, col;
php_int_t ind, col;
Vresult *res;
SWORD indx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &ind, &col) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &ind, &col) == FAILURE) {
return;
}
@ -687,10 +687,10 @@ PHP_FUNCTION(birdstep_fieldname)
*/
PHP_FUNCTION(birdstep_fieldnum)
{
long ind;
php_int_t ind;
Vresult *res;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
return;
}

View file

@ -28,28 +28,28 @@
typedef struct VConn {
HDBC hdbc;
long index;
php_int_t index;
} VConn;
typedef struct {
char name[32];
char *value;
long vallen;
php_int_t vallen;
SDWORD valtype;
} VResVal;
typedef struct Vresult {
HSTMT hstmt;
VConn *conn;
long index;
php_int_t index;
VResVal *values;
long numcols;
php_int_t numcols;
int fetched;
} Vresult;
typedef struct {
long num_links;
long max_links;
php_int_t num_links;
php_int_t max_links;
int le_link,le_result;
} birdstep_module;

View file

@ -841,9 +841,9 @@ PHP_MINFO_FUNCTION(odbc)
php_info_print_table_start();
php_info_print_table_header(2, "ODBC Support", "enabled");
snprintf(buf, sizeof(buf), "%ld", ODBCG(num_persistent));
snprintf(buf, sizeof(buf), "%pd", ODBCG(num_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
snprintf(buf, sizeof(buf), "%ld", ODBCG(num_links));
snprintf(buf, sizeof(buf), "%pd", ODBCG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE);
#ifndef PHP_WIN32
@ -911,9 +911,9 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
odbc_result *result;
zval *pv_res;
long flag;
php_int_t flag;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &flag) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &flag) == FAILURE) {
return;
}
@ -1061,9 +1061,9 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
SQLLEN len;
#endif
zval *pv_res;
long pv_num;
php_int_t pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
return;
}
@ -1518,13 +1518,13 @@ PHP_FUNCTION(odbc_cursor)
PHP_FUNCTION(odbc_data_source)
{
zval *zv_conn;
long zv_fetch_type;
php_int_t zv_fetch_type;
RETCODE rc = 0; /* assume all is good */
odbc_connection *conn;
UCHAR server_name[100], desc[200];
SQLSMALLINT len1=0, len2=0, fetch_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zv_conn, &zv_fetch_type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zv_conn, &zv_fetch_type) == FAILURE) {
return;
}
@ -1573,7 +1573,7 @@ PHP_FUNCTION(odbc_data_source)
PHP_FUNCTION(odbc_exec)
{
zval *pv_conn;
long pv_flags;
php_int_t pv_flags;
char *query;
int numArgs, query_len;
odbc_result *result = NULL;
@ -1585,7 +1585,7 @@ PHP_FUNCTION(odbc_exec)
numArgs = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) {
return;
}
@ -1668,9 +1668,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
SQLUSMALLINT RowStatus[1];
SQLLEN rownum;
zval *pv_res, tmp;
long pv_row = -1;
php_int_t pv_row = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) {
return;
}
@ -1815,14 +1815,14 @@ PHP_FUNCTION(odbc_fetch_into)
char *buf = NULL;
zval *pv_res, *pv_res_arr, tmp;
#ifdef HAVE_SQL_EXTENDED_FETCH
long pv_row = 0;
php_int_t pv_row = 0;
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
SQLLEN rownum = -1;
#endif /* HAVE_SQL_EXTENDED_FETCH */
#ifdef HAVE_SQL_EXTENDED_FETCH
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|i", &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
return;
}
@ -1964,13 +1964,13 @@ PHP_FUNCTION(odbc_fetch_row)
odbc_result *result;
RETCODE rc;
zval *pv_res;
long pv_row = 1;
php_int_t pv_row = 1;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) {
return;
}
@ -2501,7 +2501,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *db, *uid, *pwd;
int db_len, uid_len, pwd_len;
long pv_opt = SQL_CUR_DEFAULT;
php_int_t pv_opt = SQL_CUR_DEFAULT;
odbc_connection *db_conn;
char *hashed_details;
int hashed_len, cur_opt;
@ -2509,7 +2509,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* Now an optional 4th parameter specifying the cursor type
* defaulting to the cursors default
*/
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) {
return;
}
@ -2784,9 +2784,9 @@ PHP_FUNCTION(odbc_field_name)
{
odbc_result *result;
zval *pv_res;
long pv_num;
php_int_t pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
return;
}
@ -2819,9 +2819,9 @@ PHP_FUNCTION(odbc_field_type)
char tmp[32];
SQLSMALLINT tmplen;
zval *pv_res;
long pv_num;
php_int_t pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
return;
}
@ -2905,9 +2905,9 @@ PHP_FUNCTION(odbc_autocommit)
odbc_connection *conn;
RETCODE rc;
zval *pv_conn;
long pv_onoff = 0;
php_int_t pv_onoff = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_onoff) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_onoff) == FAILURE) {
return;
}
@ -3017,9 +3017,9 @@ PHP_FUNCTION(odbc_setoption)
odbc_result *result;
RETCODE rc;
zval *pv_handle;
long pv_which, pv_opt, pv_val;
php_int_t pv_which, pv_opt, pv_val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
return;
}
@ -3344,13 +3344,13 @@ PHP_FUNCTION(odbc_foreignkeys)
PHP_FUNCTION(odbc_gettypeinfo)
{
zval *pv_conn;
long pv_data_type = SQL_ALL_TYPES;
php_int_t pv_data_type = SQL_ALL_TYPES;
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
SQLSMALLINT data_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_data_type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_data_type) == FAILURE) {
return;
}
@ -3597,7 +3597,7 @@ PHP_FUNCTION(odbc_procedures)
PHP_FUNCTION(odbc_specialcolumns)
{
zval *pv_conn;
long vtype, vscope, vnullable;
php_int_t vtype, vscope, vnullable;
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema = NULL, *name = NULL;
@ -3605,7 +3605,7 @@ PHP_FUNCTION(odbc_specialcolumns)
SQLUSMALLINT type, scope, nullable;
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris!ssi", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vscope, &vnullable) == FAILURE) {
return;
}
@ -3667,7 +3667,7 @@ PHP_FUNCTION(odbc_specialcolumns)
PHP_FUNCTION(odbc_statistics)
{
zval *pv_conn;
long vunique, vreserved;
php_int_t vunique, vreserved;
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema, *name;
@ -3675,7 +3675,7 @@ PHP_FUNCTION(odbc_statistics)
SQLUSMALLINT unique, reserved;
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len,
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssii", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vunique, &vreserved) == FAILURE) {
return;
}

View file

@ -161,7 +161,7 @@ PHP_FUNCTION(solid_fetch_prev);
#define ODBC_TYPE "Birdstep"
#define UNIX
/*
* Extended Fetch in the Birdstep ODBC API is incapable of returning long varchar (memo) fields.
* Extended Fetch in the Birdstep ODBC API is incapable of returning php_int_t varchar (memo) fields.
* So the following line has been commented-out to accommodate. - KNS
*
* #define HAVE_SQL_EXTENDED_FETCH 1
@ -247,7 +247,7 @@ typedef struct odbc_result {
# if HAVE_SQL_EXTENDED_FETCH
int fetch_abs;
# endif
long longreadlen;
php_int_t longreadlen;
int binmode;
int fetched;
odbc_connection *conn_ptr;
@ -257,16 +257,16 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc)
char *defDB;
char *defUser;
char *defPW;
long allow_persistent;
long check_persistent;
long max_persistent;
long max_links;
long num_persistent;
long num_links;
php_int_t allow_persistent;
php_int_t check_persistent;
php_int_t max_persistent;
php_int_t max_links;
php_int_t num_persistent;
php_int_t num_links;
int defConn;
long defaultlrl;
long defaultbinmode;
long default_cursortype;
php_int_t defaultlrl;
php_int_t defaultbinmode;
php_int_t default_cursortype;
char laststate[6];
char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
HashTable *resource_list;