mirror of
https://github.com/php/php-src.git
synced 2025-01-09 20:44:33 +08:00
- Fix bug #38805 ( PDO Truncates Text from SQL Server Text Data Type Field)
- Bring behaviour into line with ext/mssql - Several memleaks plugged
This commit is contained in:
parent
efd9d3482d
commit
1abe544f41
@ -229,7 +229,11 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
if (H->link == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
if (DBSETOPT(H->link, DBTEXTLIMIT, "2147483647") == FAIL) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -113,18 +113,27 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
|
||||
stmt->column_count = S->ncols;
|
||||
|
||||
for (i = 0, j = 0; i < S->ncols; i++) {
|
||||
char *tmp = NULL;
|
||||
|
||||
S->cols[i].coltype = dbcoltype(H->link, i+1);
|
||||
S->cols[i].name = dbcolname(H->link, i+1);
|
||||
if (S->cols[i].name) {
|
||||
S->cols[i].name = estrdup(S->cols[i].name);
|
||||
} else if (j) {
|
||||
spprintf(&S->cols[i].name, 0, "computed%d", j++);
|
||||
} else {
|
||||
S->cols[i].name = estrdup("computed");
|
||||
j++;
|
||||
S->cols[i].name = (char*)dbcolname(H->link, i+1);
|
||||
|
||||
if (!strlen(S->cols[i].name)) {
|
||||
if (j) {
|
||||
spprintf(&tmp, 0, "computed%d", j++);
|
||||
strlcpy(S->cols[i].name, tmp, strlen(tmp)+1);
|
||||
efree(tmp);
|
||||
} else {
|
||||
S->cols[i].name = "computed";
|
||||
j++;
|
||||
}
|
||||
}
|
||||
S->cols[i].source = dbcolsource(H->link, i+1);
|
||||
S->cols[i].source = estrdup(S->cols[i].source ? S->cols[i].source : "");
|
||||
|
||||
S->cols[i].source = (char*)dbcolsource(H->link, i+1);
|
||||
tmp = estrdup(S->cols[i].source ? S->cols[i].source : "");
|
||||
S->cols[i].source = tmp;
|
||||
efree(tmp);
|
||||
|
||||
S->cols[i].maxlen = dbcollen(H->link, i+1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user