1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-28 04:00:43 +02:00

Merge pull request #75 from barryvdh/patch-5

Add method to PdoStorage
This commit is contained in:
Maxime Bouroumeau-Fuseau
2014-01-14 11:12:22 -08:00
2 changed files with 7 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ class PdoStorage implements StorageInterface
protected $tableName;
protected $sqlQueries = array(
'save' => "INSERT INTO %tablename% (id, data, meta_utime, meta_datetime, meta_uri, meta_ip) VALUES (?, ?, ?, ?, ?, ?)",
'save' => "INSERT INTO %tablename% (id, data, meta_utime, meta_datetime, meta_uri, meta_ip, meta_method) VALUES (?, ?, ?, ?, ?, ?, ?)",
'get' => "SELECT data FROM %tablename% WHERE id = ?",
'find' => "SELECT data FROM %tablename% %where% LIMIT %limit% OFFSET %offset%",
'clear' => "DELETE FROM %tablename%"
@@ -57,7 +57,7 @@ class PdoStorage implements StorageInterface
$sql = $this->getSqlQuery('save');
$stmt = $this->pdo->prepare($sql);
$meta = $data['__meta'];
$stmt->execute(array($id, serialize($data), $meta['utime'], $meta['datetime'], $meta['uri'], $meta['ip']));
$stmt->execute(array($id, serialize($data), $meta['utime'], $meta['datetime'], $meta['uri'], $meta['ip'], $meta['method']));
}
/**
@@ -126,4 +126,4 @@ class PdoStorage implements StorageInterface
}
return $sql;
}
}
}

View File

@@ -1,15 +1,16 @@
CREATE TABLE phpdebugbar (
id TEXT PRIMARY KEY,
data TEXT,
meta_utime TEXT,
meta_datetime TEXT,
meta_uri TEXT,
meta_ip TEXT
meta_ip TEXT,
meta_method TEXT
);
CREATE INDEX idx_debugbar_id ON phpdebugbar (id);
CREATE INDEX idx_debugbar_meta_utime ON phpdebugbar (meta_utime);
CREATE INDEX idx_debugbar_meta_datetime ON phpdebugbar (meta_datetime);
CREATE INDEX idx_debugbar_meta_uri ON phpdebugbar (meta_uri);
CREATE INDEX idx_debugbar_meta_ip ON phpdebugbar (meta_ip);
CREATE INDEX idx_debugbar_meta_ip ON phpdebugbar (meta_ip);
CREATE INDEX idx_debugbar_meta_method ON phpdebugbar (meta_method);