summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib
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_dblib
parent773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff)
downloadphp-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz
trailing whitespace removal
Diffstat (limited to 'ext/pdo_dblib')
-rw-r--r--ext/pdo_dblib/dblib_driver.c64
-rw-r--r--ext/pdo_dblib/dblib_stmt.c80
-rw-r--r--ext/pdo_dblib/pdo_dblib.c8
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h2
4 files changed, 77 insertions, 77 deletions
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index c664ce8c40..23b716369b 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -96,7 +96,7 @@ static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
pdo_dblib_stmt *S = ecalloc(1, sizeof(*S));
-
+
S->H = H;
stmt->driver_data = S;
stmt->methods = &dblib_stmt_methods;
@@ -120,7 +120,7 @@ static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq
if (FAIL == dbsqlexec(H->link)) {
return -1;
}
-
+
resret = dbresults(H->link);
if (resret == FAIL) {
@@ -150,9 +150,9 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
int i;
char * q;
*quotedlen = 0;
-
- /*
- * Detect quoted length and if we should use binary encoding
+
+ /*
+ * Detect quoted length and if we should use binary encoding
*/
for(i=0;i<unquotedlen;i++) {
if( 32 > unquoted[i] || 127 < unquoted[i] ) {
@@ -162,13 +162,13 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
if(unquoted[i] == '\'') ++*quotedlen;
++*quotedlen;
}
-
+
if(useBinaryEncoding) {
- /*
- * Binary safe quoting
+ /*
+ * Binary safe quoting
* Will implicitly convert for all data types except Text, DateTime & SmallDateTime
- *
- */
+ *
+ */
*quotedlen = (unquotedlen * 2) + 2; /* 2 chars per byte +2 for "0x" prefix */
q = *quoted = emalloc(*quotedlen);
@@ -196,22 +196,22 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
}
*q = 0;
-
+
return 1;
}
static int pdo_dblib_transaction_cmd(const char *cmd, pdo_dbh_t *dbh)
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
-
+
if (FAIL == dbcmd(H->link, cmd)) {
return 0;
}
-
+
if (FAIL == dbsqlexec(H->link)) {
return 0;
}
-
+
return 1;
}
@@ -230,25 +230,25 @@ static int dblib_handle_rollback(pdo_dbh_t *dbh)
return pdo_dblib_transaction_cmd("ROLLBACK TRANSACTION", dbh);
}
-char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len)
+char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len)
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
RETCODE ret;
char *id = NULL;
- /*
+ /*
* Would use scope_identity() but it's not implemented on Sybase
*/
-
+
if (FAIL == dbcmd(H->link, "SELECT @@IDENTITY")) {
return NULL;
}
-
+
if (FAIL == dbsqlexec(H->link)) {
return NULL;
}
-
+
ret = dbresults(H->link);
if (ret == FAIL || ret == NO_MORE_RESULTS) {
dbcancel(H->link);
@@ -256,7 +256,7 @@ char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len)
}
ret = dbnextrow(H->link);
-
+
if (ret == FAIL || ret == NO_MORE_ROWS) {
dbcancel(H->link);
return NULL;
@@ -269,7 +269,7 @@ char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len)
id = emalloc(32);
*len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
-
+
dbcancel(H->link);
return id;
}
@@ -313,7 +313,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
{
pdo_dblib_db_handle *H;
int i, nvars, nvers, ret = 0;
-
+
const pdo_dblib_keyval tdsver[] = {
{"4.2",DBVERSION_42}
,{"4.6",DBVERSION_46}
@@ -329,11 +329,11 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
#endif
,{"10.0",DBVERSION_100}
,{"auto",0} /* Only works with FreeTDS. Other drivers will bork */
-
+
};
-
+
nvers = sizeof(tdsver)/sizeof(tdsver[0]);
-
+
struct pdo_data_src_parser vars[] = {
{ "charset", NULL, 0 }
,{ "appname", "PHP " PDO_DBLIB_FLAVOUR, 0 }
@@ -342,9 +342,9 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
,{ "secure", NULL, 0 } /* DBSETLSECURE */
,{ "version", NULL, 0 } /* DBSETLVERSION */
};
-
+
nvars = sizeof(vars)/sizeof(vars[0]);
-
+
php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, nvars);
if (driver_options) {
@@ -363,21 +363,21 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
DBERRHANDLE(H->login, (EHANDLEFUNC) pdo_dblib_error_handler);
DBMSGHANDLE(H->login, (MHANDLEFUNC) pdo_dblib_msg_handler);
-
+
if(vars[5].optval) {
for(i=0;i<nvers;i++) {
if(strcmp(vars[5].optval,tdsver[i].key) == 0) {
if(FAIL==dbsetlversion(H->login, tdsver[i].value)) {
- pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Failed to set version specified in connection string.");
+ pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Failed to set version specified in connection string.");
goto cleanup;
}
break;
}
}
-
+
if (i==nvers) {
printf("Invalid version '%s'\n", vars[5].optval);
- pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Invalid version specified in connection string.");
+ pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Invalid version specified in connection string.");
goto cleanup; /* unknown version specified */
}
}
@@ -393,7 +393,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
goto cleanup;
}
}
-
+
#if !PHP_DBLIB_IS_MSSQL
if (vars[0].optval) {
DBSETLCHARSET(H->login, vars[0].optval);
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index a4552d4f57..bd74320b32 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -35,20 +35,20 @@
/* {{{ pdo_dblib_get_field_name
- *
+ *
* Return the data type name for a given TDS number
- *
+ *
*/
static char *pdo_dblib_get_field_name(int type)
{
- /*
- * I don't return dbprtype(type) because it does not fully describe the type
+ /*
+ * I don't return dbprtype(type) because it does not fully describe the type
* (example: varchar is reported as char by dbprtype)
- *
+ *
* FIX ME: Cache datatypes from server systypes table in pdo_dblib_handle_factory()
* to make this future proof.
*/
-
+
switch (type) {
case 31: return "nvarchar";
case 34: return "image";
@@ -102,16 +102,16 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt)
/* Cancel any pending results */
dbcancel(H->link);
-
+
return 1;
}
static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
-
+
efree(S);
-
+
return 1;
}
@@ -120,21 +120,21 @@ static int pdo_dblib_stmt_next_rowset(pdo_stmt_t *stmt)
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
RETCODE ret;
-
+
ret = dbresults(H->link);
if (FAIL == ret) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbresults() returned FAIL");
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbresults() returned FAIL");
return 0;
}
-
+
if(NO_MORE_RESULTS == ret) {
return 0;
}
-
+
stmt->row_count = DBCOUNT(H->link);
stmt->column_count = dbnumcols(H->link);
-
+
return 1;
}
@@ -143,89 +143,89 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt)
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
RETCODE ret;
-
+
dbsetuserdata(H->link, (BYTE*) &S->err);
-
+
pdo_dblib_stmt_cursor_closer(stmt);
-
+
if (FAIL == dbcmd(H->link, stmt->active_query_string)) {
return 0;
}
-
+
if (FAIL == dbsqlexec(H->link)) {
return 0;
}
-
+
ret = pdo_dblib_stmt_next_rowset(stmt);
-
+
stmt->row_count = DBCOUNT(H->link);
stmt->column_count = dbnumcols(H->link);
-
+
return 1;
}
static int pdo_dblib_stmt_fetch(pdo_stmt_t *stmt,
enum pdo_fetch_orientation ori, zend_long offset)
{
-
+
RETCODE ret;
-
+
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
-
+
ret = dbnextrow(H->link);
-
+
if (FAIL == ret) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbnextrow() returned FAIL");
return 0;
}
-
+
if(NO_MORE_ROWS == ret) {
return 0;
}
-
- return 1;
+
+ return 1;
}
static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
-
+
if(colno >= stmt->column_count || colno < 0) {
return FAILURE;
}
-
+
struct pdo_column_data *col = &stmt->columns[colno];
-
+
col->name = estrdup(dbcolname(H->link, colno+1));
col->maxlen = dbcollen(H->link, colno+1);
col->namelen = strlen(col->name);
col->param_type = PDO_PARAM_STR;
-
+
return 1;
}
static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
zend_ulong *len, int *caller_frees)
{
-
+
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
-
+
int coltype;
unsigned int tmp_len;
char *tmp_ptr = NULL;
-
+
coltype = dbcoltype(H->link, colno+1);
-
+
*len = dbdatlen(H->link, colno+1);
*ptr = dbdata(H->link, colno+1);
-
+
if (*len == 0 && *ptr == NULL) {
return 1;
}
-
+
switch (coltype) {
case SQLVARBINARY:
case SQLBINARY:
@@ -293,9 +293,9 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zva
array_init(return_value);
dbtypeinfo = dbcoltypeinfo(H->link, colno+1);
-
+
if(!dbtypeinfo) return FAILURE;
-
+
add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) );
add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision );
add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale );
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 7f38396e17..52d45945ee 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -97,12 +97,12 @@ int pdo_dblib_error_handler(DBPROCESS *dbproc, int severity, int dberr,
if (!einfo) einfo = &DBLIB_G(err);
} else {
einfo = &DBLIB_G(err);
- }
+ }
einfo->severity = severity;
einfo->oserr = oserr;
einfo->dberr = dberr;
-
+
if (einfo->oserrstr) {
efree(einfo->oserrstr);
}
@@ -180,11 +180,11 @@ PHP_MINIT_FUNCTION(pdo_dblib)
if (FAIL == dbinit()) {
return FAILURE;
}
-
+
if (FAILURE == php_pdo_register_driver(&pdo_dblib_driver)) {
return FAILURE;
}
-
+
#if !PHP_DBLIB_IS_MSSQL
dberrhandle((EHANDLEFUNC) pdo_dblib_error_handler);
dbmsghandle((MHANDLEFUNC) pdo_dblib_msg_handler);
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index 3b341478d7..a6f282474f 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -71,7 +71,7 @@
# define SQLVARBINARY SYBVARBINARY
# ifdef SYBUNIQUE
# define SQLUNIQUE SYBUNIQUE
-#else
+#else
# define SQLUNIQUE 36 /* FreeTDS Hack */
# endif