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
|
2014-01-02 12:36:50 -05:00
|
|
|
* @copyright Copyright (c) 2012 - 2014
|
2012-03-15 09:25:18 -04:00
|
|
|
* @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())
|
|
|
|
{
|
2012-04-23 13:28:49 -04:00
|
|
|
parent::__construct("odbc:{$dsn}", $username, $password, $options);
|
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);
|
|
|
|
}
|
2013-05-03 13:07:34 -04:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create sql for batch insert
|
|
|
|
*
|
|
|
|
* @param string $table
|
|
|
|
* @param array $data
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function insert_batch($table, $data=array())
|
|
|
|
{
|
|
|
|
// This is not very applicable to the firebird database
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-03-15 09:25:18 -04:00
|
|
|
}
|
2014-02-04 20:59:30 -05:00
|
|
|
// End of odbc_driver.php
|