84 if (!function_exists(
'mysql_pconnect')) {
85 die(
'PHP not compiled with mysql support.');
89 $this->connection = mysql_pconnect($host, $username, $password);
90 if (!$this->connection) {
91 die(
'mysql_pconnect() failed - check permissions and spelling.');
95 if (!mysql_select_db($database, $this->connection)) {
96 die(
'Cannot use database '.$database);
103 $this->cursor = mysql_query(
"SELECT `value` FROM `getid3_cache` WHERE (`filename` = '".
GETID3_VERSION.
"') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection);
104 list($version) = @mysql_fetch_array($this->cursor);
117 $this->cursor = mysql_query(
"DELETE FROM `getid3_cache`", $this->connection);
118 $this->cursor = mysql_query(
"INSERT INTO `getid3_cache` VALUES ('".
GETID3_VERSION.
"', -1, -1, -1, '".
GETID3_VERSION.
"')", $this->connection);
131 $filenam2 = mysql_escape_string(
$filename);
134 $this->cursor = mysql_query(
"SELECT `value` FROM `getid3_cache` WHERE (`filename`='".$filenam2.
"') AND (`filesize`='".$filesize.
"') AND (`filetime`='".$filetime.
"')", $this->connection);
135 list($result) = @mysql_fetch_array($this->cursor);
139 return unserialize($result);
148 $res2 = mysql_escape_string(serialize($result));
149 $this->cursor = mysql_query(
"INSERT INTO `getid3_cache` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('".$filenam2.
"', '".$filesize.
"', '".$filetime.
"', '".time().
"', '".$res2.
"')", $this->connection);
159 $this->cursor = mysql_query(
"CREATE TABLE IF NOT EXISTS `getid3_cache` (
160 `filename` VARCHAR(255) NOT NULL DEFAULT '',
161 `filesize` INT(11) NOT NULL DEFAULT '0',
162 `filetime` INT(11) NOT NULL DEFAULT '0',
163 `analyzetime` INT(11) NOT NULL DEFAULT '0',
164 `value` TEXT NOT NULL,
165 PRIMARY KEY (`filename`,`filesize`,`filetime`)) TYPE=MyISAM", $this->connection);
166 echo mysql_error($this->connection);