initial commit

This commit is contained in:
Chris Sewell
2012-11-28 03:55:08 -05:00
parent 7adb399b2e
commit cf140a2e97
3247 changed files with 492437 additions and 0 deletions

View File

@ -0,0 +1,73 @@
<?php
/*
* $Id: CodeBaseAdapter.php,v 1.3 2005/10/17 19:03:51 dlawson_mi Exp $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://creole.phpdb.org>.
*/
require_once 'creole/drivers/odbc/adapters/ODBCAdapter.php';
/**
* CodeBase driver-specific behavior.
*
* This adapter is for Sequiter's CodeBaseSQL product. It is a dBase ODBC
* driver. The driver only supports forward-only cursor scrolling so this
* adapter causes the ODBCCachedResultSet to be used.
*
* A couple other quirks exist:
*
* 1) Cannot get blobs to work correctly. If I try writing one to a
* LONGVARBINARY typed field, only the first few bytes are written.
* This will cause the ResultSetTest::testGetBlob() test case to fail
* when running tests for the driver.
*
* 2) For some reason the character count is off for the
* ResultSetTest::testSetClob() test case _only_ when running from the
* command line. If I run the same test through a web server it works fine.
* Looks like it has something to do with line endings in Windows. The
* difference in file sizes is 9803 vs 10090.
*
* 3) Setting a clob field to null writes a space to the field in the table.
* This causes the PreparedStatementTest::testSetNull() test case to fail
* when running tests for the driver.
*
* @author Dave Lawson <dlawson@masterytech.com>
* @version $Revision: 1.3 $
* @package creole.drivers.odbc
*/
class CodeBaseAdapter extends ODBCAdapter
{
/**
* @see ODBCAdapter::createResultSet()
*/
public function preservesColumnCase()
{
return false;
}
/**
* @see ODBCAdapter::createResultSet()
*/
public function createResultSet($conn, $odbcresult, $fetchmode)
{
require_once 'creole/drivers/odbc/ODBCResultSet.php';
return new ODBCResultSet($conn, $odbcresult, $fetchmode, true);
}
}
?>

View File

@ -0,0 +1,78 @@
<?php
/*
* $Id: MySQLAdapter.php,v 1.1 2004/07/27 23:08:30 hlellelid Exp $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://creole.phpdb.org>.
*/
require_once 'creole/drivers/odbc/ODBCCachedResultSet.php';
require_once 'creole/drivers/odbc/ODBCResultSet.php';
require_once 'creole/drivers/odbc/adapters/ODBCAdapter.php';
/**
* Implements MySQL driver-specific behavior.
*
* Obviously it would be much more efficient to simply use the Creole
* MySQL driver. This adapter was created for the sole purpose of testing
* the ODBC driver.
*
* @author Dave Lawson <dlawson@masterytech.com>
* @version $Revision: 1.1 $
* @package creole.drivers.odbc
*/
class MySQLAdapter extends ODBCAdapter
{
/**
* @see ODBCAdapter::hasLimitOffset()
*/
public function hasLimitOffset()
{
return true;
}
/**
* @see ODBCAdapter::applyLimit()
*/
public function applyLimit(&$sql, $offset, $limit)
{
if ( $limit > 0 ) {
$sql .= " LIMIT " . ($offset > 0 ? $offset . ", " : "") . $limit;
} else if ( $offset > 0 ) {
$sql .= " LIMIT " . $offset . ", 18446744073709551615";
}
}
/**
* @see ODBCAdapter::escape()
*/
public function escape($str)
{
return addslashes($str);
}
/**
* @see ODBCAdapter::createResultSet()
*/
public function createResultSet($conn, $odbcresult, $fetchmode)
{
// return new ODBCCachedResultSet($conn, $odbcresult, $fetchmode, true);
return new ODBCResultSet($conn, $odbcresult, $fetchmode);
}
}
?>

View File

@ -0,0 +1,115 @@
<?php
/*
* $Id: ODBCAdapter.php,v 1.3 2005/10/17 19:03:51 dlawson_mi Exp $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://creole.phpdb.org>.
*/
/**
* Default class for ODBC driver-specific behavior.
*
* @author Dave Lawson <dlawson@masterytech.com>
* @version $Revision: 1.3 $
* @package creole.drivers.odbc
*/
class ODBCAdapter
{
/**
* Returns true if column case is preserved in the database when a table
* is first created. Returns false if table does not preserve case (i.e.
* ProductID => PRODUCTID).
*
* @return boolean
*/
public function preservesColumnCase()
{
return true;
}
/**
* Returns true if prepared statements should be emulated. This
* might be useful if your driver does not support (or has trouble with)
* prepared statements.
*
* @return boolean
*/
public function emulatePrepareStmt()
{
return false;
}
/**
* Returns true if ODBC driver supports LIMIT/OFFSET via SQL.
*
* @return boolean
*/
public function hasLimitOffset()
{
return false;
}
/**
* @see Connection::applyLimit()
*/
public function applyLimit(&$sql, $offset, $limit)
{
}
/**
* @see PreparedStatementCommon::escape()
*/
public function escape($str)
{
// use this instead of magic_quotes_sybase + addslashes(),
// just in case multiple RDBMS being used at the same time
return str_replace("'", "''", $str);
}
/**
* Returns an instance of the default resultset.
*
* @return boolean
*/
public function createResultSet($conn, $odbcresult, $fetchmode)
{
require_once 'creole/drivers/odbc/ODBCResultSet.php';
return new ODBCResultSet($conn, $odbcresult, $fetchmode);
}
/**
* Returns the default ODBCIdGenerator for emulating sequences.
*
* @return ODBCIdGenerator
*/
public function getIdGenerator($conn)
{
require_once 'creole/drivers/odbc/ODBCIdGenerator.php';
return new ODBCIdGenerator($conn);
}
/**
* Returns true if driver support transactions.
*
* @return boolean
*/
public function supportsTransactions()
{
return true;
}
}
?>