Merge branch 'main' of github.com:jobyone/destructr into main
This commit is contained in:
commit
5526097af4
1 changed files with 33 additions and 0 deletions
33
examples/mariadb.php
Normal file
33
examples/mariadb.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
include __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
$driver = \Destructr\DriverFactory::factoryFromPDO(
|
||||||
|
new \PDO('mysql:server=localhost;port=3307;dbname=destructr', 'root'),
|
||||||
|
'mariadb'
|
||||||
|
);
|
||||||
|
|
||||||
|
$factory = new \Destructr\Factory($driver, 'example_table');
|
||||||
|
$factory->createTable();
|
||||||
|
|
||||||
|
// ini_set('max_execution_time','0');
|
||||||
|
// for($i = 0; $i < 1000; $i++) {
|
||||||
|
// $obj = $factory->create(
|
||||||
|
// [
|
||||||
|
// 'dso.type'=>'foobar',
|
||||||
|
// 'random_data' => md5(rand())
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// $obj->insert();
|
||||||
|
// }
|
||||||
|
|
||||||
|
$search = $factory->search();
|
||||||
|
|
||||||
|
// $search->where('${random_data} = :q');
|
||||||
|
// $search->execute(['q'=>'rw7nivub9bhhh3t4']);
|
||||||
|
|
||||||
|
$search->where('${dso.id} = :q');
|
||||||
|
$search->execute(['q'=>'rw7nivub9bhhh3t4']);
|
||||||
|
|
||||||
|
// foreach($search->execute() as $dso) {
|
||||||
|
// var_dump($dso->get());
|
||||||
|
// }
|
Loading…
Reference in a new issue