2012-03-15 09:25:18 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
2012-04-20 13:17:39 -04:00
|
|
|
* @package Query
|
|
|
|
* @author Timothy J. Warren
|
2012-03-15 09:25:18 -04:00
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @link https://github.com/aviat4ion/Query
|
2012-04-20 13:17:39 -04:00
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
2012-03-15 09:25:18 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ODBC Database Driver
|
|
|
|
*
|
|
|
|
* For general database access for databases not specified by the main drivers
|
|
|
|
*
|
2012-04-20 13:17:39 -04:00
|
|
|
* @package Query
|
|
|
|
* @subpackage Drivers
|
2012-03-15 09:25:18 -04:00
|
|
|
*/
|
|
|
|
class ODBC extends DB_PDO {
|
|
|
|
|
2012-04-19 11:42:50 -04:00
|
|
|
/**
|
|
|
|
* Don't define the escape char - or define it in sub-drivers in a refactor
|
|
|
|
*/
|
2012-04-13 11:53:11 -04:00
|
|
|
protected $escape_char = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use ODBC to connect to a database
|
|
|
|
*
|
|
|
|
* @param string $dsn
|
|
|
|
* @param string $username
|
|
|
|
* @param string $password
|
|
|
|
* @param array $options
|
|
|
|
*/
|
2012-03-15 09:25:18 -04:00
|
|
|
public function __construct($dsn, $username=null, $password=null, $options=array())
|
|
|
|
{
|
|
|
|
parent::__construct("odbc:$dsn", $username, $password, $options);
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-04-03 16:54:33 -04:00
|
|
|
/**
|
2012-04-10 14:06:34 -04:00
|
|
|
* Doesn't apply to ODBC
|
2012-04-13 11:53:11 -04:00
|
|
|
*
|
2012-04-19 11:42:50 -04:00
|
|
|
* @param string $name
|
2012-04-13 11:53:11 -04:00
|
|
|
* @return bool
|
2012-04-03 16:54:33 -04:00
|
|
|
*/
|
2012-04-10 14:06:34 -04:00
|
|
|
public function switch_db($name)
|
2012-04-03 16:54:33 -04:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-03-15 09:25:18 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Empty the current database
|
2012-04-10 14:06:34 -04:00
|
|
|
*
|
2012-04-19 11:42:50 -04:00
|
|
|
* @param string $table
|
2012-03-15 09:25:18 -04:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function truncate($table)
|
|
|
|
{
|
|
|
|
$sql = "DELETE FROM {$table}";
|
|
|
|
$this->query($sql);
|
|
|
|
}
|
|
|
|
}
|
2012-04-10 14:06:34 -04:00
|
|
|
// End of odbc_driver.php
|