Skip to content

Commit

Permalink
added phpdoc in Zend\Db
Browse files Browse the repository at this point in the history
additional changed one exception from \Exception to Zend\Db\Adapter\Exception\InvalidArgumentException
  • Loading branch information
prolic committed Sep 27, 2012
1 parent 836249f commit 6db46d0
Show file tree
Hide file tree
Showing 20 changed files with 470 additions and 21 deletions.
6 changes: 6 additions & 0 deletions library/Zend/Db/Adapter/AdapterAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
*/
interface AdapterAwareInterface
{
/**
* Set db adapter
*
* @param Adapter $adapter
* @return AdapterAwareInterface
*/
public function setDbAdapter(Adapter $adapter);
}
6 changes: 6 additions & 0 deletions library/Zend/Db/Adapter/AdapterServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
*/
class AdapterServiceFactory implements FactoryInterface
{
/**
* Create db adapter service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Adapter
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Configuration');
Expand Down
63 changes: 62 additions & 1 deletion library/Zend/Db/Adapter/Driver/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,75 @@
*/
interface ConnectionInterface
{
/**
* Get current schema
*
* @return string
*/
public function getCurrentSchema();

/**
* Get resource
*
* @return mixed
*/
public function getResource();

/**
* Connect
*
* @return ConnectionInterface
*/
public function connect();

/**
* Is connected
*
* @return bool
*/
public function isConnected();

/**
* Disconnect
*
* @return ConnectionInterface
*/
public function disconnect();

/**
* Begin transaction
*
* @return ConnectionInterface
*/
public function beginTransaction();

/**
* Commit
*
* @return ConnectionInterface
*/
public function commit();

/**
* Rollback
*
* @return ConnectionInterface
*/
public function rollback();
public function execute($sql); // return result set

/**
* Execute
*
* @param string $sql
* @return ResultInterface
*/
public function execute($sql);

/**
* Get last generated id
*
* @param null $name Ignored
* @return integer
*/
public function getLastGeneratedValue($name = null);
}
16 changes: 16 additions & 0 deletions library/Zend/Db/Adapter/Driver/DriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,62 @@ interface DriverInterface
const NAME_FORMAT_NATURAL = 'natural';

/**
* Get database platform name
*
* @param string $nameFormat
* @return string
*/
public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE);

/**
* Check environment
*
* @return bool
*/
public function checkEnvironment();

/**
* Get connection
*
* @return ConnectionInterface
*/
public function getConnection();

/**
* Create statement
*
* @param string|resource $sqlOrResource
* @return StatementInterface
*/
public function createStatement($sqlOrResource = null);

/**
* Create result
*
* @param resource $resource
* @return ResultInterface
*/
public function createResult($resource);

/**
* Get prepare type
*
* @return array
*/
public function getPrepareType();

/**
* Format parameter name
*
* @param string $name
* @param mixed $type
* @return string
*/
public function formatParameterName($name, $type = null);

/**
* Get last generated value
*
* @return mixed
*/
public function getLastGeneratedValue();
Expand Down
8 changes: 8 additions & 0 deletions library/Zend/Db/Adapter/Driver/Feature/AbstractFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ abstract class AbstractFeature
protected $driver = null;

/**
* Set driver
*
* @param DriverInterface $driver
* @return void
*/
public function setDriver(DriverInterface $driver)
{
$this->driver = $driver;
}

/**
* Get name
*
* @return string
*/
abstract public function getName();

}
20 changes: 20 additions & 0 deletions library/Zend/Db/Adapter/Driver/Feature/DriverFeatureInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,27 @@
*/
interface DriverFeatureInterface
{
/**
* Setup the default features for Pdo
*
* @return DriverFeatureInterface
*/
public function setupDefaultFeatures();

/**
* Add feature
*
* @param string $name
* @param mixed $feature
* @return DriverFeatureInterface
*/
public function addFeature($name, $feature);

/**
* Get feature
*
* @param $name
* @return mixed|false
*/
public function getFeature($name);
}
12 changes: 9 additions & 3 deletions library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getResource()
* Connect
*
* @throws Exception\RuntimeException
* @return null
* @return void
*/
public function connect()
{
Expand All @@ -156,7 +156,7 @@ public function connect()
return $p[$name];
}
}
return null;
return;
};

$hostname = $findParameterValue(array('hostname', 'host'));
Expand Down Expand Up @@ -185,7 +185,7 @@ public function connect()
/**
* Is connected
*
* @return boolean
* @return bool
*/
public function isConnected()
{
Expand All @@ -194,6 +194,8 @@ public function isConnected()

/**
* Disconnect
*
* @return void
*/
public function disconnect()
{
Expand All @@ -205,6 +207,8 @@ public function disconnect()

/**
* Begin transaction
*
* @return void
*/
public function beginTransaction()
{
Expand All @@ -218,6 +222,8 @@ public function beginTransaction()

/**
* Commit
*
* @return void
*/
public function commit()
{
Expand Down
19 changes: 19 additions & 0 deletions library/Zend/Db/Adapter/Driver/Mysqli/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Mysqli implements DriverInterface
);

/**
* Constructor
*
* @param array|Connection|\mysqli $connection
* @param null|Statement $statementPrototype
* @param null|Result $resultPrototype
Expand Down Expand Up @@ -88,6 +90,8 @@ public function registerStatementPrototype(Statement $statementPrototype)
}

/**
* Get statement prototype
*
* @return null|Statement
*/
public function getStatementPrototype()
Expand Down Expand Up @@ -130,6 +134,9 @@ public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCAS

/**
* Check environment
*
* @throws Exception\RuntimeException
* @return void
*/
public function checkEnvironment()
{
Expand All @@ -139,6 +146,8 @@ public function checkEnvironment()
}

/**
* Get connection
*
* @return Connection
*/
public function getConnection()
Expand All @@ -147,6 +156,8 @@ public function getConnection()
}

/**
* Create statement
*
* @param string $sqlOrResource
* @return Statement
*/
Expand Down Expand Up @@ -175,6 +186,8 @@ public function createStatement($sqlOrResource = null)
}

/**
* Create result
*
* @param resource $resource
* @param null|bool $isBuffered
* @return Result
Expand All @@ -187,6 +200,8 @@ public function createResult($resource, $isBuffered = null)
}

/**
* Get prepare type
*
* @return array
*/
public function getPrepareType()
Expand All @@ -195,6 +210,8 @@ public function getPrepareType()
}

/**
* Format parameter name
*
* @param string $name
* @param mixed $type
* @return string
Expand All @@ -205,6 +222,8 @@ public function formatParameterName($name, $type = null)
}

/**
* Get last generated value
*
* @return mixed
*/
public function getLastGeneratedValue()
Expand Down
Loading

0 comments on commit 6db46d0

Please sign in to comment.