Changeset 4886 for trunk/include/dblayer/functions_pgsql.inc.php
- Timestamp:
- Feb 13, 2010, 10:27:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/dblayer/functions_pgsql.inc.php
r4833 r4886 71 71 global $conf,$page,$debug,$t2; 72 72 73 $replace_pattern = '`REPLACE INTO\s(\S*)\s*([^)]*\))\s*VALUES\(([^,]*),(.*)\)\s*`mi'; 74 73 75 $start = get_moment(); 74 ($result = pg_query($query)) or die($query."\n<br>".pg_last_error()); 76 77 if (preg_match($replace_pattern, $query, $matches) 78 && $matches[1]==SESSIONS_TABLE) 79 { 80 $select_query = ' 81 SELECT id FROM '.$matches[1].' 82 WHERE id='.$matches[3]; 83 ( $result = pg_query($select_query)) or die($query."\n<br>".pg_last_error()); 84 if (pwg_db_num_rows($result)==1) 85 { 86 $query = ' 87 UPDATE '.$matches[1].' 88 SET expiration=now() 89 WHERE id='.$matches[3]; 90 } 91 else 92 { 93 $query = ' 94 INSERT INTO '.$matches[1].' 95 '.$matches[2].' VALUES('.$matches[3].','.$matches[4].')'; 96 } 97 ( $result = pg_query($query)) or die($query."\n<br>".pg_last_error()); 98 } 99 else 100 { 101 ($result = pg_query($query)) or die($query."\n<br>".pg_last_error()); 102 } 75 103 76 104 $time = get_moment() - $start;
Note: See TracChangeset
for help on using the changeset viewer.