[geeklog-cvs] Geeklog-1.x/system/classes story.class.php, 1.34, 1.35

Michael Jervis mjervis at qs1489.pair.com
Thu Aug 14 12:52:04 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/system/classes
In directory qs1489.pair.com:/tmp/cvs-serv42344/system/classes

Modified Files:
	story.class.php 
Log Message:
Eliminated use of REPLACE INTO, introduced DB_checkTableExists.

Index: story.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/classes/story.class.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** story.class.php	12 Aug 2008 19:23:57 -0000	1.34
--- story.class.php	14 Aug 2008 16:52:01 -0000	1.35
***************
*** 635,640 ****
          $this->_related = implode("\n", STORY_extractLinks("{$this->_introtext} {$this->_bodytext}"));
          $this->_in_transit = 1;
!         $sql = 'REPLACE INTO ' . $_TABLES['stories'] . ' (';
!         $values = ' VALUES (';
          reset($this->_dbFields);
  
--- 635,640 ----
          $this->_related = implode("\n", STORY_extractLinks("{$this->_introtext} {$this->_bodytext}"));
          $this->_in_transit = 1;
!         $values = '';
!         $fields = '';
          reset($this->_dbFields);
  
***************
*** 646,650 ****
              if ($save === 1) {
                  $varname = '_' . $fieldname;
!                 $sql .= $fieldname . ', ';
                  if (($fieldname == 'date') || ($fieldname == 'expire')) {
                      // let the DB server do this conversion (cf. timezone hack)
--- 646,650 ----
              if ($save === 1) {
                  $varname = '_' . $fieldname;
!                 $fields .= $fieldname . ', ';
                  if (($fieldname == 'date') || ($fieldname == 'expire')) {
                      // let the DB server do this conversion (cf. timezone hack)
***************
*** 656,664 ****
          }
  
!         $sql = substr($sql, 0, strlen($sql) - 2);
          $values = substr($values, 0, strlen($values) - 2);
!         $sql .= ') ' . $values . ')';
! 
!         DB_query($sql);
  
          /* Clean up the old story */
--- 656,663 ----
          }
  
!         // Fields and values has a trailing ', ' remove them:
!         $fields = substr($fields, 0, strlen($fields) - 2);
          $values = substr($values, 0, strlen($values) - 2);
!         DB_Save($_TABLES['stories'], $fields, $values);
  
          /* Clean up the old story */




More information about the geeklog-cvs mailing list