Firebird tests, added dev guide
This commit is contained in:
parent
d8b4424c0f
commit
11060a2771
33
DEV_README.md
Normal file
33
DEV_README.md
Normal file
@ -0,0 +1,33 @@
|
||||
#Developer Notes
|
||||
|
||||
##Programming Style
|
||||
Follow the CodeIgniter [Style Guide](https://github.com/timw4mail/CodeIgniter/blob/develop/user_guide_src/source/general/styleguide.rst#class-and-file-names-using-common-words) - and:
|
||||
|
||||
* Do not use spaces to align code
|
||||
* Do not use `global`, `eval`
|
||||
* Do not use the error suppressor `@`
|
||||
* Add a docblock to every method
|
||||
|
||||
## PHP-Gtk Resources
|
||||
* [Reference](http://gtk.php.net/manual/en/reference.php)
|
||||
* [Official Tutorials](http://gtk.php.net/manual/en/tutorials.php)
|
||||
* [Community site](http://php-gtk.eu/) - Contains various tutorials
|
||||
|
||||
## Database reference material
|
||||
### Firebird
|
||||
|
||||
* [Interbase 6 Lang Ref](http://fbclient.googlecode.com/files/LangRef.pdf) - SQL Syntax (pdf)
|
||||
* [Firebird Lang Update Ref](http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25.html) - SQL Syntax Updates
|
||||
|
||||
### MySQL
|
||||
* [MySQL Syntax](http://dev.mysql.com/doc/refman/5.1/en/sql-syntax.html)
|
||||
* [Optimizing SQL Statements](http://dev.mysql.com/doc/refman/5.1/en/statement-optimization.html)
|
||||
|
||||
### PostgreSQL
|
||||
* [PostgreSQL Syntax](http://www.postgresql.org/docs/9.0/interactive/sql.html)
|
||||
* [Performance Tips](http://www.postgresql.org/docs/9.0/interactive/performance-tips.html)
|
||||
|
||||
### SQLite
|
||||
|
||||
* [SQL Syntax](http://www.sqlite.org/lang.html)
|
||||
* [Pragma SQL Syntax](http://www.sqlite.org/pragma.html) - Internal / Performance Stuff
|
@ -32,6 +32,9 @@ class firebird {
|
||||
function __construct($dbpath, $user="sysdba", $pass="masterkey")
|
||||
{
|
||||
$this->conn = ibase_connect($dbpath, $user, $pass);
|
||||
|
||||
$class = __CLASS__."_manip";
|
||||
$this->manip = new $class;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +139,7 @@ class firebird {
|
||||
$sql="SELECT rdb\$relation_name FROM rdb\$relations WHERE rdb\$relation_name NOT LIKE 'RDB\$%'";
|
||||
$this->statement = $this->query($sql);
|
||||
|
||||
return $this->fetch(PDO::FETCH_NUM);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ class firebird_manip extends db_manip{
|
||||
// 'constraint' => ...,
|
||||
// 'index' => ...,
|
||||
// )
|
||||
foreach($columns as $colname => $type)
|
||||
foreach($fields as $colname => $type)
|
||||
{
|
||||
if(is_numeric($colname))
|
||||
{
|
||||
@ -63,7 +63,7 @@ class firebird_manip extends db_manip{
|
||||
foreach($column_array as $n => $props)
|
||||
{
|
||||
$str = "{$n} ";
|
||||
$str .= (isset($props['type'])) ? "{$props['type']}" : "";
|
||||
$str .= (isset($props['type'])) ? "{$props['type']} " : "";
|
||||
$str .= (isset($props['constraint'])) ? "{$props['constraint']} " : "";
|
||||
|
||||
$columns[] = $str;
|
||||
@ -85,7 +85,7 @@ class firebird_manip extends db_manip{
|
||||
*/
|
||||
function delete_table($name)
|
||||
{
|
||||
return "DELETE TABLE {$name}";
|
||||
return "DROP TABLE \"{$name}\"";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,13 +37,24 @@ class FirebirdTest extends UnitTestCase {
|
||||
$this->assertIsA($this->db, 'Firebird');
|
||||
}
|
||||
|
||||
function TestGetTables()
|
||||
{
|
||||
$tables = $this->db->get_tables();
|
||||
|
||||
print_r($tables);
|
||||
}
|
||||
|
||||
function TestCreateDatabase()
|
||||
{
|
||||
|
||||
//Attempt to create the table
|
||||
$sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT'), array('id' => 'PRIMARY KEY'));
|
||||
//echo '<br />'.$sql.'<br />';
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function TestDeleteDatabase()
|
||||
{
|
||||
|
||||
$sql = $this->db->manip->delete_table('create_test');
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user