Skip to content

Instantly share code, notes, and snippets.

@3D-I
Created February 4, 2017 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3D-I/eb0f2b07c00e87963c36680d54ee8bf8 to your computer and use it in GitHub Desktop.
Save 3D-I/eb0f2b07c00e87963c36680d54ee8bf8 to your computer and use it in GitHub Desktop.
phpbb/db/tools service replacement- phpBB 3.1
<?php
/* Your extension namespace here */
namespace my_vendor\my_awesome_extension_name;
/* Your filename (w/extension) for this class here */
class db_tools_service_replacement extends \phpbb\db\tools
{
public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false)
{
parent::__construct($db);
/* Your DB Tools DBAL's additional replacements */
$float_type = array(
'mysql_41' => 'float(10, 5)',
'mysql_40' => 'float(10, 5)',
'mssql' => '[float]',
'mssqlnative' => '[float]',
'oracle' => 'number(10, 5)',
'sqlite' => 'float(10, 5)',
'sqlite3' => 'float(10, 5)',
'postgres' => 'float(10, 5)',
);
foreach ($float_type as $sql_layer => $type)
{
/* The name of the DB Tools addition here */
$this->dbms_type_map[$sql_layer]['FLOAT'] = $type;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment