Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Akiban Driver Implementation that Uses PDO #191

Closed
wants to merge 96 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
16e0692
Add akibansrv to list of available drivers in DriverManager class.
posulliv Aug 11, 2012
aba8430
Add simple implementation of Driver interface for Akiban Server.
posulliv Aug 11, 2012
2fe3944
Simple implementation of Connection interface for Akiban Server. Not …
posulliv Aug 11, 2012
2851f2c
Add simple exception wrapper for AkibanSrv exceptions.
posulliv Aug 11, 2012
6ce2ae9
Add skeleton for AkibanSrvStatement class that implements Statement i…
posulliv Aug 11, 2012
c5e757f
Add skeleton for Akiban Server schema manager.
posulliv Aug 11, 2012
c750b4e
Skeleton for AkibanServerPlatform implementation. Most methods need t…
posulliv Aug 11, 2012
b5e6946
Update akiban driver implementation to use correct names for platform…
posulliv Aug 11, 2012
4ad4453
Update function for getting next sequence value.
posulliv Aug 11, 2012
fa487b6
Implement function for generating SQL to create sequences.
posulliv Aug 11, 2012
025fd93
Akiban does not need to implement function for returning now expressi…
posulliv Aug 11, 2012
ad5cd9f
Akiban does not support regular expressions at this time.
posulliv Aug 11, 2012
74ff267
Implement getLocateExpression function.
posulliv Aug 11, 2012
9e5af6b
Implement getDateDiffExpression function.
posulliv Aug 11, 2012
227f159
Implement getDateAddDaysExpression function.
posulliv Aug 11, 2012
4f25bd2
Implement getDateSubDaysExpression function.
posulliv Aug 11, 2012
b2141df
Implement getDateAddMonthExpression function.
posulliv Aug 11, 2012
6c97818
Implement getDateSubMonthExpression function.
posulliv Aug 11, 2012
2fcc4c9
Implement getListTablesSQL function.
posulliv Aug 11, 2012
db4e494
Implement getListViewsSQL function.
posulliv Aug 11, 2012
ed04fa2
Implement getCreateViewSQL function.
posulliv Aug 11, 2012
87c0974
Implement getListDatabasesSQL function.
posulliv Aug 11, 2012
755a2d4
Add cascade to drop schema command. This ensures a schema is dropped …
posulliv Aug 11, 2012
85e5f1c
Akiban does not support ALTER SEQUENCE yet so throw an unsupported ex…
posulliv Aug 11, 2012
1e96fff
Implement getSchemaNames function.
posulliv Aug 13, 2012
cc50f53
Implement dropDatabase function.
posulliv Aug 13, 2012
4c8020b
Implement createDatabase function.
posulliv Aug 13, 2012
d4166e9
Add parameter checking to dropDatabase function.
posulliv Aug 13, 2012
d4003ab
Use functions from abstract class for trigger related functionality.
posulliv Aug 13, 2012
47b70ae
Copy implementation of _getPortableViewDefintion from PostgreSQL imp…
posulliv Aug 13, 2012
010cb79
Use PostgreSQL implementation of _getPortableUserDefinition function.
posulliv Aug 13, 2012
8b547df
Implement _getPortableTableDefinition table.
posulliv Aug 13, 2012
240afe1
Implement _getPortableDatabaseDefinition function.
posulliv Aug 13, 2012
d05326b
Implement _getPortableSequenceDefintion function.
posulliv Aug 13, 2012
8259c93
Use copy of PostgreSQL keywords for Akiban Server keywords for now.
posulliv Aug 13, 2012
660dee4
Akiban Server will not implement _getPortableTableForeignKeyDefinitio…
posulliv Aug 13, 2012
52c882f
Implement getSubstringExpression function.
posulliv Aug 13, 2012
8703c4c
Simple implementation of getListTableIndexesSQL function. Not sure if…
posulliv Aug 13, 2012
8fde2b7
Implement initializeDoctrineTypeMappings function. This function has …
posulliv Aug 13, 2012
81123e0
Implemented the getTimeTypeDeclarationSQL function.
posulliv Aug 13, 2012
6d58a7a
Implement getDateTimeTypeDeclaration function. Taken from MySQL imple…
posulliv Aug 13, 2012
63889e3
Implement getBooleanTypeDeclarationSQL function.
posulliv Aug 13, 2012
269f118
Implement getListSequencesSQL function.
posulliv Aug 13, 2012
32961fa
Throw unsupported operation exception if an attempt is made to change…
posulliv Aug 13, 2012
682e207
No need for akiban server to implement convertBooleans function.
posulliv Aug 13, 2012
1ed0377
Implement getAlterTableSQL function.
posulliv Aug 13, 2012
05fed4d
Akbian Server does not have date or time data types that support time…
posulliv Aug 13, 2012
b40d8bb
Implement initial version of _getCreateTableSQL function.
posulliv Aug 13, 2012
541fb29
use default implementation of getDropForeignKeySQL for Akiban.
posulliv Aug 13, 2012
4c7c94a
Use default implementation for getAdvancedForeignKeyOptionsSQL function.
posulliv Aug 13, 2012
1df2d9a
Akiban Server does not need getTableWhereClause function.
posulliv Aug 13, 2012
1736d59
Implemenet getListTableColumnsSQL function.
posulliv Aug 13, 2012
3277021
Implemnet getListTableConstraintsSQL function.
posulliv Aug 13, 2012
556273f
Throw un-supported operation exception for getListTableForeignKeysSQL…
posulliv Aug 13, 2012
a9513da
Unit tests can now run against Akiban with most of them obviously fai…
posulliv Aug 13, 2012
e8d0f49
Explicitly specify Akiban does not support savepoints. Flesh out a fe…
posulliv Aug 14, 2012
68dc30d
Implement transaction related methods in AkibanSrvConnection class.
posulliv Aug 14, 2012
44bbb0f
Implement columnCount function in AkibanSrvStatement class.
posulliv Aug 14, 2012
180666e
Specify how Akiban does bit and/or operationsin platform class.
posulliv Aug 14, 2012
31b9f20
Modification to unit test that takes Akiban behavior into account.
posulliv Aug 14, 2012
f18ef46
Implement quote method in AkibanSrvConnection class. Implementation i…
posulliv Aug 14, 2012
490f1f4
Implement remaining methods in AkibanSrvStatement class.
posulliv Aug 14, 2012
499ba2d
Corrections to test around fetch with classes.
posulliv Aug 14, 2012
ccc65fb
Got more unit tests to pass. Failing tests are now related to serial …
posulliv Aug 14, 2012
578ce0a
Use identity columns for auto-increment for now until support for ser…
posulliv Aug 14, 2012
a48684c
Akiban does not support the FOR UPDATE clause at the moment.
posulliv Aug 14, 2012
3d4668f
Akiban does not support nested transactions at the moment so only beg…
posulliv Aug 14, 2012
200ebd8
If running unit tests against Akiban, do not run tests related to tem…
posulliv Aug 15, 2012
15e3204
Get all required information about a sequence from the information_sc…
posulliv Aug 15, 2012
f737f40
Re-enable failing test.
posulliv Aug 15, 2012
366ad07
Implement lastInsertId function in AkibanSrvConnection now that currv…
posulliv Aug 17, 2012
40fe291
Use serial instead of identity columns since akiban now supports it.
posulliv Aug 22, 2012
ef8ba00
Clear up exception message.
posulliv Aug 23, 2012
50e8ce0
Make some formatting of comments more consistent.
posulliv Aug 23, 2012
af2cc93
Remove un-needed variable in AkibanSrvStatement class.
posulliv Aug 23, 2012
0eef622
Simplify code in AkibanSrvStatement class.
posulliv Aug 23, 2012
1aa8278
Clean up code in AkibanSrvStatement class around fetching of results.
posulliv Aug 23, 2012
f276c65
Be more consistent with string quoting.
posulliv Aug 23, 2012
4cf1dee
Implement getUniqueConstraintDeclarationSQL function.
posulliv Aug 23, 2012
2044afb
Akiban does not support foreign key constraints. Explicitly specify t…
posulliv Aug 23, 2012
a0cea52
Implement some of the remaining functions in Platform and Schema mana…
posulliv Aug 23, 2012
8931cf1
Add test for AkibanSchemaManager.
posulliv Aug 23, 2012
390d5a9
Add tests for AkibanServerPlatform class.
posulliv Aug 23, 2012
ab0a456
Expand on comments so it is clear what akiban does/does not support.
posulliv Aug 24, 2012
f7b0275
Correct unit tests around akiban platform class.
posulliv Aug 24, 2012
316ee6d
Revert unit tests back to way they used to be.
posulliv Aug 24, 2012
116640e
Changed a unit test by accident.
posulliv Aug 24, 2012
f1dab8e
Akiban does not support savepoints so make sure test reflects that.
posulliv Aug 24, 2012
abb7b55
Apply comments from pull request 188. Also clean up code to adhere to…
posulliv Aug 24, 2012
6003fae
Missed one place where strict comparisons should be used.
posulliv Aug 24, 2012
af23244
Applying second round of review comments from pull request 188.
posulliv Aug 25, 2012
f9b8445
Akiban driver implementation that uses the PostgreSQL PDO driver.
posulliv Aug 27, 2012
bc6f5da
Remove un-needed require.
posulliv Aug 27, 2012
40104b8
Skip tests that rely on lastInsertId function.
posulliv Aug 27, 2012
06c65a8
Small cleanup to adhere to coding standards.
posulliv Aug 27, 2012
29dd2e9
Resolve issue that only happens in test when run against different DB…
posulliv Aug 27, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
102 changes: 102 additions & 0 deletions lib/Doctrine/DBAL/Driver/AkibanSrv/Driver.php
@@ -0,0 +1,102 @@
<?php
/*
* 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 MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\DBAL\Driver\AkibanSrv;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\AkibanServerPlatform;
use Doctrine\DBAL\Schema\AkibanServerSchemaManager;

/**
* Driver that connects to Akiban Server through pdo_pgsql.
*
* @author Padraig O'Sullivan <osullivan.padraig@gmail.com>
* @since 2.4
*/
class Driver implements \Doctrine\DBAL\Driver
{
/**
* {@inheritDoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDOConnection(
$this->constructPdoDsn($params),
$username,
$password,
$driverOptions
);
}

/**
* Constructs the Akiban Server PDO DSN.
*
* @return string The DSN.
*/
private function constructPdoDsn(array $params)
{
$dsn = 'pgsql:';
if (! empty($params['host'])) {
$dsn .= 'host=' . $params['host'] . ' ';
}
if (! empty($params['port'])) {
$dsn .= 'port=' . $params['port'] . ' ';
}
if (! empty($params['dbname'])) {
$dsn .= 'dbname=' . $params['dbname'] . ' ';
}

return $dsn;
}

/**
* {@inheritDoc}
*/
public function getDatabasePlatform()
{
return new AkibanServerPlatform();
}

/**
* {@inheritDoc}
*/
public function getSchemaManager(Connection $conn)
{
return new AkibanServerSchemaManager($conn);
}

/**
* {@inheritDoc}
*/
public function getName()
{
return 'akibansrv';
}

/**
* {@inheritDoc}
*/
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
return $params['dbname'];
}
}

2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/DriverManager.php
Expand Up @@ -49,6 +49,7 @@ final class DriverManager
'mysqli' => 'Doctrine\DBAL\Driver\Mysqli\Driver',
'drizzle_pdo_mysql' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver',
'sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver',
'akibansrv' => 'Doctrine\DBAL\Driver\AkibanSrv\Driver',
);

/** Private constructor. This class cannot be instantiated. */
Expand All @@ -74,6 +75,7 @@ private function __construct() { }
* sqlsrv
* ibm_db2 (unstable)
* drizzle_pdo_mysql
* akibansrv
*
* OR 'driverClass' that contains the full class name (with namespace) of the
* driver class to instantiate.
Expand Down