Skip to content

Commit

Permalink
2019044-133416-0700
Browse files Browse the repository at this point in the history
  • Loading branch information
anovsiradj committed Apr 14, 2019
1 parent b0636e3 commit 6b59f73
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Mayendra Costanov (anovsiradj) <[email protected]>
Copyright (c) 2017-2019 Mayendra Costanov (anovsiradj) <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
54 changes: 24 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/bcit-ci/CodeIgniter#server-requirements>).

tested with `MySQL` and `FirebirdSQL`.
tested with `MySQL`, `SQLite` and `FirebirdSQL`.

### Caveats

Expand All @@ -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)

0 comments on commit 6b59f73

Please sign in to comment.