-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unused tests and make new tests.
- Loading branch information
1 parent
aa3ffcc
commit b0636e3
Showing
12 changed files
with
105 additions
and
183 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/vendor/ | ||
/composer.lock | ||
|
||
/tests/*.db |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
<?php | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
define('BASEPATH', __DIR__ . '/../vendor/codeigniter/framework/system/'); // endslash! | ||
|
||
/* LI-V3.0.4.33054 Firebird 3.0 (superserver) */ | ||
|
||
$ci3db =& anovsiradj\CI3DataBase::init(); | ||
$ci3db->set_db_config_file(__DIR__ . '/cfg.php'); | ||
|
||
$dsn = 'ibase://sysdba:masterkey@localhost/employee?pconnect=true'; | ||
$ci3db->set_db_config('firebirdsql-dsn', $dsn); | ||
|
||
try { | ||
// throw new Exception('${ibase_errmsg}', 1); | ||
|
||
/** | ||
* cannot using $db0 and $db1 | ||
* @see https://bugs.php.net/bug.php?id=72175 | ||
*/ | ||
$db =& $ci3db->db('firebirdsql'); | ||
// $db =& $ci3db->db('firebirdsql-dsn'); | ||
|
||
} catch (\Exception $e) { | ||
echo 'can\'t firebirdsql.', PHP_EOL, $e->getMessage(), PHP_EOL; | ||
die(); | ||
} | ||
|
||
$db->trans_start(); | ||
if ($db->query('SELECT 1 FROM rdb$relations WHERE rdb$relation_name = UPPER(\'ci3db_tests\')')->num_rows() < 1) { | ||
$db->query(' | ||
CREATE TABLE ci3db_tests( | ||
k INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, | ||
v BLOB SUB_TYPE TEXT | ||
) | ||
'); | ||
} | ||
$db->trans_complete(); | ||
|
||
$db->insert(strtoupper('ci3db_tests'), [strtoupper('v') => 'lorem ipsum']); | ||
$db->insert(strtoupper('ci3db_tests'), [strtoupper('v') => 'anovsiradj']); | ||
$db->insert(strtoupper('ci3db_tests'), [strtoupper('v') => 'foo bar']); | ||
|
||
$q = $db->from(strtoupper('ci3db_tests'))->get(); | ||
dump( | ||
$q->num_rows(), | ||
$q->first_row(), | ||
$q->last_row() | ||
); | ||
|
||
$db->simple_query('DROP TABLE ci3db_tests'); | ||
|
||
$db->close(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
<?php | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
define('BASEPATH', __DIR__ . '/../vendor/codeigniter/framework/system/'); // endslash! | ||
|
||
$ci3db =& \anovsiradj\CI3DataBase::init(); | ||
$ci3db->set_db_config('sqlite3', [ | ||
'dbdriver' => 'sqlite3', | ||
'database' => (__DIR__ . '/sqlite3.db'), | ||
]); | ||
|
||
$dsn = 'sqlite3://whatever/' . __DIR__ . '/sqlite3.db'; | ||
$ci3db->set_db_config('sqlite3-dsn', $dsn); | ||
|
||
try { | ||
// throw new Exception('${sqlite_error_string}', 1); | ||
$db0 =& $ci3db->db('sqlite3'); | ||
$db1 =& $ci3db->db('sqlite3-dsn'); | ||
} catch (\Exception $e) { | ||
echo 'can\'t sqlite3.', PHP_EOL, $e->getMessage(), PHP_EOL; | ||
die(); | ||
} | ||
|
||
$db0->simple_query('CREATE TABLE IF NOT EXISTS ci3db_tests(k integer PRIMARY KEY AUTOINCREMENT, v TEXT)'); | ||
|
||
$db1->insert('ci3db_tests', ['v' => 'lorem ipsum']); | ||
dump($db1->insert_id()); | ||
|
||
$db0->set('v', 'foo bar')->update('ci3db_tests'); | ||
dump($db0->affected_rows()); | ||
|
||
$q = $db1->from('ci3db_tests')->get(); | ||
dump( | ||
$q->num_rows(), | ||
$q->row() | ||
); | ||
|
||
$q = $db0->where('k !=', null)->delete('ci3db_tests'); | ||
dump( $q, $db0->affected_rows() ); | ||
|
||
$db1->simple_query('DROP TABLE ci3db_tests'); | ||
|
||
$db0->close(); | ||
$db1->close(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.