Changeset 24
- Timestamp:
- 05/15/07 22:24:00
- Files:
-
- trunk/phptagengine.class.inc.php (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phptagengine.class.inc.php
r23 r24 176 176 */ 177 177 var $version; 178 /** 179 * Show or hide error messages 180 * 181 * @var boolean 182 */ 183 var $debug; 178 184 179 185 /** … … 200 206 ); 201 207 $this->version = '1.01'; 208 $this->debug = false; 202 209 } 203 210 … … 292 299 ( ".$this->db->qstr($tag)." 293 300 ) 294 ") or die( $this->db->ErrorMsg().' in '.__FILE__);301 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 295 302 296 303 if ($result) { … … 299 306 $id = $this->db->GetOne(" 300 307 SELECT CURRVAL('".$this->table_tag_names."_id_seq') as id 301 ") or die( $this->db->ErrorMsg());308 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 302 309 } 303 310 else { … … 353 360 , ".$this->db->DBDate(date("Y-m-d H:i:s"))." 354 361 ) 355 ") or die( $this->db->ErrorMsg().' in '.__FILE__);362 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 356 363 if ($result) { 357 364 return true; … … 446 453 FROM $this->table_tags 447 454 WHERE id = ".$this->db->qstr($id)." 448 ") or die( $this->db->ErrorMsg().' in '.__FILE__);455 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 449 456 if ($result) { 450 457 return true; … … 495 502 $where 496 503 ORDER BY tn.name 497 ") or die( $this->db->ErrorMsg().' in '.__FILE__);504 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 498 505 if ($result && $result->RowCount() > 0) { 499 506 while ($data = $result->FetchNextObject()) { … … 522 529 FROM $this->table_tags 523 530 WHERE tag = '$tag_id' 524 ") or die( $this->db->ErrorMsg().' in '.__FILE__);531 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 525 532 if (!$result) { 526 533 return false; … … 530 537 FROM $this->table_tag_names 531 538 WHERE id = '$tag_id' 532 ") or die( $this->db->ErrorMsg().' in '.__FILE__);539 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 533 540 if (!$result) { 534 541 return false; … … 559 566 SET tag = '$new_tag_id' 560 567 WHERE tag = '$old_tag_id' 561 ") or die( $this->db->ErrorMsg().' in '.__FILE__);568 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 562 569 if (!$result) { 563 570 return false; … … 568 575 FROM $this->table_tags 569 576 WHERE tag = '$new_tag_id' 570 ") or die( $this->db->ErrorMsg().' in '.__FILE__);577 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 571 578 if (!$result) { 572 579 return false; … … 590 597 FROM $this->table_tags 591 598 WHERE id IN (".implode(',', $ids_to_delete).") 592 ") or die( $this->db->ErrorMsg().' in '.__FILE__);599 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 593 600 if (!$result) { 594 601 return false; … … 602 609 SET name = ".$this->db->qstr($new_tag)." 603 610 WHERE name = ".$this->db->qstr($old_tag)." 604 ") or die( $this->db->ErrorMsg().' in '.__FILE__);611 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 605 612 if (!$result) { 606 613 return false; … … 648 655 $where 649 656 ORDER BY t.item, tn.name 650 ") or die( $this->db->ErrorMsg().' in '.__FILE__);657 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 651 658 if ($result) { 652 659 while ($data = $result->FetchNextObject()) { … … 674 681 FROM $this->table_tag_names 675 682 WHERE name = ".$this->db->qstr($name)." 676 ") or die( $this->db->ErrorMsg().' in '.__FILE__);683 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 677 684 if ($result && $result->RowCount() == 1) { 678 685 while ($data = $result->FetchNextObject()) { … … 812 819 ON tn.id = t.tag 813 820 ORDER BY tn.name 814 ") or die( $this->db->ErrorMsg().' in '.__FILE__);821 ") or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 815 822 if ($result) { 816 823 while ($data = $result->FetchNextObject()) { … … 1186 1193 ,$data 1187 1194 ) 1188 ) or die( $this->db->ErrorMsg().' on '.__LINE__.' in '.__FILE__);1195 ) or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 1189 1196 1190 1197 if ($result) { … … 1203 1210 ,$extra 1204 1211 ) 1205 ) or die( $this->db->ErrorMsg().' on '.__LINE__.' in '.__FILE__);1212 ) or die(throw_error($this->db->ErrorMsg(), __FILE__, __LINE__)); 1206 1213 if (!$result) { 1207 1214 $error++; … … 1221 1228 } 1222 1229 } 1230 1231 /** 1232 * Print error, or not, depending on debug setting. 1233 * 1234 * @return string 1235 */ 1236 function throw_error($msg, $file, $line) { 1237 if ($this->debug) { 1238 return $msg.' in '.$file.' on line: '.$line; 1239 } 1240 } 1223 1241 } 1224 1242
