// Removing all numeric/integer keys.
// A workaround because in ADOdb we would need to know what we want before executing the query...
+ // MSSQL does not support ADODB_FETCH_BOTH and always returns an assoc. array instead. So
+ // we don't need to remove anything.
if (is_array($output)) {
- foreach ($output as $key => $value) {
- if (is_integer($key)) {
- unset($output[$key]);
+ if ($this->runningADOdbDriver('mssql')) {
+ // MSSQL does not know such thing as an empty string. So it returns one space instead, which we must fix.
+ foreach ($output as $key => $value) {
+ if ($value === ' ') {
+ $output[$key] = '';
+ }
+ }
+ } else {
+ foreach ($output as $key => $value) {
+ if (is_integer($key)) {
+ unset($output[$key]);
+ }
}
- elseif ($value === ' ' && $this->runningADOdbDriver('mssql')) $output[$key] = ''; // MSSQL does not know such thing as an empty string. So it returns one space instead, which we must fix.
}
}
}
// Removing all assoc. keys.
// A workaround because in ADOdb we would need to know what we want before executing the query...
+ // MSSQL does not support ADODB_FETCH_BOTH and always returns an assoc. array instead. So
+ // we need to convert resultset.
if (is_array($output)) {
+ $keyIndex = 0;
foreach ($output as $key => $value) {
- if (!is_integer($key)) unset($output[$key]);
- elseif ($value === ' ' && $this->runningADOdbDriver('mssql')) $output[$key] = ''; // MSSQL does not know such thing as an empty string. So it returns one space instead, which we must fix.
+ unset($output[$key]);
+ if (is_integer($key) || $this->runningADOdbDriver('mssql')) {
+ $output[$keyIndex] = $value;
+ if ($value === ' ') {
+ // MSSQL does not know such thing as an empty string. So it returns one space instead, which we must fix.
+ $output[$keyIndex] = '';
+ }
+ $keyIndex++;
+ }
}
}
}