-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,23 @@ | |
|
||
namespace Masterpis\Db2as400; | ||
|
||
/** | ||
* Db2As400 is a collection of attributes and methods to simplify connection to DB2 As400. | ||
* The main purpose of this library is standarization of code in my small organization. | ||
* It will provide basic operation of database connection | ||
* | ||
* This library is built on lumen, laravel | ||
* | ||
* Class Db2 provide instance methods to connect database Db2 AS400, driver selection, method compatible with driver | ||
* Using this library will make you use same name method to operate connection and query. | ||
* | ||
* | ||
* @link masterpis.com | ||
* @since v1.0.0 | ||
* @author Priatmoko <[email protected]> | ||
* | ||
*/ | ||
|
||
class Db2{ | ||
|
||
/** | ||
|
@@ -163,9 +180,9 @@ private function odbc() | |
* @param string $sql | ||
* @return void | ||
*/ | ||
public function execute($sql) | ||
public function query($sql) | ||
{ | ||
if (env('DB2_DRIVER')!="" && method_exists($this, "exec".ucfirst(strtolower(env('DB2_DRIVER'))))){ | ||
if (env('DB2_DRIVER')!="" && method_exists($this, "execute".ucfirst(strtolower(env('DB2_DRIVER'))))){ | ||
$method = "exec".ucfirst(strtolower(env('DB2_DRIVER'))); | ||
$this->$method($sql); | ||
} | ||
|
@@ -176,7 +193,7 @@ public function execute($sql) | |
* @param string $sql | ||
* @return void | ||
*/ | ||
private function execCom($sql) | ||
private function executeCom($sql) | ||
{ | ||
try { | ||
$row = $this->con->execute($sql); | ||
|
@@ -196,7 +213,7 @@ private function execCom($sql) | |
* @param string $sql | ||
* @return void | ||
*/ | ||
private function execOdbc($sql) | ||
private function executeOdbc($sql) | ||
{ | ||
try { | ||
$row = odbc_exec($this->con, $sql); | ||
|
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,51 @@ | ||
<?php | ||
|
||
namespace Masterpis\Db2As400; | ||
|
||
use Masterpis\Db2As400\Db2; | ||
|
||
/** | ||
* Db2As400 is a collection of attributes and methods to simplify connection to DB2 As400. | ||
* The main purpose of this library is standarization of code in my small organization. | ||
* It will provide basic operation of database connection | ||
* | ||
* This library is built on lumen, laravel | ||
* | ||
* Class Model provide simple query methods | ||
* Using this library will make you use same name method to operate connection and query. | ||
* | ||
* | ||
* @link masterpis.com | ||
* @since v1.0.0 | ||
* @author Priatmoko <[email protected]> | ||
* | ||
*/ | ||
|
||
class Model extends Db2{ | ||
|
||
/** | ||
* Filtering query result using LIKE clause | ||
* @var array | ||
*/ | ||
protected $like; | ||
|
||
/** | ||
* Sorting query result | ||
* @var array | ||
*/ | ||
protected $order; | ||
protected $limit; | ||
protected $server; | ||
protected $fields; | ||
protected $user; | ||
|
||
public function __construct() | ||
{ | ||
|
||
} | ||
|
||
public function get(){ | ||
|
||
} | ||
|
||
} |