diff options
| author | Damien Regad <dregad@mantisbt.org> | 2015-05-14 04:10:04 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2015-06-25 01:34:04 +0200 |
| commit | 719348d3ba11ffbfa79720ae5a5e3760c4a3644d (patch) | |
| tree | db830fa825266f598975917c7845aa40fef92958 /drivers/adodb-postgres7.inc.php | |
| parent | e887d2d29a83c52caf870355d78a4f683ca9f363 (diff) | |
| download | adodb-719348d3ba11ffbfa79720ae5a5e3760c4a3644d.tar.gz adodb-719348d3ba11ffbfa79720ae5a5e3760c4a3644d.tar.bz2 adodb-719348d3ba11ffbfa79720ae5a5e3760c4a3644d.zip | |
New method ADORecordSet::AssocCaseConvertFunction()
- Avoid code duplication
- optimize ADORecordSet_assoc_postgres7::_updatefields()
Diffstat (limited to 'drivers/adodb-postgres7.inc.php')
| -rw-r--r-- | drivers/adodb-postgres7.inc.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php index 5a975797..2ff70157 100644 --- a/drivers/adodb-postgres7.inc.php +++ b/drivers/adodb-postgres7.inc.php @@ -358,22 +358,25 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{ return (is_array($this->fields)); } - // Create associative array + /** + * Convert case of field names associative array, if needed + * @return void + */ function _updatefields() { - if (ADODB_ASSOC_CASE == 2) return; // native + $fn_change_case = $this->AssocCaseConvertFunction(); + if(!$fn_change_case) { + // No conversion needed + return; + } $arr = array(); - $lowercase = (ADODB_ASSOC_CASE == 0); foreach($this->fields as $k => $v) { - if (is_integer($k)) $arr[$k] = $v; - else { - if ($lowercase) - $arr[strtolower($k)] = $v; - else - $arr[strtoupper($k)] = $v; + if (!is_integer($k)) { + $k = $fn_change_case($k); } + $arr[$k] = $v; } $this->fields = $arr; } |
