Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv23030 Modified Files: acquisition.inc.php array.inc.php array_batch.phtml basefile.inc.php bio.inc.php bioassay.inc.php bioassayset.inc.php db.inc.php eventlog.inc.php experiment.inc.php gene_explore.phtml genelist.inc.php hyb.inc.php hyb_result.phtml image.inc.php item.inc.php job.inc.php left.phtml molecule.inc.php newinit.inc.php news.inc.php plate.inc.php plot.inc.php program.inc.php protocol.inc.php raw.inc.php sampleannotation.inc.php sampletissue.inc.php search.inc.php session.inc.php test.phtml transformation.inc.php upload.inc.php user.inc.php ware.inc.php wizzzard.inc.php Added Files: mysql.inc.php Log Message: First steps towards RDBMS independence. Added API for things like LOAD DATA INFILE, REPLACE, LIMIT etc. --- NEW FILE: mysql.inc.php --- <? // $Id: mysql.inc.php,v 1.1 2002/09/07 11:36:32 troein Exp $ // // BioArray Software Environment (BASE) - homepage http://base.thep.lu.se/ // Copyright (C) 2002 Lao Saal, Carl Troein, Johan Vallon-Christersson (LSCTJVC) // // Write to LSCTJVC, Dept. of Oncology, Lund University Hospital, // Klinikgatan 7, SE-22185, Lund, Sweden. // // This file is part of BASE. // // BASE is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // BASE is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [...202 lines suppressed...] { error_log("Name of table '$from' not found in SHOW CREATE TABLE"); return false; } $tmp = $temporary ? "TEMPORARY" : ""; $query = ereg_replace("CREATE TABLE `?$from`?(.*)\$", "CREATE $tmp TABLE $to\\1", $row[1]); return (bool)query($query); } // This function drops a table quietly. It exists because we want to use // persistent connections and we might come across temporary tables that // haven't been deleted because of script errors. function db_table_drop($table) { $query = "DROP TABLE IF EXISTS $table"; return (bool)query($query); } ?> Index: acquisition.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/acquisition.inc.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** acquisition.inc.php 29 Aug 2002 16:51:32 -0000 1.11 --- acquisition.inc.php 7 Sep 2002 11:36:31 -0000 1.12 *************** *** 75,79 **** $query = "DELETE FROM ImageAcquisition ". "WHERE id = $this->id AND scanner = 0"; ! if(!query($query) || mysql_affected_rows() != 1) return false; @unlink("$config[rawImageDir]/$this->owner/$this->id"); --- 75,79 ---- $query = "DELETE FROM ImageAcquisition ". "WHERE id = $this->id AND scanner = 0"; ! if(!query($query) || db_affected_rows() != 1) return false; @unlink("$config[rawImageDir]/$this->owner/$this->id"); *************** *** 102,106 **** $res = query($query); $rc = true; ! while($row = mysql_fetch_row($res)) if(!Image::removeId($row[0])) $rc = false; return $rc; --- 102,106 ---- $res = query($query); $rc = true; ! while($row =& db_fetch_row($res)) if(!Image::removeId($row[0])) $rc = false; return $rc; *************** *** 137,141 **** $query = "UPDATE ImageAcquisition SET scanner = $val ". "WHERE id = $this->id AND scanner = $this->scanner"; ! if(query($query) && mysql_affected_rows() > 0) { if($this->scanner) Hardware::unlockId($this->scanner, false); --- 137,141 ---- $query = "UPDATE ImageAcquisition SET scanner = $val ". "WHERE id = $this->id AND scanner = $this->scanner"; ! if(query($query) && db_affected_rows() > 0) { if($this->scanner) Hardware::unlockId($this->scanner, false); *************** *** 162,166 **** $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row = mysql_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); --- 162,167 ---- $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) ! $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 187,192 **** "GROUP BY ia.id $ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) return $arr; ! while($row = mysql_fetch_array($res)) $arr[] = $row; return $arr; } --- 188,195 ---- "GROUP BY ia.id $ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) ! return $arr; ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } *************** *** 197,201 **** "WHERE hybridization = ".(int)$hyb; $res = query($query); ! if($row = mysql_fetch_array($res)) return $row[0]; return 0; } --- 200,205 ---- "WHERE hybridization = ".(int)$hyb; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; return 0; } Index: array.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/array.inc.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** array.inc.php 29 Aug 2002 16:51:33 -0000 1.31 --- array.inc.php 7 Sep 2002 11:36:31 -0000 1.32 *************** *** 69,76 **** } function remove() { $query = "DELETE FROM ArrayType WHERE id = $this->id"; ! if(!query($query) || mysql_affected_rows() < 1) return false; $query = "DELETE FROM ArrayTypePlate WHERE arrayType = $this->id"; query($query); --- 69,81 ---- } [...625 lines suppressed...] $res = query($query); ! if($row =& db_fetch_row($res)) ! $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 916,920 **** $arr = array(); $res = query($query); ! while($row = mysql_fetch_assoc($res)) $arr[] = $row; return $arr; } --- 947,952 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } Index: array_batch.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/array_batch.phtml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** array_batch.phtml 29 Aug 2002 16:51:33 -0000 1.17 --- array_batch.phtml 7 Sep 2002 11:36:31 -0000 1.18 *************** *** 87,91 **** { if($curDb->dupKey()) $errs[$pos] = ! "Barcode (or position) already in use"; else $errs[$pos] = "Unable to save array"; } --- 87,91 ---- { if($curDb->dupKey()) $errs[$pos] = ! "Barcode already in use"; else $errs[$pos] = "Unable to save array"; } Index: basefile.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/basefile.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** basefile.inc.php 5 Aug 2002 11:29:31 -0000 1.7 --- basefile.inc.php 7 Sep 2002 11:36:31 -0000 1.8 *************** *** 122,126 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_row($res)) $arr[(int)$row[0]] = $row[1]; return $arr; } --- 122,127 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[(int)$row[0]] = $row[1]; return $arr; } *************** *** 131,143 **** $name = addslashes($name); $query = "SELECT id FROM BaseFileSection WHERE name = '$name'"; ! if(!($res = query($query))) return 0; ! if($row = mysql_fetch_row($res)) return $row[0]; ! if(!$add) return 0; ! $query2 = "INSERT INTO BaseFileSection (name) VALUES ('$name')"; ! if(query($query2)) ! return mysql_insert_id(); // Remove race condition $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return 0; } --- 132,150 ---- $name = addslashes($name); $query = "SELECT id FROM BaseFileSection WHERE name = '$name'"; ! if(!($res = query($query))) ! return 0; ! if($row =& db_fetch_row($res)) ! return $row[0]; ! if(!$add) ! return 0; ! $names = array("name"); ! $values = array($name); ! $id = db_insert("BaseFileSection", $names, $values); ! if($id) ! return $id; // Remove race condition $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; return 0; } *************** *** 147,151 **** $query = "SELECT name FROM BaseFileSection WHERE id = ".(int)$id; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return ""; } --- 154,159 ---- $query = "SELECT name FROM BaseFileSection WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; return ""; } Index: bio.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bio.inc.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** bio.inc.php 29 Aug 2002 16:51:33 -0000 1.16 --- bio.inc.php 7 Sep 2002 11:36:31 -0000 1.17 *************** *** 26,41 **** // require_once("item.inc.php"); ! require_once("project.inc.php"); class Sample extends Item { ! var $tissue, $project; function Sample($name = "", $descr = "", $owner = 0, $addedDate = "", ! $tissue = 0, $project = 0, $id = 0, $visible = 0) [...385 lines suppressed...] ! if(!($res = query($query))) ! return $arr; ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } *************** *** 731,735 **** $query = "SELECT COUNT(*) FROM LabeledExtract WHERE extract = $extract"; $res = query($query); ! if($row = mysql_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; return $cnt; --- 742,747 ---- $query = "SELECT COUNT(*) FROM LabeledExtract WHERE extract = $extract"; $res = query($query); ! if($row =& db_fetch_row($res)) ! $cnt = $row[0]; else $cnt = 0; return $cnt; Index: bioassay.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bioassay.inc.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** bioassay.inc.php 29 Aug 2002 16:51:33 -0000 1.29 --- bioassay.inc.php 7 Sep 2002 11:36:31 -0000 1.30 *************** *** 72,76 **** $query = "DELETE FROM BioAssay WHERE id = $this->id"; ! if(!query($query) || mysql_affected_rows() <= 0) return false; $query = "DELETE FROM $config[dbDynamic].BioAssayData$this->experiment ". --- 72,77 ---- $query = "DELETE FROM BioAssay WHERE id = $this->id"; ! if(!query($query) || db_affected_rows() != 1) ! return false; [...269 lines suppressed...] } --- 953,957 ---- $query = "SELECT rawBioAssay FROM BioAssay WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return false; } *************** *** 1034,1038 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_row($res)) $arr[] = $row; return $arr; --- 1043,1047 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[] = $row; return $arr; Index: bioassayset.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bioassayset.inc.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** bioassayset.inc.php 29 Aug 2002 16:51:33 -0000 1.23 --- bioassayset.inc.php 7 Sep 2002 11:36:31 -0000 1.24 *************** *** 82,86 **** $rc = true; if(!($res = query($query))) $rc = false; ! while($row = mysql_fetch_row($res)) if(!BioAssay::removeId($row[0])) $rc = false; if(!$rc) return false; --- 82,86 ---- $rc = true; if(!($res = query($query))) $rc = false; ! while($row =& db_fetch_row($res)) if(!BioAssay::removeId($row[0])) $rc = false; [...348 lines suppressed...] ! $key = array("bioAssaySet"); ! $kval = array($this->id); ! ! return db_update_or_insert("BioAssaySetCreation", $key, ! $kval, $names, $vals); } *************** *** 696,700 **** "WHERE bioAssaySet = $this->id"; $res = query($query); ! return mysql_fetch_assoc($res); } --- 698,702 ---- "WHERE bioAssaySet = $this->id"; $res = query($query); ! return db_fetch_assoc($res); } Index: db.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/db.inc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** db.inc.php 5 Aug 2002 11:29:31 -0000 1.9 --- db.inc.php 7 Sep 2002 11:36:32 -0000 1.10 *************** *** 25,94 **** // ! class LuDatabase ! { ! var $serv, $db; ! function LuDatabase($server, $user, $password, $database) ! { ! if($password == "") ! { ! $this->serv = mysql_pconnect($server, $user) ! or die("mysql_pconnect() failed: ".mysql_error()."\n"); ! } ! else ! { ! $this->serv = mysql_pconnect($server, $user, $password) ! or die("mysql_pconnect() failed: ".mysql_error()."\n"); ! } ! $this->db = mysql_select_db($database, $this->serv) ! or die("mysql_select_db() failed: ".mysql_error()."\n"); ! } ! ! function errorMessage() ! { ! return mysql_error(); ! } ! ! // Returns true if the last query failed because of a duplicate key ! function dupKey() ! { ! return mysql_errno() == 1062; ! } ! } ! ! function query(&$query, $quiet = 0) ! { ! // if(strpos("$query","Search"))error_log("Q: $query"); ! // if(strlen($query) < 1000 && strpos("$query"," ExpressionValue ")) ! // error_log("Q: $query"); ! // error_log("Q: $query"); ! ! $res = mysql_query($query); ! if(!$res && !$quiet) ! error_log("MySQL query failed: \"".$query."\" : ".mysql_error()); ! return $res; ! } ! ! // This function copies the table structure from table $from to ! // table $to. ! function copyTable($from, $to, $temporary = false) ! { ! $query = "SHOW CREATE TABLE $from"; ! $res = query($query); ! if(!$res) return false; ! if(!($row = mysql_fetch_row($res))) ! { ! error_log("Failed to copy table '$from': No such table(?)"); ! return false; ! } ! if(!ereg("CREATE TABLE `?$from`?", $row[1])) ! { ! error_log("Name of table '$from' not found in SHOW CREATE TABLE"); ! return false; ! } ! $tmp = $temporary ? "TEMPORARY" : ""; ! $query = ereg_replace("CREATE TABLE `?$from`?(.*)\$", ! "CREATE $tmp TABLE $to\\1", $row[1]); ! return (bool)query($query); ! } ?> --- 25,29 ---- // ! require_once("mysql.inc.php"); ?> Index: eventlog.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/eventlog.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** eventlog.inc.php 5 Aug 2002 11:29:31 -0000 1.3 --- eventlog.inc.php 7 Sep 2002 11:36:32 -0000 1.4 *************** *** 40,47 **** $query = "SELECT eventDate AS date, eventType AS type, message ". "FROM EventLog WHERE eventType='broadcast' ". ! "ORDER BY eventDate DESC LIMIT ".(int)$cnt; $res = query($query); $arr = array(); ! while($row = mysql_fetch_array($res)) $arr[] = $row; return $arr; } --- 40,48 ---- $query = "SELECT eventDate AS date, eventType AS type, message ". "FROM EventLog WHERE eventType='broadcast' ". ! "ORDER BY eventDate DESC ".db_limit(0, (int)$cnt); $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } Index: experiment.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/experiment.inc.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** experiment.inc.php 29 Aug 2002 16:51:33 -0000 1.42 --- experiment.inc.php 7 Sep 2002 11:36:32 -0000 1.43 *************** *** 87,95 **** if($rc) { ! if(!copyTable("TemplateBioAssayData", "$config[dbDynamic].BioAssayData$this->id") || ! !copyTable("TemplateBioAssaySetGene", "$config[dbDynamic].BioAssaySetGene$this->id") || ! !copyTable("TemplateBioAssaySetPosGene", "$config[dbDynamic].BioAssaySetPosGene$this->id")) { --- 87,95 ---- [...130 lines suppressed...] Experiment::unlockId($expid, false); --- 390,394 ---- $query = "DELETE FROM ExperimentRawBioAssay ". "WHERE experiment = $expid AND rawBioAssay = $rawid"; ! if(query($query) && db_affected_rows() == 1) { Experiment::unlockId($expid, false); *************** *** 408,412 **** "WHERE experiment = $this->id"; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; else return false; } --- 405,409 ---- "WHERE experiment = $this->id"; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; else return false; } Index: gene_explore.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/gene_explore.phtml,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** gene_explore.phtml 29 Aug 2002 16:51:33 -0000 1.49 --- gene_explore.phtml 7 Sep 2002 11:36:32 -0000 1.50 *************** *** 336,342 **** $gsort = $expl["subSort"]; ! if(isset($i_backend)) $expl["showBackend"] = (int)(bool)$i_backend; $showBackend = $expl["showBackend"]; ! if($gpage < 0) $showBackend = false; // Only needs to be saved if something is changed, but it's quite --- 336,344 ---- $gsort = $expl["subSort"]; [...71 lines suppressed...] $ann = "<td bgcolor=$tdbg[2]> </td>"; --- 624,628 ---- if($annot) { ! if(!isset($e["annotation"])) { $ann = "<td bgcolor=$tdbg[2]> </td>"; *************** *** 629,633 **** else { ! $v = $e["value"]; $col = $anncolors[$anncolor[$v]]; $ann = "<td bgcolor=$col>".html($v)."</td>"; --- 631,635 ---- else { ! $v = $e["annotation"]; $col = $anncolors[$anncolor[$v]]; $ann = "<td bgcolor=$col>".html($v)."</td>"; Index: genelist.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/genelist.inc.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** genelist.inc.php 29 Aug 2002 16:51:33 -0000 1.15 --- genelist.inc.php 7 Sep 2002 11:36:32 -0000 1.16 *************** *** 68,72 **** $query = "DELETE FROM GeneList WHERE id = $id ". "AND owner = ".(int)$owner; ! if(query($query) && mysql_affected_rows() > 0) { $query = "DELETE FROM GeneListGene WHERE geneList = $id"; --- 68,72 ---- $query = "DELETE FROM GeneList WHERE id = $id ". "AND owner = ".(int)$owner; ! if(query($query) && db_affected_rows() > 0) { [...196 lines suppressed...] } --- 283,287 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } *************** *** 289,293 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; } --- 295,299 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; } Index: hyb.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb.inc.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** hyb.inc.php 29 Aug 2002 16:51:33 -0000 1.16 --- hyb.inc.php 7 Sep 2002 11:36:32 -0000 1.17 *************** *** 54,58 **** $id = (int)$id; $query = "DELETE FROM Hybridization WHERE id = $id"; ! if(!query($query) || mysql_affected_rows() != 1) return false; $query = "DELETE FROM SharedHybridization WHERE item = $id"; --- 54,58 ---- $id = (int)$id; $query = "DELETE FROM Hybridization WHERE id = $id"; ! if(!query($query) || db_affected_rows() != 1) return false; [...102 lines suppressed...] } --- 263,267 ---- "WHERE ia.hybridization = $this->id AND r.imageAcquisition = ia.id"; $res = query($query); ! if($row =& db_fetch_row($res)) return($row[0]); return 0; } *************** *** 274,278 **** "WHERE hybridization = $this->id AND position = ".(int)$position; query($query); ! return mysql_affected_rows() > 0; } --- 274,278 ---- "WHERE hybridization = $this->id AND position = ".(int)$position; query($query); ! return db_affected_rows() > 0; } Index: hyb_result.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_result.phtml,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** hyb_result.phtml 29 Aug 2002 16:51:34 -0000 1.52 --- hyb_result.phtml 7 Sep 2002 11:36:32 -0000 1.53 *************** *** 494,498 **** else $idmol = array(0, $molecules[$cid]); } ! fwrite($tfd, "$rawid\t$idmol[0]\t$idmol[1]"); // Channel 2 set to 1.0 is undefined (for affy) if($arr[16] === false) --- 494,498 ---- else $idmol = array(0, $molecules[$cid]); } ! fwrite($tfd, "$rawid\t$datalines\t$idmol[0]\t$idmol[1]"); // Channel 2 set to 1.0 is undefined (for affy) if($arr[16] === false) Index: image.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/image.inc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** image.inc.php 29 Aug 2002 16:51:34 -0000 1.8 --- image.inc.php 7 Sep 2002 11:36:32 -0000 1.9 *************** *** 71,75 **** { $query = "DELETE FROM Image WHERE id = $this->id"; ! if(!query($query) || mysql_affected_rows() != 1) return false; unlink($this->getRepositoryFilename(false)); --- 71,75 ---- { $query = "DELETE FROM Image WHERE id = $this->id"; ! if(!query($query) || db_affected_rows() != 1) return false; unlink($this->getRepositoryFilename(false)); *************** *** 134,138 **** $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row = mysql_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); --- 134,138 ---- $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 154,158 **** $arr = array(); if(!($res = query($query))) return $arr; ! while($row = mysql_fetch_array($res)) $arr[] = $row; return $arr; } --- 154,158 ---- $arr = array(); if(!($res = query($query))) return $arr; ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } Index: item.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/item.inc.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** item.inc.php 29 Aug 2002 16:51:34 -0000 1.22 --- item.inc.php 7 Sep 2002 11:36:32 -0000 1.23 *************** *** 25,28 **** --- 25,29 ---- // require_once("db.inc.php"); + require_once("misc.inc.php"); class Item *************** *** 44,48 **** { $res = query($query); [...487 lines suppressed...] } $query = "UPDATE $type SET useCount = useCount - 1 ". "WHERE id = $id AND useCount > 0"; ! return query($query) && db_affected_rows() == 1; } *************** *** 441,445 **** $query = "SELECT useCount FROM $this->type WHERE id = $this->id"; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return -2; } --- 448,453 ---- $query = "SELECT useCount FROM $this->type WHERE id = $this->id"; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; return -2; } Index: job.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/job.inc.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** job.inc.php 31 Aug 2002 11:47:53 -0000 1.32 --- job.inc.php 7 Sep 2002 11:36:32 -0000 1.33 *************** *** 49,53 **** { $res = query($query); ! if(!($row = mysql_fetch_array($res))) return false; $this->id = (int)$row["id"]; --- 49,53 ---- { $res = query($query); ! if(!($row =& db_fetch_assoc($res))) return false; [...281 lines suppressed...] ! // worst thing that can happen isn't all that horrible. ! $query = "INSERT INTO JobFileSection ". "(jobFile, fileSection, sectionCount) ". "VALUES ($this->id, $section, $count)"; ! return (bool)query($query); } *************** *** 644,648 **** "WHERE jobFile = $this->id AND fileSection = ".(int)$section; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return 0; --- 654,658 ---- "WHERE jobFile = $this->id AND fileSection = ".(int)$section; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return 0; Index: left.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/left.phtml,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** left.phtml 29 Aug 2002 16:51:34 -0000 1.43 --- left.phtml 7 Sep 2002 11:36:32 -0000 1.44 *************** *** 207,211 **** >Sample annotations</a></td></tr> <tr><td><img src='img/1.gif' alt='' width=1 height=1></td></tr> ! <tr><td><a target=main href="project_list.phtml">Projects</a></td></tr> <tr><td><a target=main href="sample_list.phtml">Samples</a></td></tr> <tr><td><a target=main href="extract_list.phtml">Extracts</a></td></tr> --- 207,211 ---- >Sample annotations</a></td></tr> <tr><td><img src='img/1.gif' alt='' width=1 height=1></td></tr> ! <!-- <tr><td><a target=main href="project_list.phtml">Projects</a></td></tr> --> <tr><td><a target=main href="sample_list.phtml">Samples</a></td></tr> <tr><td><a target=main href="extract_list.phtml">Extracts</a></td></tr> Index: molecule.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/molecule.inc.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** molecule.inc.php 20 Aug 2002 17:38:37 -0000 1.25 --- molecule.inc.php 7 Sep 2002 11:36:32 -0000 1.26 *************** *** 73,77 **** $query = "SELECT * FROM Molecule WHERE $where"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->id = (int)$row["id"]; --- 73,77 ---- $query = "SELECT * FROM Molecule WHERE $where"; $res = query($query); ! if($row =& db_fetch_assoc($res)) { [...133 lines suppressed...] $search->setHits($cnt); --- 629,633 ---- "WHERE 1 ".$search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 654,658 **** $arr = array(); if(!($res = query($query))) return $arr; ! while($row = mysql_fetch_assoc($res)) { $row["cloneId"] = substr($row["cloneId"], 1); --- 656,660 ---- $arr = array(); if(!($res = query($query))) return $arr; ! while($row =& db_fetch_assoc($res)) { $row["cloneId"] = substr($row["cloneId"], 1); Index: newinit.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/newinit.inc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** newinit.inc.php 29 Aug 2002 16:51:34 -0000 1.9 --- newinit.inc.php 7 Sep 2002 11:36:32 -0000 1.10 *************** *** 38,42 **** $sec ^ (getmypid() << 16)); ! $curDb = new luDatabase($config["dbHost"], $config["dbUser"], $config["dbPassword"], $config["dbDatabase"]); unset($config["dbPassword"]); // Perfectly normal paranoia --- 38,42 ---- $sec ^ (getmypid() << 16)); ! $curDb = new BaseDatabase($config["dbHost"], $config["dbUser"], $config["dbPassword"], $config["dbDatabase"]); unset($config["dbPassword"]); // Perfectly normal paranoia Index: news.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/news.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** news.inc.php 29 Aug 2002 16:51:34 -0000 1.4 --- news.inc.php 7 Sep 2002 11:36:32 -0000 1.5 *************** *** 44,54 **** function getLatest($count, $from = 0) { - $count = (int)$count; - $from = (int)$from; $query = "SELECT * FROM News ORDER BY addedDate DESC ". ! "LIMIT $from, $count"; $res = query($query); $arr = array(); ! while($row = mysql_fetch_array($res)) { $arr[] = new News($row["name"], $row["descr"], $row["owner"], --- 44,52 ---- function getLatest($count, $from = 0) { $query = "SELECT * FROM News ORDER BY addedDate DESC ". ! db_limit((int)$from, (int)$count); $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) { $arr[] = new News($row["name"], $row["descr"], $row["owner"], *************** *** 70,74 **** "WHERE 1 ".$search->getWhere(); $res = query($query); ! if($row = mysql_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); --- 68,72 ---- "WHERE 1 ".$search->getWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 90,94 **** $arr = array(); $res = query($query); ! while($row = mysql_fetch_array($res)) $arr[] = $row; return $arr; } --- 88,92 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } *************** *** 98,102 **** $query = "SELECT COUNT(*) FROM News"; $res = query($query); ! if($row = mysql_fetch_array($res)) return $row[0]; return 0; } --- 96,100 ---- $query = "SELECT COUNT(*) FROM News"; $res = query($query); ! if($row =& db_fetch_assoc($res)) return $row[0]; return 0; } Index: plate.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate.inc.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** plate.inc.php 29 Aug 2002 16:51:34 -0000 1.27 --- plate.inc.php 7 Sep 2002 11:36:32 -0000 1.28 *************** *** 67,71 **** { $query = "SELECT pt.* FROM PlateType pt ". ! "WHERE pt.wells = ".(int)$wells." LIMIT 1"; return $this->readQuery($query); } --- 67,71 ---- { $query = "SELECT pt.* FROM PlateType pt ". ! "WHERE pt.wells = ".(int)$wells." ".db_limit(0, 1); return $this->readQuery($query); [...737 lines suppressed...] return $arr; --- 948,952 ---- if(!$res) return false; $arr = array(); ! while($row =& db_fetch_row($res)) $arr[] = $row[0]; return $arr; *************** *** 961,965 **** if(!$res) return false; $wells = array(); ! while($row = mysql_fetch_assoc($res)) $wells[$row["id"]] = $row; --- 967,971 ---- if(!$res) return false; $wells = array(); ! while($row =& db_fetch_assoc($res)) $wells[$row["id"]] = $row; Index: plot.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/plot.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** plot.inc.php 29 Aug 2002 16:51:34 -0000 1.18 --- plot.inc.php 7 Sep 2002 11:36:32 -0000 1.19 *************** *** 486,490 **** { $query = "SELECT $ex1, $ex2 FROM $table1, $table2 ". ! "WHERE t1.orderNumber = t2.orderNumber"; } $query .= " AND t1.".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). --- 486,490 ---- { $query = "SELECT $ex1, $ex2 FROM $table1, $table2 ". ! "WHERE t1.position = t2.position"; } $query .= " AND t1.".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). *************** *** 507,511 **** if($rotMode) { ! while($row = mysql_fetch_row($res)) { if($row[0] === NULL || $row[1] === NULL) continue; --- 507,511 ---- if($rotMode) { ! while($row =& db_fetch_row($res)) { if($row[0] === NULL || $row[1] === NULL) continue; *************** *** 515,519 **** } } ! else while($row = mysql_fetch_row($res)) { if($row[0] === NULL || $row[1] === NULL) continue; --- 515,519 ---- } } ! else while($row =& db_fetch_row($res)) { if($row[0] === NULL || $row[1] === NULL) continue; Index: program.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/program.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** program.inc.php 31 Aug 2002 11:36:20 -0000 1.18 --- program.inc.php 7 Sep 2002 11:36:32 -0000 1.19 *************** *** 70,74 **** if(!query($query)) return false; $query = "DELETE FROM Program WHERE id = $this->id"; ! if(!query($query) || mysql_affected_rows() < 1) return false; return true; } --- 70,74 ---- if(!query($query)) return false; $query = "DELETE FROM Program WHERE id = $this->id"; ! if(!query($query) || db_affected_rows() < 1) return false; return true; [...89 lines suppressed...] ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } *************** *** 289,295 **** function isInUse() { ! $query = "SELECT 1 FROM Job WHERE program = $this->id LIMIT 1"; $res = query($query); ! if(!$res || mysql_num_rows($res) < 1) return false; return true; } --- 289,295 ---- function isInUse() { ! $query = "SELECT 1 FROM Job WHERE program = $this->id ".db_limit(0, 1); $res = query($query); ! if(!$res || db_num_rows($res) < 1) return false; return true; } Index: protocol.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/protocol.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** protocol.inc.php 29 Aug 2002 16:51:34 -0000 1.6 --- protocol.inc.php 7 Sep 2002 11:36:32 -0000 1.7 *************** *** 48,52 **** "WHERE id = $this->id"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->id = (int)$row["id"]; --- 48,52 ---- "WHERE id = $this->id"; $res = query($query); ! if($row =& db_fetch_assoc($res)) { [...149 lines suppressed...] --- 247,251 ---- } $res = query($query); ! return db_num_rows($res) == 1; } *************** *** 263,267 **** "AND p.id = ".(int)$id; $res = query($query); ! return mysql_num_rows($res) == 1; } } --- 256,260 ---- "AND p.id = ".(int)$id; $res = query($query); ! return db_num_rows($res) == 1; } } Index: raw.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/raw.inc.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** raw.inc.php 29 Aug 2002 16:51:34 -0000 1.30 --- raw.inc.php 7 Sep 2002 11:36:32 -0000 1.31 *************** *** 74,78 **** { $query = "DELETE FROM RawBioAssay WHERE id = $this->id"; ! if(!query($query) || mysql_affected_rows() <= 0) return false; ImageAcquisition::unlockId($this->imageAcquisition, false); --- 74,78 ---- { $query = "DELETE FROM RawBioAssay WHERE id = $this->id"; ! if(!query($query) || db_affected_rows() <= 0) return false; [...306 lines suppressed...] } --- 753,757 ---- } $res2 = query($query); ! if($row2 =& db_fetch_row($res2)) $row[3] = $row2[0]; else $row[3] = false; } *************** *** 765,769 **** "WHERE id = $this->imageAcquisition"; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return 0; } --- 771,775 ---- "WHERE id = $this->imageAcquisition"; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return 0; } Index: sampleannotation.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampleannotation.inc.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sampleannotation.inc.php 29 Aug 2002 16:51:34 -0000 1.14 --- sampleannotation.inc.php 7 Sep 2002 11:36:32 -0000 1.15 *************** *** 46,50 **** $query = "SELECT * FROM SampleAnnotationType WHERE id = $id"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->id = (int)$row["id"]; --- 46,50 ---- $query = "SELECT * FROM SampleAnnotationType WHERE id = $id"; $res = query($query); ! if($row =& db_fetch_assoc($res)) { [...168 lines suppressed...] --- 266,271 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) ! $arr[$row["id"]] = $row; return $arr; } *************** *** 286,290 **** $arr = array(); $res = query($query); ! while($row = mysql_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; --- 279,283 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; Index: sampletissue.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampletissue.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sampletissue.inc.php 5 Aug 2002 11:29:35 -0000 1.6 --- sampletissue.inc.php 7 Sep 2002 11:36:32 -0000 1.7 *************** *** 43,52 **** $query = "SELECT * FROM SampleTissue WHERE id = $id"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->id = (int)$row["id"]; $this->parent = (int)$row["parent"]; $this->name = $row["name"]; - mysql_free_result($res); return true; } [...116 lines suppressed...] } --- 180,184 ---- } else $id = 0; ! unset($res); if(!$id) break; } *************** *** 192,196 **** $query = "SELECT COUNT(*) FROM SampleTissue WHERE parent = $this->id"; $res = query($query); ! if($row = mysql_fetch_row($res)) return (bool)$row[0]; return false; } --- 192,196 ---- $query = "SELECT COUNT(*) FROM SampleTissue WHERE parent = $this->id"; $res = query($query); ! if($row =& db_fetch_row($res)) return (bool)$row[0]; return false; } Index: search.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/search.inc.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** search.inc.php 29 Aug 2002 16:51:34 -0000 1.33 --- search.inc.php 7 Sep 2002 11:36:32 -0000 1.34 *************** *** 118,122 **** { $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->search = (int)$row["search"]; --- 118,122 ---- { $res = query($query); ! if($row =& db_fetch_assoc($res)) { [...221 lines suppressed...] } else if($type == SEARCH_LIKESTRINGLIKE) { + $arr[$j] = (string)$arr[$j]; // if($wc) $arr[$j] = "%$arr[$j]%"; } *************** *** 991,995 **** $view[] = $s; } ! else error_log("Invalid field type $type in search $this->search"); } $this->translated =& $arr; --- 1001,1006 ---- $view[] = $s; } ! else ! error_log("Invalid field type $type in search $this->search"); } $this->translated =& $arr; Index: session.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/session.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** session.inc.php 29 Aug 2002 16:51:34 -0000 1.3 --- session.inc.php 7 Sep 2002 11:36:32 -0000 1.4 *************** *** 47,51 **** if($ip != "") $query .= "AND IP = '".addslashes($ip)."'"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $this->cookie = $row["cookie"]; --- 47,51 ---- if($ip != "") $query .= "AND IP = '".addslashes($ip)."'"; $res = query($query); ! if($row =& db_fetch_assoc($res)) { $this->cookie = $row["cookie"]; *************** *** 54,58 **** $this->IP = $row["IP"]; $this->exists = 1; - mysql_free_result($res); return true; } --- 54,57 ---- *************** *** 91,95 **** if($ip != "") $query .= " AND IP = '".addslashes($ip)."'"; query($query); ! return mysql_affected_rows() == 1; } --- 90,94 ---- if($ip != "") $query .= " AND IP = '".addslashes($ip)."'"; query($query); ! return db_affected_rows() == 1; } *************** *** 100,104 **** query($query); $this->exists = 0; ! return mysql_affected_rows() == 1; } --- 99,103 ---- query($query); $this->exists = 0; ! return db_affected_rows() == 1; } *************** *** 204,208 **** $query = "SELECT COUNT(DISTINCT owner) FROM Cookie"; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return 0; } --- 203,207 ---- $query = "SELECT COUNT(DISTINCT owner) FROM Cookie"; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return 0; } *************** *** 214,218 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_row($res)) $arr[] = $row[0]; return $arr; } --- 213,217 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[] = $row[0]; return $arr; } Index: test.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/test.phtml,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test.phtml 5 Aug 2002 11:29:35 -0000 1.46 --- test.phtml 7 Sep 2002 11:36:32 -0000 1.47 *************** *** 24,30 **** // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ! // header("content-type: text/plain"); - phpinfo(); ?> --- 24,75 ---- // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ! header("content-type: text/plain"); ! ! require_once("init.inc.php"); ! ! echo "Testing db...\n"; ! ob_implicit_flush(1); ! $s = array(0, 0, 0); ! for($j = 0; $j < 5; $j++) ! { ! $t = array(); ! $query = "SELECT * FROM Molecule"; ! $res = query($query); ! $t[0] = microtime(); ! while($row =& mysql_fetch_assoc($res)) ; ! $t[1] = microtime(); ! ! $query = "SELECT * FROM Molecule"; ! $res = query($query); ! $t[2] = microtime(); ! while($row = db_fetch_assoc($res)) ; ! $t[3] = microtime(); ! ! $query = "SELECT * FROM Molecule"; ! $res = query($query); ! $t[4] = microtime(); ! while($row =& db_fetch_assoc($res)) ; ! $t[5] = microtime(); ! ! for($i = 0; $i < 6; $i++) ! { ! $t[$i] = explode(" ", $t[$i]); ! $t[$i] = $t[$i][0] + $t[$i][1]; ! } ! $d0 = $t[1]-$t[0]; ! $d1 = $t[3]-$t[2]; ! $d2 = $t[5]-$t[4]; ! $s[0] += $d0; ! $s[1] += $d1; ! $s[2] += $d2; ! echo "&mysql_fetch_assoc: $d0 s\n"; ! echo "db_fetch_assoc2: $d1 s\n"; ! echo "&db_fetch_assoc2: $d2 s\n"; ! } ! echo "\n\nAverages:\n"; ! echo "&mysql_fetch_assoc: $s[0] s\n"; ! echo "db_fetch_assoc2: $s[1] s\n"; ! echo "&db_fetch_assoc2: $s[2] s\n"; ?> Index: transformation.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/transformation.inc.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** transformation.inc.php 29 Aug 2002 16:51:34 -0000 1.12 --- transformation.inc.php 7 Sep 2002 11:36:32 -0000 1.13 *************** *** 77,81 **** "WHERE transformation = $this->id"; $res = query($query); ! while($row = mysql_fetch_row($res)) if(!BioAssaySet::removeId($row[0])) $rc = false; if(!$rc) return false; --- 77,81 ---- "WHERE transformation = $this->id"; $res = query($query); ! while($row =& db_fetch_row($res)) if(!BioAssaySet::removeId($row[0])) $rc = false; [...98 lines suppressed...] } --- 220,224 ---- "AND bas.experiment = $expid"; $res = query($query); ! if($row =& db_fetch_row($res)) return true; return false; } *************** *** 229,233 **** "WHERE p.id = j.program AND j.transformation = ".(int)$id; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0]; return ""; } --- 229,233 ---- "WHERE p.id = j.program AND j.transformation = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return ""; } Index: upload.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** upload.inc.php 29 Aug 2002 16:51:34 -0000 1.18 --- upload.inc.php 7 Sep 2002 11:36:32 -0000 1.19 *************** *** 68,72 **** $query = "DELETE FROM Upload WHERE id = $this->id AND hidden = 0"; query($query); ! if(mysql_affected_rows() <= 0) $ret = false; else { --- 68,72 ---- $query = "DELETE FROM Upload WHERE id = $this->id AND hidden = 0"; query($query); ! if(db_affected_rows() <= 0) $ret = false; else [...85 lines suppressed...] $search->setHits($cnt); --- 292,296 ---- "WHERE !up.hidden ".$search->getExtraWhere()." ".$search->getWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 318,322 **** $arr = array(); $res = query($query); ! while($row = mysql_fetch_assoc($res)) $arr[] = $row; return $arr; } --- 318,322 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } Index: user.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/user.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** user.inc.php 5 Aug 2002 11:31:53 -0000 1.4 --- user.inc.php 7 Sep 2002 11:36:32 -0000 1.5 *************** *** 59,63 **** { $res = query($query); ! if($row = mysql_fetch_assoc($res)) { $this->id = (int)$row["id"]; --- 59,63 ---- { $res = query($query); ! if($row =& db_fetch_assoc($res)) { [...95 lines suppressed...] else --- 360,364 ---- "WHERE 1 ".$search->getWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else *************** *** 395,399 **** $arr = array(); $res = query($query); ! while($row = mysql_fetch_assoc($res)) $arr[] = $row; return $arr; --- 385,389 ---- $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; Index: ware.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/ware.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ware.inc.php 29 Aug 2002 16:51:34 -0000 1.7 --- ware.inc.php 7 Sep 2002 11:36:32 -0000 1.8 *************** *** 50,54 **** $id = (int)$id; $query = "DELETE FROM $type WHERE id = $id"; ! if(!query($query) || mysql_affected_rows() != 1) return false; return true; --- 50,54 ---- $id = (int)$id; $query = "DELETE FROM $type WHERE id = $id"; ! if(!query($query) || db_affected_rows() != 1) return false; return true; *************** *** 94,98 **** $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row = mysql_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); --- 94,98 ---- $search->getWhere()." ".$search->getExtraWhere(); $res = query($query); ! if($row =& db_fetch_row($res)) $cnt = $row[0]; else $cnt = 0; $search->setHits($cnt); *************** *** 116,120 **** $arr = array(); if(!($res = query($query))) return $arr; ! while($row = mysql_fetch_array($res)) $arr[] = $row; return $arr; } --- 116,120 ---- $arr = array(); if(!($res = query($query))) return $arr; ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } *************** *** 159,163 **** "WHERE id = ".(int)$id; $res = query($query); ! if($row = mysql_fetch_assoc($res)) return $row; return false; } --- 159,163 ---- "WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_assoc($res)) return $row; return false; } *************** *** 169,173 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } --- 169,173 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } *************** *** 226,230 **** "WHERE id = ".(int)$id; $res = query($query); ! if($row = mysql_fetch_assoc($res)) return $row; return false; } --- 226,230 ---- "WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_assoc($res)) return $row; return false; } *************** *** 236,240 **** $res = query($query); $arr = array(); ! while($row = mysql_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } --- 236,240 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } Index: wizzzard.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/wizzzard.inc.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** wizzzard.inc.php 29 Aug 2002 16:51:34 -0000 1.23 --- wizzzard.inc.php 7 Sep 2002 11:36:32 -0000 1.24 *************** *** 60,68 **** $query = "SELECT * FROM Wizzzard WHERE id = $this->id"; $res = query($query); ! if($row = mysql_fetch_array($res)) { $vars = array("id", "owner", "etype", "name", "numCols", "extraCols", "dataHeader", "typeHeader", "typeHeaderLine", "mapping"); ! for($i = 0; $i < count($vars); $i++) $this->$vars[$i] = $row[$vars[$i]]; } else --- 60,69 ---- [...124 lines suppressed...] } function useF($wizid, $ownerid) { ! $query = "INSERT INTO WizzzardUser (owner, wizzzard) VALUES ". "(".(int)$ownerid.", ".(int)$wizid.")"; query($query); *************** *** 713,717 **** $query = "SELECT owner FROM Wizzzard WHERE id = ".(int)$id; $res = query($query); ! if($row = mysql_fetch_row($res)) return $row[0] == (int)$owner; return false; } --- 713,717 ---- $query = "SELECT owner FROM Wizzzard WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0] == (int)$owner; return false; } |