diff options
author | peter <peter@FreeBSD.org> | 2013-11-25 22:20:34 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2013-11-25 22:20:34 +0000 |
commit | ce675ab4018f54462adad54483c861f607f688c7 (patch) | |
tree | e570b7d70401fc65aee06a72b02b4ba87c9141b7 /contrib/apr-util/dbd | |
parent | b9061d4b3d5d7d3aaa3a7c3431088a7a681f91ed (diff) | |
download | FreeBSD-src-ce675ab4018f54462adad54483c861f607f688c7.zip FreeBSD-src-ce675ab4018f54462adad54483c861f607f688c7.tar.gz |
Import apr-util-1.5.3 from vendor branch (rr258600)
This is a minor bug fix release.
Diffstat (limited to 'contrib/apr-util/dbd')
-rw-r--r-- | contrib/apr-util/dbd/apr_dbd.c | 10 | ||||
-rw-r--r-- | contrib/apr-util/dbd/apr_dbd_odbc.c | 27 |
2 files changed, 20 insertions, 17 deletions
diff --git a/contrib/apr-util/dbd/apr_dbd.c b/contrib/apr-util/dbd/apr_dbd.c index 49553f2..bfa97d9 100644 --- a/contrib/apr-util/dbd/apr_dbd.c +++ b/contrib/apr-util/dbd/apr_dbd.c @@ -102,8 +102,10 @@ APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool) } /* Top level pool scope, need process-scope lifetime */ - for (parent = pool; parent; parent = apr_pool_parent_get(pool)) - pool = parent; + for (parent = apr_pool_parent_get(pool); + parent && parent != pool; + parent = apr_pool_parent_get(pool)) + pool = parent; #if APU_DSO_BUILD /* deprecate in 2.0 - permit implicit initialization */ apu_dso_init(pool); @@ -184,7 +186,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, #if defined(NETWARE) apr_snprintf(modname, sizeof(modname), "dbd%s.nlm", name); -#elif defined(WIN32) +#elif defined(WIN32) || defined(__CYGWIN__) apr_snprintf(modname, sizeof(modname), "apr_dbd_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name); #else @@ -204,7 +206,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, } apu_dso_mutex_unlock(); -#else /* not builtin and !APR_HAS_DSO => not implemented */ +#else /* not builtin and !APU_DSO_BUILD => not implemented */ rv = APR_ENOTIMPL; #endif diff --git a/contrib/apr-util/dbd/apr_dbd_odbc.c b/contrib/apr-util/dbd/apr_dbd_odbc.c index 3a97052..6ee8a7d 100644 --- a/contrib/apr-util/dbd/apr_dbd_odbc.c +++ b/contrib/apr-util/dbd/apr_dbd_odbc.c @@ -114,9 +114,9 @@ struct apr_dbd_t char lastError[MAX_ERROR_STRING]; int defaultBufferSize; /* used for CLOBs in text mode, * and when fld size is indeterminate */ - int transaction_mode; - int dboptions; /* driver options re SQLGetData */ - int default_transaction_mode; + intptr_t transaction_mode; + intptr_t dboptions; /* driver options re SQLGetData */ + intptr_t default_transaction_mode; int can_commit; /* controls end_trans behavior */ }; @@ -359,7 +359,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res, SQLHANDLE stmt) { SQLRETURN rc; - int maxsize, textsize, realsize, type, isunsigned = 1; + intptr_t maxsize, textsize, realsize, type, isunsigned = 1; /* discover the sql type */ rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_UNSIGNED, NULL, 0, NULL, @@ -409,7 +409,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res, type = SQL_C_CHAR; } - res->coltypes[icol] = type; + res->coltypes[icol] = (SQLSMALLINT)type; /* size if retrieved as text */ rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_DISPLAY_SIZE, NULL, 0, @@ -441,12 +441,12 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res, res->colptrs[icol] = NULL; res->colstate[icol] = COL_AVAIL; - res->colsizes[icol] = maxsize; + res->colsizes[icol] = (SQLINTEGER)maxsize; rc = SQL_SUCCESS; } else { res->colptrs[icol] = apr_pcalloc(res->pool, maxsize); - res->colsizes[icol] = maxsize; + res->colsizes[icol] = (SQLINTEGER)maxsize; if (res->apr_dbd->dboptions & SQL_GD_BOUND) { /* we are allowed to call SQLGetData if we need to */ rc = SQLBindCol(stmt, icol + 1, res->coltypes[icol], @@ -747,7 +747,7 @@ static void *odbc_get(const apr_dbd_row_t *row, const int col, SQLRETURN rc; SQLLEN indicator; int state = row->res->colstate[col]; - int options = row->res->apr_dbd->dboptions; + intptr_t options = row->res->apr_dbd->dboptions; switch (state) { case (COL_UNAVAIL): @@ -817,13 +817,13 @@ static apr_status_t odbc_parse_params(apr_pool_t *pool, const char *params, int *connect, SQLCHAR **datasource, SQLCHAR **user, SQLCHAR **password, int *defaultBufferSize, int *nattrs, - int **attrs, int **attrvals) + int **attrs, intptr_t **attrvals) { char *seps, *last, *next, *name[MAX_PARAMS], *val[MAX_PARAMS]; int nparams = 0, i, j; *attrs = apr_pcalloc(pool, MAX_PARAMS * sizeof(char *)); - *attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(int)); + *attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(intptr_t)); *nattrs = 0; seps = DEFAULTSEPS; name[nparams] = apr_strtok(apr_pstrdup(pool, params), seps, &last); @@ -1062,7 +1062,8 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e SQLHANDLE err_h = NULL; SQLCHAR *datasource = (SQLCHAR *)"", *user = (SQLCHAR *)"", *password = (SQLCHAR *)""; - int nattrs = 0, *attrs = NULL, *attrvals = NULL, connect = 0; + int nattrs = 0, *attrs = NULL, connect = 0; + intptr_t *attrvals = NULL; err_step = "SQLAllocHandle (SQL_HANDLE_DBC)"; err_htype = SQL_HANDLE_ENV; @@ -1116,10 +1117,10 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e handle->default_transaction_mode = 0; handle->can_commit = APR_DBD_TRANSACTION_IGNORE_ERRORS; SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION, - &(handle->default_transaction_mode), sizeof(int), NULL); + &(handle->default_transaction_mode), sizeof(intptr_t), NULL); handle->transaction_mode = handle->default_transaction_mode; SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS ,&(handle->dboptions), - sizeof(int), NULL); + sizeof(intptr_t), NULL); apr_pool_cleanup_register(pool, handle, odbc_close_cleanup, apr_pool_cleanup_null); return handle; } |