diff --git a/layers/Tablet.php b/Builder.php similarity index 98% rename from layers/Tablet.php rename to Builder.php index 1da1e57..9dc95b8 100644 --- a/layers/Tablet.php +++ b/Builder.php @@ -1,12 +1,12 @@ sql," WHERE "); $conditions = implode(' AND ',$conditions); // die($conditions); @@ -133,7 +134,7 @@ public function where (array $conditions) { throw new Exception("Conditions variable must be set and must be an array"); } if($contains_where == false){ - $sql =$this->sql." WHERE {$conditions}"; + $sql = $this->sql." WHERE {$conditions}"; }else{ $sql =$this->sql." AND {$conditions}"; } diff --git a/README.md b/README.md index 8bd793f..d72a103 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@ -# Orcons-db -Orcons-db is a query builder for ADODB library. It is aimed at making database interactions easier with less codes. +# NoQuery + NoQuery is a php query builder running on ADODB library. It is aimed at making database interactions easier with less codes. + NoQuery currently supports MySQL, Firebird-Interbase, PostgreSQL, SQLite3, Oracle, Microsoft SQL Server, Foxpro ODBC, Access ODBC, + Informix, DB2, Sybase, Sybase SQL Anywhere, generic ODBC and Microsoft's ADO due its leverage on ADODB. ## Installation - > composer install orcons-db + > composer install noquery ## Configuration - orcons-db requires a configuration array. A typical configuration looks like + NoQuery requires a configuration array. A typical configuration looks like ```php $config = [ - 'driver' => 'mysqli', + 'driver' => 'mysqli', 'server' => "localhost", @@ -30,7 +32,7 @@ Orcons-db is a query builder for ADODB library. It is aimed at making database i ## Usage It all starts with an instance of Tablet class which requires a configuration array variable. ```php -$db = new Orcons\Layers\Tablet( $config ) +$db = new NoQuery\Builder( $config ) ``` Now we are ready to interact with our database. @@ -53,7 +55,7 @@ Now we are ready to interact with our database. ### Sample ```php - use Orcons\Layers\Tablet; + use NoQuery\Builder; $config = [ 'driver' => "mysqli", @@ -65,18 +67,18 @@ $config = [ 'debug' => true ]; - $db = new Tablet( $config ) + $db = new Builder( $config ) #select query $db->table('users') ->select(['name','gender','age']) - ->get() + ->get(); #update statement $db->table('users') ->update(['name'=>'Chamamme']) ->where(["id = 5","gender ='male'"]) - ->go() + ->go(); ``` diff --git a/composer.json b/composer.json index 151e7d5..591fc84 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "chamamme/orcons-db", - "description": "A database query builder for ADODB which is aimed at code beautification by minimizing the use of raw SQL in codes", + "name": "chamamme/noquery", + "description": "A database query builder aimed at code beautification by minimizing the use of raw SQL in codes. NoQuery currently supports MySQL, Firebird & Interbase, PostgreSQL, SQLite3, Oracle, Microsoft SQL Server, Foxpro ODBC, Access ODBC, Informix, DB2, Sybase, Sybase SQL Anywhere, generic ODBC and Microsoft's ADO due to its leverage on ADODB", "authors": [ { "name": "Andrew Chamamme", @@ -9,7 +9,7 @@ } ], "license": "MIT", - "keywords" : [ "database","adodb","orcons", "abstraction", "layer", "library", "php","query builder" ], + "keywords" : [ "noquery", "database","adodb","orcons", "abstraction", "layer", "library", "php","query builder","MySQL", "Firebird" , "Interbase", "PostgreSQL", "SQLite3", "Oracle", "Microsoft SQL Server", "Foxpro ODBC", "Access ODBC", "Informix", "DB2", "Sybase", "Sybase SQL Anywhere", "generic ODBC", "Microsoft ADO" ], "require": { "php": "^7.0", "adodb/adodb-php": "5.20.9" @@ -21,7 +21,7 @@ }, "autoload": { "psr-4":{ - "Orcons\\" : "" + "NoQuery\\" : "" } } } diff --git a/config.php b/config.php index f02f5e7..c1b4fb5 100644 --- a/config.php +++ b/config.php @@ -1,6 +1,6 @@ 'mysqli', + 'driver' => 'mysqli', // access,ado,ibase,fbsql,db2,informix,ldap,mssqlnative,netezza,odbc,odbtp,oci8,pdo,postgres9,proxy,ads,sybase_ase,sqlite3,sybase, 'server' => "localhost", 'username' => "root", 'password' => "", diff --git a/index.php b/index.php deleted file mode 100644 index 372f860..0000000 --- a/index.php +++ /dev/null @@ -1,20 +0,0 @@ -table('users') - ->select(['name','gender','age']) - ->get() - -#update statement -$db->table('users') - ->update(['name'=>'Chamamme']) - ->where(["id = 5","gender ='male'"]) - ->go() - diff --git a/sample.php b/sample.php new file mode 100644 index 0000000..e37fec8 --- /dev/null +++ b/sample.php @@ -0,0 +1,20 @@ +table('users') + ->select(['name','email']) + ->get(); + var_dump($das); +#update statement +$db->table('users') + ->update(['name'=>'Chamamme']) + ->where(["id = 5","email = 'andrew@mail.com'"]) + ->go(); +