mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16955] Clean up code in db classes
PHPBB3-16955
This commit is contained in:
@@ -51,25 +51,30 @@ class factory
|
||||
// Return the appropriate DB extractor
|
||||
if ($this->db instanceof \phpbb\db\driver\mssql_base)
|
||||
{
|
||||
return $this->container->get('dbal.extractor.extractors.mssql_extractor');
|
||||
$extractor = $this->container->get('dbal.extractor.extractors.mssql_extractor');
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\mysql_base)
|
||||
{
|
||||
return $this->container->get('dbal.extractor.extractors.mysql_extractor');
|
||||
$extractor = $this->container->get('dbal.extractor.extractors.mysql_extractor');
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\oracle)
|
||||
{
|
||||
return $this->container->get('dbal.extractor.extractors.oracle_extractor');
|
||||
$extractor = $this->container->get('dbal.extractor.extractors.oracle_extractor');
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\postgres)
|
||||
{
|
||||
return $this->container->get('dbal.extractor.extractors.postgres_extractor');
|
||||
$extractor = $this->container->get('dbal.extractor.extractors.postgres_extractor');
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\sqlite3)
|
||||
{
|
||||
return $this->container->get('dbal.extractor.extractors.sqlite3_extractor');
|
||||
$extractor = $this->container->get('dbal.extractor.extractors.sqlite3_extractor');
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \InvalidArgumentException('Invalid database driver given');
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Invalid database driver given');
|
||||
/** @var \phpbb\db\extractor\extractor_interface $extractor */
|
||||
return $extractor;
|
||||
}
|
||||
}
|
||||
|
@@ -194,12 +194,12 @@ class mssql_extractor extends base_extractor
|
||||
* Extracts data from database table (for MSSQL Native driver)
|
||||
*
|
||||
* @param string $table_name name of the database table
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
protected function write_data_mssqlnative($table_name)
|
||||
{
|
||||
if (!$this->is_initialized)
|
||||
if (!$this->is_initialized || !$this->db instanceof \phpbb\db\driver\mssqlnative)
|
||||
{
|
||||
throw new extractor_not_initialized_exception();
|
||||
}
|
||||
|
@@ -184,12 +184,12 @@ class oracle_extractor extends base_extractor
|
||||
FROM $table_name";
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$i_num_fields = ocinumcols($result);
|
||||
$i_num_fields = oci_num_fields($result);
|
||||
|
||||
for ($i = 0; $i < $i_num_fields; $i++)
|
||||
{
|
||||
$ary_type[$i] = ocicolumntype($result, $i + 1);
|
||||
$ary_name[$i] = ocicolumnname($result, $i + 1);
|
||||
$ary_type[$i] = oci_field_type($result, $i + 1);
|
||||
$ary_name[$i] = oci_field_name($result, $i + 1);
|
||||
}
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
|
Reference in New Issue
Block a user