From baeda9dea2639a9f717c6e851ee57be58f92f6f6 Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Wed, 1 Nov 2017 16:12:57 +0000 Subject: transactions fixed to speed up --- src/db.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/db.php') diff --git a/src/db.php b/src/db.php index 2f6dd57..5948186 100644 --- a/src/db.php +++ b/src/db.php @@ -33,28 +33,28 @@ function DB_lo_open($conn, $file, $mode) { else return pg_lo_open ($conn, $file, $mode); } -function DB_lo_read_tobrowser($contest,$id) { - $str = DB_lo_read($contest,$id); - echo $str; - return true; +function DB_lo_read_tobrowser($contest,$id,$c=null) { + $str = DB_lo_read($contest,$id,-1,$c); + echo $str; + return true; } -function DB_lo_read($contest,$id,$s=-1) { +function DB_lo_read($contest,$id,$s=-1,$c=null) { if (strcmp(phpversion(),'4.2.0')<0) { if($s<0) { $str=''; - while (($buf = pg_loread ($id, 100000)) != false) $str .= $buf; + while (($buf = pg_loread ($id, 1000000)) != false) $str .= $buf; } else $str = pg_loread ($id, $s); } else { if($s<0) { $str=''; - while (($buf = pg_lo_read ($id, 100000)) != false) $str .= $buf; + while (($buf = pg_lo_read ($id, 1000000)) != false) $str .= $buf; } else $str = pg_lo_read ($id, $s); } - if(($str2 = DB_unlock($contest,$str))===false) return $str; + if(($str2 = DB_unlock($contest,$str,$c))===false) return $str; return $str2; } function DB_unlock($contest,$str,$c=null) { @@ -296,7 +296,7 @@ function DBcrc($contest,$id, $c=null) { // just to return a unique string that will not match any other... return "no-HASH-" . rand() . "-" . rand() . "-" . time(); } - $str = DB_lo_read($contest,$f); + $str = DB_lo_read($contest,$f,-1,$c); DB_lo_close($f); if($docommit) DBExec($c, "commit work", "DBcrc(commit)"); -- cgit v1.2.3