summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-03 01:22:58 -0800
committerStanislav Malyshev <stas@php.net>2015-01-10 15:07:38 -0800
commitb7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch)
tree0e09490075ee4f9a75a77ef4168d8ee254c52e5b /ext/pdo_odbc
parent773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff)
downloadphp-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz
trailing whitespace removal
Diffstat (limited to 'ext/pdo_odbc')
-rw-r--r--ext/pdo_odbc/odbc_driver.c14
-rw-r--r--ext/pdo_odbc/odbc_stmt.c48
-rw-r--r--ext/pdo_odbc/pdo_odbc.c2
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h10
-rw-r--r--ext/pdo_odbc/php_pdo_odbc_int.h2
5 files changed, 38 insertions, 38 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 4b9bd24818..378bf95c94 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -159,7 +159,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_l
* we want PDO to rewrite them for us */
stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len);
-
+
if (ret == 1) {
/* query was re-written */
sql = nsql;
@@ -169,7 +169,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_l
efree(S);
return 0;
}
-
+
rc = SQLAllocHandle(SQL_HANDLE_STMT, H->dbc, &S->stmt);
if (rc == SQL_INVALID_HANDLE || rc == SQL_ERROR) {
@@ -193,7 +193,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_l
return 0;
}
}
-
+
rc = SQLPrepare(S->stmt, (char*)sql, SQL_NTS);
if (nsql) {
efree(nsql);
@@ -226,7 +226,7 @@ static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql
RETCODE rc;
SQLLEN row_count = -1;
PDO_ODBC_HSTMT stmt;
-
+
rc = SQLAllocHandle(SQL_HANDLE_STMT, H->dbc, &stmt);
if (rc != SQL_SUCCESS) {
pdo_odbc_drv_error("SQLAllocHandle: STMT");
@@ -398,7 +398,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
H = pecalloc(1, sizeof(*H), dbh->is_persistent);
dbh->driver_data = H;
-
+
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &H->env);
rc = SQLSetEnvAttr(H->env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
@@ -416,7 +416,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
}
}
#endif
-
+
rc = SQLAllocHandle(SQL_HANDLE_DBC, H->env, &H->dbc);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
pdo_odbc_drv_error("SQLAllocHandle (DBC)");
@@ -469,7 +469,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
dbh->methods = &odbc_methods;
dbh->alloc_own_columns = 1;
-
+
return 1;
fail:
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 9b73cd5ef9..729f818094 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -57,7 +57,7 @@ static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype)
}
}
-static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
+static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
zend_ulong buflen, zend_ulong *outlen)
{
#ifdef PHP_WIN32
@@ -77,7 +77,7 @@ static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
S->convbufsize = ret + sizeof(WCHAR);
S->convbuf = erealloc(S->convbuf, S->convbufsize);
}
-
+
ret = MultiByteToWideChar(CP_UTF8, 0, buf, buflen, (LPWSTR)S->convbuf, S->convbufsize / sizeof(WCHAR));
if (ret == 0) {
/*printf("%s:%d %d [%d] %.*s\n", __FILE__, __LINE__, GetLastError(), buflen, buflen, buf);*/
@@ -92,7 +92,7 @@ static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
return PDO_ODBC_CONV_NOT_REQUIRED;
}
-static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf,
+static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf,
zend_ulong buflen, zend_ulong *outlen)
{
#ifdef PHP_WIN32
@@ -109,7 +109,7 @@ static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf,
S->convbufsize = ret + 1;
S->convbuf = erealloc(S->convbuf, S->convbufsize);
}
-
+
ret = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)buf, buflen/sizeof(WCHAR), S->convbuf, S->convbufsize, NULL, NULL);
if (ret == 0) {
return PDO_ODBC_CONV_FAIL;
@@ -169,8 +169,8 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt)
if (stmt->executed) {
SQLCloseCursor(S->stmt);
}
-
- rc = SQLExecute(S->stmt);
+
+ rc = SQLExecute(S->stmt);
while (rc == SQL_NEED_DATA) {
struct pdo_bound_param_data *param;
@@ -181,7 +181,7 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt)
int len;
pdo_odbc_param *P;
zval *parameter;
-
+
P = (pdo_odbc_param*)param->driver_data;
if (Z_ISREF(param->parameter)) {
parameter = Z_REFVAL(param->parameter);
@@ -193,7 +193,7 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt)
zend_ulong ulen;
convert_to_string(parameter);
- switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode,
+ switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode,
Z_STRVAL_P(parameter),
Z_STRLEN_P(parameter),
&ulen)) {
@@ -288,7 +288,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
SQLULEN precision = 0;
pdo_odbc_param *P;
zval *parameter;
-
+
/* we're only interested in parameters for prepared SQL right now */
if (param->is_param) {
@@ -315,7 +315,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
case PDO_PARAM_STMT:
return 0;
-
+
default:
break;
}
@@ -360,7 +360,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
} else {
P->paramtype = SQL_PARAM_OUTPUT;
}
-
+
if (P->paramtype != SQL_PARAM_INPUT) {
if (PDO_PARAM_TYPE(param->param_type) != PDO_PARAM_NULL) {
/* need an explicit buffer to hold result */
@@ -371,7 +371,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
P->outbuf = emalloc(P->len + (P->is_unicode ? 2:1));
}
}
-
+
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB && P->paramtype != SQL_PARAM_INPUT) {
pdo_odbc_stmt_error("Can't bind a lob for output");
return 0;
@@ -379,13 +379,13 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
rc = SQLBindParameter(S->stmt, (SQLUSMALLINT) param->paramno+1,
P->paramtype, ctype, sqltype, precision, scale,
- P->paramtype == SQL_PARAM_INPUT ?
+ P->paramtype == SQL_PARAM_INPUT ?
(SQLPOINTER)param :
P->outbuf,
P->len,
&P->len
);
-
+
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
return 1;
}
@@ -478,7 +478,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
}
}
return 1;
-
+
case PDO_PARAM_EVT_EXEC_POST:
P = param->driver_data;
@@ -511,7 +511,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
srclen = ulen;
break;
}
-
+
ZVAL_NEW_STR(parameter, zend_string_alloc(srclen, 0));
memcpy(Z_STRVAL_P(parameter), srcbuf, srclen);
Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0';
@@ -537,7 +537,7 @@ static int odbc_stmt_fetch(pdo_stmt_t *stmt,
case PDO_FETCH_ORI_LAST: odbcori = SQL_FETCH_LAST; break;
case PDO_FETCH_ORI_ABS: odbcori = SQL_FETCH_ABSOLUTE; break;
case PDO_FETCH_ORI_REL: odbcori = SQL_FETCH_RELATIVE; break;
- default:
+ default:
strcpy(stmt->error_code, "HY106");
return 0;
}
@@ -655,10 +655,10 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong
if (rc == SQL_SUCCESS_WITH_INFO) {
/* this is a 'long column'
-
+
read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks
in order into the output buffer
-
+
this loop has to work whether or not SQLGetData() provides the total column length.
calling SQLDescribeCol() or other, specifically to get the column length, then doing a single read
for that size would be slower except maybe for extremely long columns.*/
@@ -667,12 +667,12 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong
buf2 = emalloc(256);
buf = estrndup(C->data, 256);
used = 255; /* not 256; the driver NUL terminated the buffer */
-
+
do {
C->fetched_len = 0;
/* read block. 256 bytes => 255 bytes are actually read, the last 1 is NULL */
rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len);
-
+
/* resize output buffer and reassemble block */
if (rc==SQL_SUCCESS_WITH_INFO) {
/* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx
@@ -689,11 +689,11 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong
/* includes SQL_NO_DATA */
break;
}
-
+
} while (1);
-
+
efree(buf2);
-
+
/* NULL terminate the buffer once, when finished, for use with the rest of PHP */
buf[used] = '\0';
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 21dd0e0ce5..144f318ac7 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -141,7 +141,7 @@ PHP_MINIT_FUNCTION(pdo_odbc)
REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED);
REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER);
REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC);
-
+
return SUCCESS;
}
/* }}} */
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index 776c373c24..4cca0b494d 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -34,9 +34,9 @@ PHP_RINIT_FUNCTION(pdo_odbc);
PHP_RSHUTDOWN_FUNCTION(pdo_odbc);
PHP_MINFO_FUNCTION(pdo_odbc);
-/*
+/*
Declare any global variables you may need between the BEGIN
- and END macros here:
+ and END macros here:
ZEND_BEGIN_MODULE_GLOBALS(pdo_odbc)
long global_value;
@@ -44,12 +44,12 @@ ZEND_BEGIN_MODULE_GLOBALS(pdo_odbc)
ZEND_END_MODULE_GLOBALS(pdo_odbc)
*/
-/* In every utility function you add that needs to use variables
- in php_pdo_odbc_globals, call TSRMLS_FETCH(); after declaring other
+/* In every utility function you add that needs to use variables
+ in php_pdo_odbc_globals, call TSRMLS_FETCH(); after declaring other
variables used by that function, or better yet, pass in
after the last function argument and declare your utility function
with after the last declared argument. Always refer to
- the globals in your function as PDO_ODBC_G(variable). You are
+ the globals in your function as PDO_ODBC_G(variable). You are
encouraged to rename these macros something shorter, see
examples in any other php module directory.
*/
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index bfa83016c9..2098c7c1bc 100644
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -163,7 +163,7 @@ typedef struct {
unsigned is_unicode:1;
unsigned _spare:31;
} pdo_odbc_param;
-
+
extern pdo_driver_t pdo_odbc_driver;
extern struct pdo_stmt_methods odbc_stmt_methods;