2012-03-15 09:25:18 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @link https://github.com/aviat4ion/Query
|
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ODBC Database Driver
|
|
|
|
*
|
|
|
|
* For general database access for databases not specified by the main drivers
|
|
|
|
*
|
|
|
|
* @extends DB_PDO
|
|
|
|
*/
|
|
|
|
class ODBC extends DB_PDO {
|
|
|
|
|
2012-04-13 11:53:11 -04:00
|
|
|
// Don't define the escape char - or define it in sub-drivers in a refactor
|
|
|
|
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
|
|
|
*
|
|
|
|
* @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-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
|
|
|
|
2012-03-15 09:25:18 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of rows returned for a SELECT query
|
2012-04-10 14:06:34 -04:00
|
|
|
*
|
2012-03-15 09:25:18 -04:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function num_rows()
|
|
|
|
{
|
2012-04-10 14:06:34 -04:00
|
|
|
// @TODO: Implement
|
2012-03-15 09:25:18 -04:00
|
|
|
}
|
|
|
|
}
|
2012-04-10 14:06:34 -04:00
|
|
|
// End of odbc_driver.php
|