Beispiel #1
0
$db->pln($db->update("authors", ['fl' => $sqlUpdList, 'where' => 'id=1']), "update");
$fldList = ['name' => "t'est", 'biography' => "t'est insert"];
$db->pln($db->insert("authors", ['fl' => $fldList]), "insert");
$lastid = $db->getLastId("authors", "id");
$db->pln($db->select("authors", ['where' => "id={$lastid}"]), "RS of last insert: {$lastid}");
$db->pln($db->delete("authors", ['where' => "id={$lastid}"]), "deleted {$lastid}");
$db->pln($db->select("authors"), "select-aft");
echo "<br />rows2array-after";
// various select test case
$db->pln($db->select("authors", ['fl' => 'name', 'type' => 'both', 'where' => 'id=1']), "both-name", 'p');
$db->pln($db->select("authors", ['fl' => 'id, name,xid', 'where' => 'id=1']), "name,xid");
$db->pln($db->select("authors", ['fl' => $iArray, 'type' => 'num', 'where' => 'id=1']), "num");
$db->pln($db->select("books", ['where' => 'id<3']), "assoc");
$db->pln($db->select("books", ['where' => 'id<3', 'all' => 'all']), "all-assoc");
$db->pln($db->dbRow("authors", ['where' => 'id=1']), 'dbRow');
$db->pln($db->dbField("authors", "name", 'id=1'), 'dbFieldValue');
// schema test case
$fields = $db->fieldsKey("authors", "_none");
$db->pln($fields, "schema", 'p');
$one = $db->filterBySchema("authors", $iArray);
$db->pln($one, "schema filter");
$db->pln($db->getNextId("books", "id"), "next books id");
// array to string
$db->pln($db->a2sSelect($one), "select");
$db->pln($db->a2sInsert($one), "insert");
$db->pln($db->a2sUpdate($one), "update");
$db->pln($db->a2sSelect($iArray), "select");
// old test case
$sql = $db->qbSelect("books", ['where' => "id <3"]);
$db->pln($sql, "sql");
echo "<p />Samples use object _call dbFetch";