コード例 #1
-1
ファイル: index.php プロジェクト: nlevee/php-object-mapper
<?php

/**
 * @author: Nicolas Levée
 * @version 070320141527
 */
error_reporting(true);
require_once "SplClassLoader.php";
// declaration des autoload
SplClassLoader::AutoloadRegister("POM", __DIR__ . "/../src");
SplClassLoader::AutoloadRegister("Exemple", __DIR__ . "/");
// decalaration de l'adapter
$adapter = new \POM\Service\Mysql\Adapter("mysql:host=gary.idobs;dbname=nlevee", "nlevee", "devine");
$adapter->connect();
$cursor = $adapter->fetch("SELECT * FROM server_http_config");
foreach ($cursor as $idx => $row) {
    var_dump($idx, $row);
}
unset($cursor);
$cursor = $adapter->fetch("SELECT * FROM server_http_config WHERE description LIKE :desc", [':desc' => '%CMS%']);
foreach ($cursor as $idx => $row) {
    var_dump($idx, $row);
}
unset($cursor);
$cursor = $adapter->fetch("SELECT * FROM server_http_config WHERE description LIKE :desc", [':desc' => '%WEB%']);
foreach ($cursor as $idx => $row) {
    var_dump($idx, $row);
}
unset($cursor);
var_dump($adapter->fetchOne("SELECT * FROM server_http_config"));
$cursor = $adapter->fetchColumn(2, "SELECT * FROM server_http_config");