Permalink
Browse files

cleanup to logic for table creation for non mysql drivers, adding ses…

…sions to base DB
  • Loading branch information...
1 parent da45ac5 commit 6a01f03efe18b8b2dcacd976a5aaa297bf182521 @evantahler committed May 1, 2011
@@ -285,10 +285,6 @@ function _TruncateTable($PARAMS = array())
$resp = "Table ".$PARAMS['table']." cannot be found in ".$ThisDB;
}
}
- else
- {
- $resp = "cannot connect to ".$ThisDB;
- }
return $resp;
}
@@ -310,7 +306,7 @@ function _CleanSessions($PARAMS = array())
if ($stop == false)
{
- $SQL= 'DELETE FROM `SESSIONS` WHERE (`created_at` < "'.date('Y-m-d H:i:s',(time() - $CONFIG['SessionAge'])).'") ;';
+ $SQL= 'DELETE FROM `sessions` WHERE (`created_at` < "'.date('Y-m-d H:i:s',(time() - $CONFIG['SessionAge'])).'") ;';
$DBOBJ->Query($SQL);
$resp = 'Deleted '.$DBOBJ->NumRowsEffected()." entries from the SESSIONS Table in the DB";
}
@@ -374,7 +370,7 @@ function _CleanCache()
}
else
{
- $resp = "cannot connect to ".$CONFIG['LOG_DB'];
+ $resp = "cannot connect to DB";
}
return $resp;
}
@@ -75,7 +75,7 @@
{
if ($TABLES[$ThisTable]['META']['KEY'] != null)
{
- $TableStringOutput .= '$TABLES["'.$ThisTable.'"]["META"]["KEY"] = '.$TABLES[$ThisTable]['META']['KEY']."; \r\n";
+ $TableStringOutput .= '$TABLES["'.$ThisTable.'"]["META"]["KEY"] = "'.$TABLES[$ThisTable]['META']['KEY']."\"; \r\n";
}
foreach($TABLES[$ThisTable] as $col)
{
View
@@ -75,7 +75,8 @@
function _CleanPostVariableInput($string,$Connection=null)
{
- if ($Connection){ $string = mysql_real_escape_string($string,$Connection); }
+ if (is_resource($Connection) == true && get_resource_type($Connection) == "mysql link"){ $string = mysql_real_escape_string($string,$Connection); }
+ else{ $string = addslashes($string); }
$replace = "";
$search = array(
View
@@ -80,3 +80,18 @@ CREATE TABLE IF NOT EXISTS `log` (
-- Dumping data for table `LOG`
--
+
+--
+-- Table structure for table `SESSIONS`
+--
+
+CREATE TABLE `sessions` (
+`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`KEY` VARCHAR( 128 ) NOT NULL ,
+`DATA` TEXT NOT NULL ,
+`created_at` DATETIME NOT NULL ,
+`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
+UNIQUE (
+`KEY`
+)
+) ENGINE = InnoDB ;

0 comments on commit 6a01f03

Please sign in to comment.