Skip to content

Commit

Permalink
pgsql optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Dec 6, 2008
1 parent 0e319c5 commit 3c4dd16
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions core/database_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,22 @@ function db_fetch_array( &$p_result ) {
return $t_array;
} else {
$t_row = $p_result->GetRowAssoc( false );
static $t_array_result;
static $t_array_fields;

if ($t_array_result != $p_result) {
$t_array_result = $p_result;
$t_array_fields = null;
}

for( $i = 0;$i < $p_result->FieldCount();$i++ ) {
$t_field = $p_result->FetchField( $i );
$t_fieldcount = $p_result->FieldCount();
for( $i = 0; $i < $t_fieldcount; $i++ ) {
if (isset( $t_array_fields[$i] ) ) {
$t_field = $t_array_fields[$i];
} else {
$t_field = $p_result->FetchField( $i );
$t_array_fields[$i] = $t_field;
}
switch( $t_field->type ) {
case 'bool':
switch( $t_row[$t_field->name] ) {
Expand Down

0 comments on commit 3c4dd16

Please sign in to comment.