$db->insert($table, $values)->execute();
$db->insert($table, $values)->onConflict($newValues)->returning(['id']);
$db->insert($table, $values)->batch();
$db->select($columns)->from($table)->where($condition)->all(); // as now
$db->update($table, $values, $condition)->execute();
$db->update($table, $values)->from($from)->where($condition)->execute();
$db->delete($table, $condition)->execute();
This will allow to add more options to commands and build more complex queries.
classDiagram Connection --> InsertCommand Connection --> SelectCommand Connection --> UpdateCommand Connection --> DeleteCommand InsertCommand --> InsertQuery SelectCommand --> SelectQuery UpdateCommand --> UpdateQuery DeleteCommand --> DeleteQuery InsertQuery -- InsertQueryBuilder SelectQuery -- SelectQueryBuilder UpdateQuery -- UpdateQueryBuilder DeleteQuery -- DeleteQueryBuilder class Connection { insert() select() update() delete() } class InsertCommand { execute() onConflict() / upsert() returning() batch() } class SelectCommand { all() one() column() scalar() } class UpdateCommand { execute() } class DeleteCommand { execute() }Queryneeds to be split intoSelectCommandandSelectQuery;Queryshould be moved fromCommandtoSelectCommand;SelectCommandcontainsSelectQueryand acts as a proxy;Queryshould be moved fromQueryBuildertoSelectQueryBuilderand should work withSelectQuery;SelectQuerymust not depend onConnectionInterface;InsertCommand,UpdateCommand,DeleteCommandcommands are done similarly, but with their own executing methods, for exampleInsertCommand::retuning()similar to the currentCommand::insertReturning();InsertQuery,SelectQuery,UpdateQuery,DeleteQueryshould follow to Remove methods replacing query condition #714ConnectionInterface;This will allow to add more options to commands and build more complex queries.