-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from byjg/5.0
Add SqlStatement object
- Loading branch information
Showing
19 changed files
with
500 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SQL Statement | ||
|
||
The SQL Statement is a class to abstract the SQL query from the database. | ||
|
||
```php | ||
<?php | ||
|
||
$dbDriver = Factory::getDbInstance("mysql://user:password@server/schema"); | ||
$sql = new SqlStatement("select * from table where field = :param"); | ||
|
||
$iterator = $sql->getIterator($dbDriver, ['param' => 'value']); | ||
``` | ||
|
||
The advantage of using the `SqlStatement` is that you can reuse the same SQL statement with different parameters. | ||
It saves time preparing the cache. | ||
|
||
Also, you can cache the query (see [Cache results](cache.md)). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.