diff --git a/LICENSE.txt b/LICENSE.txt index c39dd82..64da549 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Mayendra Costanov (anovsiradj) +Copyright (c) 2017-2019 Mayendra Costanov (anovsiradj) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 48699d8..3144838 100644 --- a/README.md +++ b/README.md @@ -5,47 +5,40 @@ Standalone CodeIgniter3 DataBase Query Builder with monkey-patched technique. ### Usage ```php -// IMPORTANT: "BASEPATH" must end with directory separator. - -// without composer -require 'path/to/ci3db/CI3DataBase.php'; - -// with composer -require 'path/to/vendor/autoload.php'; - -// then +// IMPORTANT: "BASEPATH" must end with slash or directory separator. define('BASEPATH', 'path/to/vendor/codeigniter/framework/system/'); // relative -define('BASEPATH', realpath('path/to/vendor/codeigniter/framework/system') . DIRECTORY_SEPARATOR); // absolute +define('BASEPATH', realpath('/path/to/vendor/codeigniter/framework/system') . DIRECTORY_SEPARATOR); // absolute -$ci3db =& anovsiradj\CI3DataBase::init(); +$ci3db =& \anovsiradj\CI3DataBase::init(); -$ci3db->set_db_config_file('path/to/config/database.php'); +$ci3db->set_db_config_file('path/to/config/database.php'); // see ./tests/cfg.php // or -$ci3db->set_db_config('db-server-5', array( +$ci3db->set_db_config('db-server-0', array( ... - 'host' => 'localhost', - 'user' => 'root', - 'password' => 'root' + 'dbdriver' => '...', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'root', + 'database' => '...', ... )); +// or +$ci3db->set_db_config('db-server-1', 'dbdriver://username:password@hostname/database'); // Using the query builder -$db =& $ci3db::db(); -// or -$db =& $ci3db::db('db-server-5'); -// or -$db =& anovsiradj\CI3DataBase::db(); -// or -$db =& anovsiradj\CI3DataBase::db('db-server-5'); +$db =& $ci3db->db(); // or +$db =& $ci3db->db('db-server-0'); // or +$db =& \anovsiradj\CI3DataBase::db(); // or +$db =& \anovsiradj\CI3DataBase::db('db-server-1'); ``` ### Development -tested on both `5.6+` and `7.0+`. +tested on `5.6+`,`7.0+` and `7.2+`. -probably work on `5.4.8+` (see https://github.com/bcit-ci/CodeIgniter#server-requirements). +probably work on `5.4.8+` (see ). -tested with `MySQL` and `FirebirdSQL`. +tested with `MySQL`, `SQLite` and `FirebirdSQL`. ### Caveats @@ -55,14 +48,15 @@ tested with `MySQL` and `FirebirdSQL`. DB Cache is not supported. -`DSN` string is not yet available. you have to use array. +`DSN` you must provide `host` (even for `sqlite3`). ### Todo(s) - Test driver `PDO` -- Test `SQLite3` -- `DSN` support. _ughh!_ +- Test `PostgreSQL` # License -[MIT](https://anovsiradj.mit-license.org/2017) +[MIT](https://anovsiradj.mit-license.org/2017-2019) + +[CodeIgniter3 License](https://github.com/bcit-ci/CodeIgniter/blob/develop/user_guide_src/source/license.rst)