Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Move remaining code from JDatabase to JDatabaseDriver. #1158

Merged
merged 2 commits into from
Apr 17, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/joomla/base/adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class JAdapter extends JObject
/**
* Database Connector Object
*
* @var JDatabase
* @var JDatabaseDriver
* @since 11.1
*/
protected $_db;
Expand All @@ -81,7 +81,7 @@ public function __construct($basepath, $classprefix = null, $adapterfolder = nul
/**
* Get the database connector object
*
* @return JDatabase Database connector object
* @return JDatabaseDriver Database connector object
*
* @since 11.1
*/
Expand Down
8 changes: 4 additions & 4 deletions libraries/joomla/database/driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ abstract public function connected();
* @param string $table The name of the database table to drop.
* @param boolean $ifExists Optionally specify that the table must exist before it is dropped.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriver Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down Expand Up @@ -1260,7 +1260,7 @@ public function loadRowList($key = null)
*
* @param string $tableName The name of the table to unlock.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriver Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down Expand Up @@ -1471,7 +1471,7 @@ public function replacePrefix($sql, $prefix = '#__')
* @param string $backup Table prefix
* @param string $prefix For the table - used to rename constraints in non-mysql databases
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriver Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down Expand Up @@ -1668,7 +1668,7 @@ abstract public function execute();
/**
* Unlocks tables in the database.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriver Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/database/driver/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public function execute()
* @param string $backup Not used by MySQL.
* @param string $prefix Not used by MySQL.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverMysql Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/database/driver/oracle.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public function setUTF()
*
* @param string $table The name of the table to unlock.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverOracle Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand All @@ -431,7 +431,7 @@ public function lockTable($table)
* @param string $backup Not used by Oracle.
* @param string $prefix Not used by Oracle.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverOracle Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand All @@ -446,7 +446,7 @@ public function renameTable($oldTable, $newTable, $backup = null, $prefix = null
/**
* Unlocks tables in the database.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverOracle Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/database/driver/postgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public function insertid()
*
* @param string $tableName The name of the table to unlock.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverPostgresql Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down Expand Up @@ -662,7 +662,7 @@ public function execute()
* @param string $backup Not used by PostgreSQL.
* @param string $prefix Not used by PostgreSQL.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverPostgresql Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down Expand Up @@ -1148,7 +1148,7 @@ public function transactionSavepoint( $savepointName )
* Unlocks tables in the database, this command does not exist in PostgreSQL,
* it is automatically done on commit or rollback.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverPostgresql Returns this object to support chaining.
*
* @since 11.4
* @throws RuntimeException
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/database/driver/sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function setUTF()
*
* @param string $table The name of the table to unlock.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlite Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand All @@ -343,7 +343,7 @@ public function lockTable($table)
* @param string $backup Not used by Sqlite.
* @param string $prefix Not used by Sqlite.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlite Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand All @@ -358,7 +358,7 @@ public function renameTable($oldTable, $newTable, $backup = null, $prefix = null
/**
* Unlocks tables in the database.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlite Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/database/driver/sqlsrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ protected function limit($sql, $limit, $offset)
* @param string $backup Table prefix
* @param string $prefix For the table - used to rename constraints in non-mysql databases
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlsrv Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand Down Expand Up @@ -955,7 +955,7 @@ public function renameTable($oldTable, $newTable, $backup = null, $prefix = null
*
* @param string $tableName The name of the table to lock.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlsrv Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand All @@ -968,7 +968,7 @@ public function lockTable($tableName)
/**
* Unlocks tables in the database.
*
* @return JDatabase Returns this object to support chaining.
* @return JDatabaseDriverSqlsrv Returns this object to support chaining.
*
* @since 12.1
* @throws RuntimeException
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/date/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,15 @@ public function toISO8601($local = false)
/**
* Gets the date as an SQL datetime string.
*
* @param boolean $local True to return the date string in the local time zone, false to return it in GMT.
* @param JDatabase $dbo The database driver or null to use JFactory::getDbo()
* @param boolean $local True to return the date string in the local time zone, false to return it in GMT.
* @param JDatabaseDriver $dbo The database driver or null to use JFactory::getDbo()
*
* @return string The date string in SQL datetime format.
*
* @link http://dev.mysql.com/doc/refman/5.0/en/datetime.html
* @since 11.4
*/
public function toSql($local = false, JDatabase $dbo = null)
public function toSql($local = false, JDatabaseDriver $dbo = null)
{
if ($dbo === null)
{
Expand Down
20 changes: 4 additions & 16 deletions libraries/joomla/log/loggers/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function addEntry(JLogEntry $entry)
* @return void
*
* @since 11.1
* @throws LogException
* @throws RuntimeException
*/
protected function connect()
{
Expand All @@ -147,21 +147,9 @@ protected function connect()
'database' => $this->database,
'prefix' => $this->prefix);

try
{
$db = JDatabase::getInstance($options);

if ($db instanceof Exception)
{
throw new LogException('Database Error: ' . (string) $db);
}
$db = JDatabaseDriver::getInstance($options);

// Assign the database connector to the class.
$this->dbo = $db;
}
catch (RuntimeException $e)
{
throw new LogException($e->getMessage());
}
// Assign the database connector to the class.
$this->dbo = $db;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

require_once JPATH_PLATFORM . '/joomla/database/importer/postgresql.php';
require_once JPATH_PLATFORM . '/joomla/database/exception.php';

/**
* Class to expose protected properties and methods in JDatabasePostgresqlImporter for testing purposes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function testConnect01()
*
* @since 11.3
*
* @expectedException LogException
* @expectedException RuntimeException
*/
public function testConnect02()
{
Expand Down