Version 0.9.5 beta - update for database functionality, updated the db.class.mask, and the mysql autogeneration for files.

This commit is contained in:
Stephan Kasdorf
2019-12-29 20:28:19 +01:00
parent e655936d3f
commit 6010342ad6
4 changed files with 32 additions and 9 deletions

View File

@@ -106,15 +106,18 @@ class Model extends Table
if(Config::getInstance()->getConfig()[self::CONFIG_SECTION]['odbc'])
{
$template = str_replace('[ADAPTER]', self::ADAPTER_POSTGRES, $template);
$template = str_replace('[CONNECTOR]', self::ADAPTER_POSTGRES, $template);
}
else
{
$template = str_replace('[ADAPTER]', self::ADAPTER_POSTGRESQL, $template);
$template = str_replace('[CONNECTOR]', self::ADAPTER_POSTGRESQL, $template);
}
}
if($this->getDatabaseDriver()==self::DB_DRIVER_MYSQL)
{
$template = str_replace('[ADAPTER]', self::ADAPTER_MYSQL, $template);
$template = str_replace('[CONNECTOR]', self::ADAPTER_PDO, $template);
}
if(Config::getInstance()->getConfig()[self::CONFIG_SECTION][self::DB_OVERWRITE_MODELS])

View File

@@ -23,6 +23,7 @@ class Table
const ADAPTER_POSTGRES = "Postgres";
const ADAPTER_POSTGRESQL = "Postgresql";
const ADAPTER_MYSQL = "MySQL";
const ADAPTER_PDO = "Pdo";
const PARAMETERS = array(
'--table',
@@ -228,7 +229,13 @@ class Table
}
if($this->getDatabaseDriver()==self::DB_DRIVER_MYSQL)
{
//TODO: Implement the Table array for MySQL
Pdo::settingsSection( $this->getConfigSection() );
$result = Pdo::queryString('SHOW TABLES;');
foreach ($result as $entry)
{
$this->_setFields(array_shift($entry));
$this->_tables[array_shift($entry)] = $this->getFields();
}
}
}
@@ -344,7 +351,12 @@ class Table
}
if($this->getDatabaseDriver()==self::DB_DRIVER_MYSQL)
{
//TODO: Implement the Table array for MySQL
Pdo::settingsSection( $this->getConfigSection() );
$result = Pdo::queryString('DESCRIBE ' . $table . ';' );
foreach($result as $field)
{
$this->_fields[] = $field['Field'];
}
}
}