コード例 #1
0
ファイル: builder.php プロジェクト: asyncphp/icicle-database
<?php

require __DIR__ . "/../vendor/autoload.php";
use AsyncPHP\Icicle\Database\BuilderFactory;
$factory = new BuilderFactory();
$builder = $factory->create(require __DIR__ . "/config.php");
print_r($builder->table("test1")->select()->limit(10, 5)->orderBy("id")->where("foo = ?", "bar")->build());
print_r($builder->table("test1")->insert(["text" => "foo"])->build());
print_r($builder->table("test1")->update(["text" => "foo"])->where("foo = ? and bar = ?", "bar", "baz")->build());
print_r($builder->table("test1")->delete()->where("foo = ?", "bar")->build());
コード例 #2
0
 /**
  * @param array $config
  *
  * @return Manager
  *
  * @throws InvalidArgumentException
  */
 public function create(array $config)
 {
     $connectors = new ConnectorFactory();
     $builders = new BuilderFactory();
     return new Manager($connectors->create($config), $builders->create($config));
 }