[+]: update composer.json (require min. php 7.0) + update "voku/simple-cache"
This commit is contained in:
parent
a93b232c68
commit
d75ace7440
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,6 +1,13 @@
|
||||
# application stuff
|
||||
uploads/*
|
||||
templates_c/*
|
||||
serendipity_config_local.inc.php
|
||||
plugins/additional_plugins*
|
||||
|
||||
# php stuff
|
||||
composer.lock
|
||||
|
||||
# ide / dev stuff
|
||||
.cvsignore
|
||||
.htaccess*
|
||||
*.db
|
||||
@ -8,7 +15,6 @@ private/*
|
||||
archives/*
|
||||
*~
|
||||
DEADJOE
|
||||
plugins/additional_plugins*
|
||||
/.settings
|
||||
/.buildpath
|
||||
/.project
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// autoload.php generated by Composer
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c::getLoader();
|
||||
|
@ -53,8 +53,9 @@ class ClassLoader
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
@ -271,6 +272,26 @@ class ClassLoader
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
@ -313,29 +334,34 @@ class ClassLoader
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
||||
if ('\\' == $class[0]) {
|
||||
$class = substr($class, 1);
|
||||
}
|
||||
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative) {
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if ($file === null && defined('HHVM_VERSION')) {
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if ($file === null) {
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
return $this->classMap[$class] = false;
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
@ -348,10 +374,14 @@ class ClassLoader
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
@ -399,6 +429,8 @@ class ClassLoader
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -7,4 +7,288 @@ $baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Katzgrau\\KLogger\\Logger' => $vendorDir . '/katzgrau/klogger/src/Logger.php',
|
||||
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
|
||||
'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
|
||||
'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
|
||||
'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareInterface.php',
|
||||
'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareTrait.php',
|
||||
'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
|
||||
'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
|
||||
'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
|
||||
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\SimpleCache\\CacheException' => $vendorDir . '/psr/simple-cache/src/CacheException.php',
|
||||
'Psr\\SimpleCache\\CacheInterface' => $vendorDir . '/psr/simple-cache/src/CacheInterface.php',
|
||||
'Psr\\SimpleCache\\InvalidArgumentException' => $vendorDir . '/psr/simple-cache/src/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Adapter\\Adapter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Adapter.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAbstractServiceFactory' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAwareInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAwareTrait' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAwareTrait.php',
|
||||
'Zend\\Db\\Adapter\\AdapterInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterInterface.php',
|
||||
'Zend\\Db\\Adapter\\AdapterServiceFactory' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\AbstractConnection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\ConnectionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\DriverInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/DriverInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Oci8' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Pdo' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\ResultInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\StatementInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidConnectionParametersException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidQueryException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\UnexpectedValueException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/UnexpectedValueException.php',
|
||||
'Zend\\Db\\Adapter\\ParameterContainer' => $vendorDir . '/zendframework/zend-db/src/Adapter/ParameterContainer.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\AbstractPlatform' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Mysql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Mysql.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Oracle' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Oracle.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\PlatformInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Postgresql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Postgresql.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Sql92' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Sql92.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\SqlServer' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/SqlServer.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Sqlite' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Sqlite.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\Profiler' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/Profiler.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\ProfilerInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerInterface.php',
|
||||
'Zend\\Db\\Adapter\\StatementContainer' => $vendorDir . '/zendframework/zend-db/src/Adapter/StatementContainer.php',
|
||||
'Zend\\Db\\Adapter\\StatementContainerInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/StatementContainerInterface.php',
|
||||
'Zend\\Db\\ConfigProvider' => $vendorDir . '/zendframework/zend-db/src/ConfigProvider.php',
|
||||
'Zend\\Db\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Exception\\UnexpectedValueException' => $vendorDir . '/zendframework/zend-db/src/Exception/UnexpectedValueException.php',
|
||||
'Zend\\Db\\Metadata\\Metadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Metadata.php',
|
||||
'Zend\\Db\\Metadata\\MetadataInterface' => $vendorDir . '/zendframework/zend-db/src/Metadata/MetadataInterface.php',
|
||||
'Zend\\Db\\Metadata\\Object\\AbstractTableObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/AbstractTableObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ColumnObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ColumnObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ConstraintKeyObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ConstraintObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\TableObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/TableObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\TriggerObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/TriggerObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ViewObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ViewObject.php',
|
||||
'Zend\\Db\\Metadata\\Source\\AbstractSource' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/AbstractSource.php',
|
||||
'Zend\\Db\\Metadata\\Source\\Factory' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/Factory.php',
|
||||
'Zend\\Db\\Metadata\\Source\\MysqlMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\OracleMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\PostgresqlMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\SqlServerMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\SqliteMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php',
|
||||
'Zend\\Db\\Module' => $vendorDir . '/zendframework/zend-db/src/Module.php',
|
||||
'Zend\\Db\\ResultSet\\AbstractResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/AbstractResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\ResultSet\\HydratingResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/HydratingResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\ResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/ResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\ResultSetInterface' => $vendorDir . '/zendframework/zend-db/src/ResultSet/ResultSetInterface.php',
|
||||
'Zend\\Db\\RowGateway\\AbstractRowGateway' => $vendorDir . '/zendframework/zend-db/src/RowGateway/AbstractRowGateway.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\RowGateway\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\RowGateway\\Feature\\FeatureSet' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php',
|
||||
'Zend\\Db\\RowGateway\\RowGateway' => $vendorDir . '/zendframework/zend-db/src/RowGateway/RowGateway.php',
|
||||
'Zend\\Db\\RowGateway\\RowGatewayInterface' => $vendorDir . '/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php',
|
||||
'Zend\\Db\\Sql\\AbstractExpression' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractExpression.php',
|
||||
'Zend\\Db\\Sql\\AbstractPreparableSql' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractPreparableSql.php',
|
||||
'Zend\\Db\\Sql\\AbstractSql' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractSql.php',
|
||||
'Zend\\Db\\Sql\\Combine' => $vendorDir . '/zendframework/zend-db/src/Sql/Combine.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\AlterTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/AlterTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\BigInteger' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Binary' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Binary.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Blob' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Blob.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Boolean' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Boolean.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Char' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Char.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Column' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Column.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Date' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Date.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Datetime' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Datetime.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Decimal' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Decimal.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Float' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Float.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Floating' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Floating.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Integer' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Integer.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Text' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Text.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Time' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Time.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Timestamp' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Timestamp.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Varbinary' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Varbinary.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Varchar' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Varchar.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/AbstractConstraint.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\Check' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ForeignKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/UniqueKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\CreateTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/CreateTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\DropTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/DropTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Index\\Index' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Index/Index.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\SqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php',
|
||||
'Zend\\Db\\Sql\\Delete' => $vendorDir . '/zendframework/zend-db/src/Sql/Delete.php',
|
||||
'Zend\\Db\\Sql\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Sql\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Sql\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Sql\\Expression' => $vendorDir . '/zendframework/zend-db/src/Sql/Expression.php',
|
||||
'Zend\\Db\\Sql\\ExpressionInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/ExpressionInterface.php',
|
||||
'Zend\\Db\\Sql\\Having' => $vendorDir . '/zendframework/zend-db/src/Sql/Having.php',
|
||||
'Zend\\Db\\Sql\\Insert' => $vendorDir . '/zendframework/zend-db/src/Sql/Insert.php',
|
||||
'Zend\\Db\\Sql\\Join' => $vendorDir . '/zendframework/zend-db/src/Sql/Join.php',
|
||||
'Zend\\Db\\Sql\\Literal' => $vendorDir . '/zendframework/zend-db/src/Sql/Literal.php',
|
||||
'Zend\\Db\\Sql\\Platform\\AbstractPlatform' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php',
|
||||
'Zend\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php',
|
||||
'Zend\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Mysql' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Oracle\\Oracle' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Platform' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Platform.php',
|
||||
'Zend\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Between' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Between.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Expression' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Expression.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\In' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/In.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\IsNotNull' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\IsNull' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/IsNull.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Like' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Like.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Literal' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Literal.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotBetween' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotBetween.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotIn' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotIn.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotLike' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotLike.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Operator' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Operator.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Predicate' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Predicate.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\PredicateInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\PredicateSet' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/PredicateSet.php',
|
||||
'Zend\\Db\\Sql\\PreparableSqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/PreparableSqlInterface.php',
|
||||
'Zend\\Db\\Sql\\Select' => $vendorDir . '/zendframework/zend-db/src/Sql/Select.php',
|
||||
'Zend\\Db\\Sql\\Sql' => $vendorDir . '/zendframework/zend-db/src/Sql/Sql.php',
|
||||
'Zend\\Db\\Sql\\SqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/SqlInterface.php',
|
||||
'Zend\\Db\\Sql\\TableIdentifier' => $vendorDir . '/zendframework/zend-db/src/Sql/TableIdentifier.php',
|
||||
'Zend\\Db\\Sql\\Update' => $vendorDir . '/zendframework/zend-db/src/Sql/Update.php',
|
||||
'Zend\\Db\\Sql\\Where' => $vendorDir . '/zendframework/zend-db/src/Sql/Where.php',
|
||||
'Zend\\Db\\TableGateway\\AbstractTableGateway' => $vendorDir . '/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\FeatureSet' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/FeatureSet.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\MetadataFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\RowGatewayFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\SequenceFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php',
|
||||
'Zend\\Db\\TableGateway\\TableGateway' => $vendorDir . '/zendframework/zend-db/src/TableGateway/TableGateway.php',
|
||||
'Zend\\Db\\TableGateway\\TableGatewayInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php',
|
||||
'Zend\\Stdlib\\AbstractOptions' => $vendorDir . '/zendframework/zend-stdlib/src/AbstractOptions.php',
|
||||
'Zend\\Stdlib\\ArrayObject' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayObject.php',
|
||||
'Zend\\Stdlib\\ArraySerializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php',
|
||||
'Zend\\Stdlib\\ArrayStack' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayStack.php',
|
||||
'Zend\\Stdlib\\ArrayUtils' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php',
|
||||
'Zend\\Stdlib\\ConsoleHelper' => $vendorDir . '/zendframework/zend-stdlib/src/ConsoleHelper.php',
|
||||
'Zend\\Stdlib\\DispatchableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/DispatchableInterface.php',
|
||||
'Zend\\Stdlib\\ErrorHandler' => $vendorDir . '/zendframework/zend-stdlib/src/ErrorHandler.php',
|
||||
'Zend\\Stdlib\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php',
|
||||
'Zend\\Stdlib\\Exception\\DomainException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/DomainException.php',
|
||||
'Zend\\Stdlib\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php',
|
||||
'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php',
|
||||
'Zend\\Stdlib\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Stdlib\\Exception\\LogicException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/LogicException.php',
|
||||
'Zend\\Stdlib\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php',
|
||||
'Zend\\Stdlib\\FastPriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/FastPriorityQueue.php',
|
||||
'Zend\\Stdlib\\Glob' => $vendorDir . '/zendframework/zend-stdlib/src/Glob.php',
|
||||
'Zend\\Stdlib\\Guard\\AllGuardsTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\NullGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php',
|
||||
'Zend\\Stdlib\\InitializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/InitializableInterface.php',
|
||||
'Zend\\Stdlib\\JsonSerializable' => $vendorDir . '/zendframework/zend-stdlib/src/JsonSerializable.php',
|
||||
'Zend\\Stdlib\\Message' => $vendorDir . '/zendframework/zend-stdlib/src/Message.php',
|
||||
'Zend\\Stdlib\\MessageInterface' => $vendorDir . '/zendframework/zend-stdlib/src/MessageInterface.php',
|
||||
'Zend\\Stdlib\\ParameterObjectInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php',
|
||||
'Zend\\Stdlib\\Parameters' => $vendorDir . '/zendframework/zend-stdlib/src/Parameters.php',
|
||||
'Zend\\Stdlib\\ParametersInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParametersInterface.php',
|
||||
'Zend\\Stdlib\\PriorityList' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityList.php',
|
||||
'Zend\\Stdlib\\PriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityQueue.php',
|
||||
'Zend\\Stdlib\\Request' => $vendorDir . '/zendframework/zend-stdlib/src/Request.php',
|
||||
'Zend\\Stdlib\\RequestInterface' => $vendorDir . '/zendframework/zend-stdlib/src/RequestInterface.php',
|
||||
'Zend\\Stdlib\\Response' => $vendorDir . '/zendframework/zend-stdlib/src/Response.php',
|
||||
'Zend\\Stdlib\\ResponseInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ResponseInterface.php',
|
||||
'Zend\\Stdlib\\SplPriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplPriorityQueue.php',
|
||||
'Zend\\Stdlib\\SplQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplQueue.php',
|
||||
'Zend\\Stdlib\\SplStack' => $vendorDir . '/zendframework/zend-stdlib/src/SplStack.php',
|
||||
'Zend\\Stdlib\\StringUtils' => $vendorDir . '/zendframework/zend-stdlib/src/StringUtils.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Iconv' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Intl' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\MbString' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Native' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Native.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php',
|
||||
'voku\\cache\\AdapterApc' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterApc.php',
|
||||
'voku\\cache\\AdapterApcu' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterApcu.php',
|
||||
'voku\\cache\\AdapterArray' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterArray.php',
|
||||
'voku\\cache\\AdapterFile' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterFile.php',
|
||||
'voku\\cache\\AdapterFileAbstract' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php',
|
||||
'voku\\cache\\AdapterFileSimple' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterFileSimple.php',
|
||||
'voku\\cache\\AdapterMemcache' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterMemcache.php',
|
||||
'voku\\cache\\AdapterMemcached' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterMemcached.php',
|
||||
'voku\\cache\\AdapterOpCache' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterOpCache.php',
|
||||
'voku\\cache\\AdapterPredis' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterPredis.php',
|
||||
'voku\\cache\\AdapterXcache' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterXcache.php',
|
||||
'voku\\cache\\Cache' => $vendorDir . '/voku/simple-cache/src/voku/cache/Cache.php',
|
||||
'voku\\cache\\CacheAdapterAutoManager' => $vendorDir . '/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php',
|
||||
'voku\\cache\\CacheChain' => $vendorDir . '/voku/simple-cache/src/voku/cache/CacheChain.php',
|
||||
'voku\\cache\\CachePsr16' => $vendorDir . '/voku/simple-cache/src/voku/cache/CachePsr16.php',
|
||||
'voku\\cache\\Exception\\InvalidArgumentException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/InvalidArgumentException.php',
|
||||
'voku\\cache\\SerializerDefault' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerDefault.php',
|
||||
'voku\\cache\\SerializerIgbinary' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerIgbinary.php',
|
||||
'voku\\cache\\SerializerNo' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerNo.php',
|
||||
'voku\\cache\\iAdapter' => $vendorDir . '/voku/simple-cache/src/voku/cache/iAdapter.php',
|
||||
'voku\\cache\\iCache' => $vendorDir . '/voku/simple-cache/src/voku/cache/iCache.php',
|
||||
'voku\\cache\\iSerializer' => $vendorDir . '/voku/simple-cache/src/voku/cache/iSerializer.php',
|
||||
);
|
||||
|
@ -6,6 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Zend\\Db\\' => array($vendorDir . '/zendframework/zend-db'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
|
||||
);
|
||||
|
@ -7,6 +7,8 @@ $baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'voku\\cache\\' => array($vendorDir . '/voku/simple-cache/src/voku/cache'),
|
||||
'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'),
|
||||
'Zend\\Db\\' => array($vendorDir . '/zendframework/zend-db/src'),
|
||||
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||
'Katzgrau\\KLogger\\' => array($vendorDir . '/katzgrau/klogger/src'),
|
||||
);
|
||||
|
@ -23,7 +23,7 @@ class ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
@ -45,6 +45,7 @@ class ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c
|
||||
}
|
||||
}
|
||||
|
||||
$loader->setApcuPrefix('WIBdJgt9/OFG9RxODXgrL');
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
|
@ -11,6 +11,11 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c
|
||||
array (
|
||||
'voku\\cache\\' => 11,
|
||||
),
|
||||
'Z' =>
|
||||
array (
|
||||
'Zend\\Stdlib\\' => 12,
|
||||
'Zend\\Db\\' => 8,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'Psr\\SimpleCache\\' => 16,
|
||||
@ -26,6 +31,14 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache',
|
||||
),
|
||||
'Zend\\Stdlib\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zendframework/zend-stdlib/src',
|
||||
),
|
||||
'Zend\\Db\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zendframework/zend-db/src',
|
||||
),
|
||||
'Psr\\SimpleCache\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/simple-cache/src',
|
||||
@ -37,13 +50,6 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c
|
||||
);
|
||||
|
||||
public static $prefixesPsr0 = array (
|
||||
'Z' =>
|
||||
array (
|
||||
'Zend\\Db\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zendframework/zend-db',
|
||||
),
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'Psr\\Log\\' =>
|
||||
@ -55,6 +61,290 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c
|
||||
|
||||
public static $classMap = array (
|
||||
'Katzgrau\\KLogger\\Logger' => __DIR__ . '/..' . '/katzgrau/klogger/src/Logger.php',
|
||||
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
|
||||
'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
|
||||
'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
|
||||
'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php',
|
||||
'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php',
|
||||
'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
|
||||
'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
|
||||
'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
|
||||
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\SimpleCache\\CacheException' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheException.php',
|
||||
'Psr\\SimpleCache\\CacheInterface' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheInterface.php',
|
||||
'Psr\\SimpleCache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/simple-cache/src/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Adapter\\Adapter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Adapter.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAbstractServiceFactory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php',
|
||||
'Zend\\Db\\Adapter\\AdapterAwareTrait' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAwareTrait.php',
|
||||
'Zend\\Db\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterInterface.php',
|
||||
'Zend\\Db\\Adapter\\AdapterServiceFactory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\AbstractConnection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\ConnectionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\DriverInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/DriverInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Mysqli\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Oci8' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Oci8\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Pdo' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pdo\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Pgsql\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\ResultInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Connection.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Result.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php',
|
||||
'Zend\\Db\\Adapter\\Driver\\StatementInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidConnectionParametersException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\InvalidQueryException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Adapter\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/UnexpectedValueException.php',
|
||||
'Zend\\Db\\Adapter\\ParameterContainer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/ParameterContainer.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Mysql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Mysql.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Oracle' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Oracle.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\PlatformInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Postgresql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Postgresql.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Sql92' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Sql92.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\SqlServer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/SqlServer.php',
|
||||
'Zend\\Db\\Adapter\\Platform\\Sqlite' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Sqlite.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\Profiler' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/Profiler.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php',
|
||||
'Zend\\Db\\Adapter\\Profiler\\ProfilerInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerInterface.php',
|
||||
'Zend\\Db\\Adapter\\StatementContainer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/StatementContainer.php',
|
||||
'Zend\\Db\\Adapter\\StatementContainerInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/StatementContainerInterface.php',
|
||||
'Zend\\Db\\ConfigProvider' => __DIR__ . '/..' . '/zendframework/zend-db/src/ConfigProvider.php',
|
||||
'Zend\\Db\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/ErrorException.php',
|
||||
'Zend\\Db\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/UnexpectedValueException.php',
|
||||
'Zend\\Db\\Metadata\\Metadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Metadata.php',
|
||||
'Zend\\Db\\Metadata\\MetadataInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/MetadataInterface.php',
|
||||
'Zend\\Db\\Metadata\\Object\\AbstractTableObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/AbstractTableObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ColumnObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ColumnObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ConstraintKeyObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ConstraintObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\TableObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/TableObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\TriggerObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/TriggerObject.php',
|
||||
'Zend\\Db\\Metadata\\Object\\ViewObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ViewObject.php',
|
||||
'Zend\\Db\\Metadata\\Source\\AbstractSource' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/AbstractSource.php',
|
||||
'Zend\\Db\\Metadata\\Source\\Factory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/Factory.php',
|
||||
'Zend\\Db\\Metadata\\Source\\MysqlMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\OracleMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\PostgresqlMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\SqlServerMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php',
|
||||
'Zend\\Db\\Metadata\\Source\\SqliteMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php',
|
||||
'Zend\\Db\\Module' => __DIR__ . '/..' . '/zendframework/zend-db/src/Module.php',
|
||||
'Zend\\Db\\ResultSet\\AbstractResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/AbstractResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\ResultSet\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\ResultSet\\HydratingResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/HydratingResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\ResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/ResultSet.php',
|
||||
'Zend\\Db\\ResultSet\\ResultSetInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/ResultSetInterface.php',
|
||||
'Zend\\Db\\RowGateway\\AbstractRowGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/AbstractRowGateway.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\RowGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\RowGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\RowGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php',
|
||||
'Zend\\Db\\RowGateway\\RowGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/RowGateway.php',
|
||||
'Zend\\Db\\RowGateway\\RowGatewayInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php',
|
||||
'Zend\\Db\\Sql\\AbstractExpression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractExpression.php',
|
||||
'Zend\\Db\\Sql\\AbstractPreparableSql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractPreparableSql.php',
|
||||
'Zend\\Db\\Sql\\AbstractSql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractSql.php',
|
||||
'Zend\\Db\\Sql\\Combine' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Combine.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\AlterTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/AlterTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\BigInteger' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Binary' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Binary.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Blob' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Blob.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Boolean' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Boolean.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Char' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Char.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Column' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Column.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Date' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Date.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Datetime' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Datetime.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Decimal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Decimal.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Float' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Float.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Floating' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Floating.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Integer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Integer.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Text' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Text.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Time' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Time.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Timestamp' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Timestamp.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Varbinary' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Varbinary.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Column\\Varchar' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Varchar.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/AbstractConstraint.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\Check' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ForeignKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/UniqueKey.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\CreateTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/CreateTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\DropTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/DropTable.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\Index\\Index' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Index/Index.php',
|
||||
'Zend\\Db\\Sql\\Ddl\\SqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php',
|
||||
'Zend\\Db\\Sql\\Delete' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Delete.php',
|
||||
'Zend\\Db\\Sql\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\Sql\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\Sql\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\Sql\\Expression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Expression.php',
|
||||
'Zend\\Db\\Sql\\ExpressionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/ExpressionInterface.php',
|
||||
'Zend\\Db\\Sql\\Having' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Having.php',
|
||||
'Zend\\Db\\Sql\\Insert' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Insert.php',
|
||||
'Zend\\Db\\Sql\\Join' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Join.php',
|
||||
'Zend\\Db\\Sql\\Literal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Literal.php',
|
||||
'Zend\\Db\\Sql\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php',
|
||||
'Zend\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php',
|
||||
'Zend\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\Mysql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Oracle\\Oracle' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Platform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Platform.php',
|
||||
'Zend\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php',
|
||||
'Zend\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Between' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Between.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Expression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Expression.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\In' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/In.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\IsNotNull' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\IsNull' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/IsNull.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Like' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Like.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Literal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Literal.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotBetween' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotBetween.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotIn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotIn.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\NotLike' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotLike.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Operator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Operator.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\Predicate' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Predicate.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\PredicateInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php',
|
||||
'Zend\\Db\\Sql\\Predicate\\PredicateSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/PredicateSet.php',
|
||||
'Zend\\Db\\Sql\\PreparableSqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/PreparableSqlInterface.php',
|
||||
'Zend\\Db\\Sql\\Select' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Select.php',
|
||||
'Zend\\Db\\Sql\\Sql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Sql.php',
|
||||
'Zend\\Db\\Sql\\SqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/SqlInterface.php',
|
||||
'Zend\\Db\\Sql\\TableIdentifier' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/TableIdentifier.php',
|
||||
'Zend\\Db\\Sql\\Update' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Update.php',
|
||||
'Zend\\Db\\Sql\\Where' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Where.php',
|
||||
'Zend\\Db\\TableGateway\\AbstractTableGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Db\\TableGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/RuntimeException.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/AbstractFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/FeatureSet.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\MetadataFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\RowGatewayFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php',
|
||||
'Zend\\Db\\TableGateway\\Feature\\SequenceFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php',
|
||||
'Zend\\Db\\TableGateway\\TableGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/TableGateway.php',
|
||||
'Zend\\Db\\TableGateway\\TableGatewayInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php',
|
||||
'Zend\\Stdlib\\AbstractOptions' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/AbstractOptions.php',
|
||||
'Zend\\Stdlib\\ArrayObject' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayObject.php',
|
||||
'Zend\\Stdlib\\ArraySerializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php',
|
||||
'Zend\\Stdlib\\ArrayStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayStack.php',
|
||||
'Zend\\Stdlib\\ArrayUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php',
|
||||
'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php',
|
||||
'Zend\\Stdlib\\ConsoleHelper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ConsoleHelper.php',
|
||||
'Zend\\Stdlib\\DispatchableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/DispatchableInterface.php',
|
||||
'Zend\\Stdlib\\ErrorHandler' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ErrorHandler.php',
|
||||
'Zend\\Stdlib\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php',
|
||||
'Zend\\Stdlib\\Exception\\DomainException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/DomainException.php',
|
||||
'Zend\\Stdlib\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php',
|
||||
'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php',
|
||||
'Zend\\Stdlib\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php',
|
||||
'Zend\\Stdlib\\Exception\\LogicException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/LogicException.php',
|
||||
'Zend\\Stdlib\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php',
|
||||
'Zend\\Stdlib\\FastPriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/FastPriorityQueue.php',
|
||||
'Zend\\Stdlib\\Glob' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Glob.php',
|
||||
'Zend\\Stdlib\\Guard\\AllGuardsTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php',
|
||||
'Zend\\Stdlib\\Guard\\NullGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php',
|
||||
'Zend\\Stdlib\\InitializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/InitializableInterface.php',
|
||||
'Zend\\Stdlib\\JsonSerializable' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/JsonSerializable.php',
|
||||
'Zend\\Stdlib\\Message' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Message.php',
|
||||
'Zend\\Stdlib\\MessageInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/MessageInterface.php',
|
||||
'Zend\\Stdlib\\ParameterObjectInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php',
|
||||
'Zend\\Stdlib\\Parameters' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Parameters.php',
|
||||
'Zend\\Stdlib\\ParametersInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParametersInterface.php',
|
||||
'Zend\\Stdlib\\PriorityList' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityList.php',
|
||||
'Zend\\Stdlib\\PriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityQueue.php',
|
||||
'Zend\\Stdlib\\Request' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Request.php',
|
||||
'Zend\\Stdlib\\RequestInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/RequestInterface.php',
|
||||
'Zend\\Stdlib\\Response' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Response.php',
|
||||
'Zend\\Stdlib\\ResponseInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ResponseInterface.php',
|
||||
'Zend\\Stdlib\\SplPriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplPriorityQueue.php',
|
||||
'Zend\\Stdlib\\SplQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplQueue.php',
|
||||
'Zend\\Stdlib\\SplStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplStack.php',
|
||||
'Zend\\Stdlib\\StringUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringUtils.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Iconv' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Intl' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\MbString' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\Native' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Native.php',
|
||||
'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php',
|
||||
'voku\\cache\\AdapterApc' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterApc.php',
|
||||
'voku\\cache\\AdapterApcu' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterApcu.php',
|
||||
'voku\\cache\\AdapterArray' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterArray.php',
|
||||
'voku\\cache\\AdapterFile' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterFile.php',
|
||||
'voku\\cache\\AdapterFileAbstract' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php',
|
||||
'voku\\cache\\AdapterFileSimple' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterFileSimple.php',
|
||||
'voku\\cache\\AdapterMemcache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterMemcache.php',
|
||||
'voku\\cache\\AdapterMemcached' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterMemcached.php',
|
||||
'voku\\cache\\AdapterOpCache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterOpCache.php',
|
||||
'voku\\cache\\AdapterPredis' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterPredis.php',
|
||||
'voku\\cache\\AdapterXcache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterXcache.php',
|
||||
'voku\\cache\\Cache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Cache.php',
|
||||
'voku\\cache\\CacheAdapterAutoManager' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php',
|
||||
'voku\\cache\\CacheChain' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CacheChain.php',
|
||||
'voku\\cache\\CachePsr16' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CachePsr16.php',
|
||||
'voku\\cache\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/InvalidArgumentException.php',
|
||||
'voku\\cache\\SerializerDefault' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerDefault.php',
|
||||
'voku\\cache\\SerializerIgbinary' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerIgbinary.php',
|
||||
'voku\\cache\\SerializerNo' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerNo.php',
|
||||
'voku\\cache\\iAdapter' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/iAdapter.php',
|
||||
'voku\\cache\\iCache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/iCache.php',
|
||||
'voku\\cache\\iSerializer' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/iSerializer.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
|
@ -1,92 +1,4 @@
|
||||
[
|
||||
{
|
||||
"name": "zendframework/zend-db",
|
||||
"version": "2.2.2",
|
||||
"version_normalized": "2.2.2.0",
|
||||
"target-dir": "Zend/Db",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-db.git",
|
||||
"reference": "release-2.2.2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://packages.zendframework.com/composer/zendframework-zend-db-2.2.2-release-2.2.2-6ab69c.zip",
|
||||
"reference": "release-2.2.2",
|
||||
"shasum": "8bc0c8d19bfd75f9a65a4b332f556c2571424c09"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-stdlib": "2.2.2"
|
||||
},
|
||||
"time": "2013-06-20 18:00:57",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev",
|
||||
"dev-develop": "2.3-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Zend\\Db\\": ""
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": " ",
|
||||
"keywords": [
|
||||
"db",
|
||||
"zf2"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/zendframework/Component_ZendDb/tree/release-2.2.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"shasum": ""
|
||||
},
|
||||
"time": "2012-12-21 11:40:51",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Psr\\Log\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "katzgrau/klogger",
|
||||
"version": "1.0.0",
|
||||
@ -109,7 +21,7 @@
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.0.*"
|
||||
},
|
||||
"time": "2014-03-20 02:36:36",
|
||||
"time": "2014-03-20T02:36:36+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -141,6 +53,46 @@
|
||||
"logging"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"shasum": ""
|
||||
},
|
||||
"time": "2012-12-21T11:40:51+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Psr\\Log\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "psr/simple-cache",
|
||||
"version": "1.0.1",
|
||||
@ -159,7 +111,7 @@
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2017-10-23 01:57:42",
|
||||
"time": "2017-10-23T01:57:42+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -193,17 +145,17 @@
|
||||
},
|
||||
{
|
||||
"name": "voku/simple-cache",
|
||||
"version": "3.2.2",
|
||||
"version_normalized": "3.2.2.0",
|
||||
"version": "4.0.1",
|
||||
"version_normalized": "4.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/voku/simple-cache.git",
|
||||
"reference": "b08d16b4bd802f43f963c2209049f874df83ce56"
|
||||
"reference": "dfda1d803fd79d9ee918e1bac700c94a6f30659c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/voku/simple-cache/zipball/b08d16b4bd802f43f963c2209049f874df83ce56",
|
||||
"reference": "b08d16b4bd802f43f963c2209049f874df83ce56",
|
||||
"url": "https://api.github.com/repos/voku/simple-cache/zipball/dfda1d803fd79d9ee918e1bac700c94a6f30659c",
|
||||
"reference": "dfda1d803fd79d9ee918e1bac700c94a6f30659c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -214,9 +166,9 @@
|
||||
"psr/simple-cache-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0"
|
||||
"phpunit/phpunit": "~6.0 || ~7.0"
|
||||
},
|
||||
"time": "2018-12-21 07:48:39",
|
||||
"time": "2019-03-03T10:23:55+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -243,5 +195,184 @@
|
||||
"php",
|
||||
"simple cache"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-db",
|
||||
"version": "2.10.0",
|
||||
"version_normalized": "2.10.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-db.git",
|
||||
"reference": "320f5faaa0f98ebc93be5476ec4eda28255935c4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://packages.zendframework.com/composer/zendframework-zend-db-2.10.0-5a43dc.zip",
|
||||
"reference": "320f5faaa0f98ebc93be5476ec4eda28255935c4",
|
||||
"shasum": "3f285fe0d475cac25e350787779019caa6ddb188"
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-stdlib": "^2.7 || ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7.25 || ^6.4.4",
|
||||
"zendframework/zend-coding-standard": "~1.0.0",
|
||||
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
|
||||
"zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0",
|
||||
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-eventmanager": "Zend\\EventManager component",
|
||||
"zendframework/zend-hydrator": "Zend\\Hydrator component for using HydratingResultSets",
|
||||
"zendframework/zend-servicemanager": "Zend\\ServiceManager component"
|
||||
},
|
||||
"time": "2019-02-25T11:37:45+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.9-dev",
|
||||
"dev-develop": "2.10-dev"
|
||||
},
|
||||
"zf": {
|
||||
"component": "Zend\\Db",
|
||||
"config-provider": "Zend\\Db\\ConfigProvider"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\Db\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"files": [
|
||||
"test/autoload.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"ZendTest\\Db\\": "test/unit",
|
||||
"ZendIntegrationTest\\Db\\": "test/integration"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"check": [
|
||||
"@cs-check",
|
||||
"@test"
|
||||
],
|
||||
"cs-check": [
|
||||
"phpcs"
|
||||
],
|
||||
"cs-fix": [
|
||||
"phpcbf"
|
||||
],
|
||||
"test": [
|
||||
"phpunit --colors=always --testsuite \"unit test\""
|
||||
],
|
||||
"test-coverage": [
|
||||
"phpunit --colors=always --coverage-clover clover.xml"
|
||||
],
|
||||
"test-integration": [
|
||||
"phpunit --colors=always --testsuite \"integration test\""
|
||||
],
|
||||
"upload-coverage": [
|
||||
"coveralls -v"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations",
|
||||
"keywords": [
|
||||
"db",
|
||||
"zendframework",
|
||||
"zf"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://docs.zendframework.com/zend-db/",
|
||||
"issues": "https://github.com/zendframework/zend-db/issues",
|
||||
"source": "https://github.com/zendframework/zend-db",
|
||||
"rss": "https://github.com/zendframework/zend-db/releases.atom",
|
||||
"slack": "https://zendframework-slack.herokuapp.com",
|
||||
"forum": "https://discourse.zendframework.com/c/questions/components"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-stdlib",
|
||||
"version": "3.2.1",
|
||||
"version_normalized": "3.2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-stdlib.git",
|
||||
"reference": "04e09d7f961b2271b0e1cbbb6f5f53ad23cf8562"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://packages.zendframework.com/composer/zendframework-zend-stdlib-3.2.1-90faf1.zip",
|
||||
"reference": "04e09d7f961b2271b0e1cbbb6f5f53ad23cf8562",
|
||||
"shasum": "36f654611fab0d6fe1ea1c72184a43f9810ce7c8"
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbench/phpbench": "^0.13",
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"time": "2018-08-28T21:34:05+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2.x-dev",
|
||||
"dev-develop": "3.3.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\Stdlib\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"ZendTest\\Stdlib\\": "test/",
|
||||
"ZendBench\\Stdlib\\": "benchmark/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"check": [
|
||||
"@cs-check",
|
||||
"@test"
|
||||
],
|
||||
"cs-check": [
|
||||
"phpcs"
|
||||
],
|
||||
"cs-fix": [
|
||||
"phpcbf"
|
||||
],
|
||||
"test": [
|
||||
"phpunit --colors=always"
|
||||
],
|
||||
"test-coverage": [
|
||||
"phpunit --colors=always --coverage-clover clover.xml"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "SPL extensions, array utilities, error handlers, and more",
|
||||
"keywords": [
|
||||
"stdlib",
|
||||
"zendframework",
|
||||
"zf"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://docs.zendframework.com/zend-stdlib/",
|
||||
"issues": "https://github.com/zendframework/zend-stdlib/issues",
|
||||
"source": "https://github.com/zendframework/zend-stdlib",
|
||||
"rss": "https://github.com/zendframework/zend-stdlib/releases.atom",
|
||||
"slack": "https://zendframework-slack.herokuapp.com",
|
||||
"forum": "https://discourse.zendframework.com/c/questions/components"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
21
bundled-libs/psr/simple-cache/LICENSE.md
Normal file
21
bundled-libs/psr/simple-cache/LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 PHP Framework Interoperability Group
|
||||
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
8
bundled-libs/psr/simple-cache/README.md
Normal file
8
bundled-libs/psr/simple-cache/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
PHP FIG Simple Cache PSR
|
||||
========================
|
||||
|
||||
This repository holds all interfaces related to PSR-16.
|
||||
|
||||
Note that this is not a cache implementation of its own. It is merely an interface that describes a cache implementation. See [the specification](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md) for more details.
|
||||
|
||||
You can find implementations of the specification by looking for packages providing the [psr/simple-cache-implementation](https://packagist.org/providers/psr/simple-cache-implementation) virtual package.
|
25
bundled-libs/psr/simple-cache/composer.json
Normal file
25
bundled-libs/psr/simple-cache/composer.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "psr/simple-cache",
|
||||
"description": "Common interfaces for simple caching",
|
||||
"keywords": ["psr", "psr-16", "cache", "simple-cache", "caching"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\SimpleCache\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
10
bundled-libs/psr/simple-cache/src/CacheException.php
Normal file
10
bundled-libs/psr/simple-cache/src/CacheException.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\SimpleCache;
|
||||
|
||||
/**
|
||||
* Interface used for all types of exceptions thrown by the implementing library.
|
||||
*/
|
||||
interface CacheException
|
||||
{
|
||||
}
|
114
bundled-libs/psr/simple-cache/src/CacheInterface.php
Normal file
114
bundled-libs/psr/simple-cache/src/CacheInterface.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\SimpleCache;
|
||||
|
||||
interface CacheInterface
|
||||
{
|
||||
/**
|
||||
* Fetches a value from the cache.
|
||||
*
|
||||
* @param string $key The unique key of this item in the cache.
|
||||
* @param mixed $default Default value to return if the key does not exist.
|
||||
*
|
||||
* @return mixed The value of the item from the cache, or $default in case of cache miss.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if the $key string is not a legal value.
|
||||
*/
|
||||
public function get($key, $default = null);
|
||||
|
||||
/**
|
||||
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
|
||||
*
|
||||
* @param string $key The key of the item to store.
|
||||
* @param mixed $value The value of the item to store, must be serializable.
|
||||
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
|
||||
* the driver supports TTL then the library may set a default value
|
||||
* for it or let the driver take care of that.
|
||||
*
|
||||
* @return bool True on success and false on failure.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if the $key string is not a legal value.
|
||||
*/
|
||||
public function set($key, $value, $ttl = null);
|
||||
|
||||
/**
|
||||
* Delete an item from the cache by its unique key.
|
||||
*
|
||||
* @param string $key The unique cache key of the item to delete.
|
||||
*
|
||||
* @return bool True if the item was successfully removed. False if there was an error.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if the $key string is not a legal value.
|
||||
*/
|
||||
public function delete($key);
|
||||
|
||||
/**
|
||||
* Wipes clean the entire cache's keys.
|
||||
*
|
||||
* @return bool True on success and false on failure.
|
||||
*/
|
||||
public function clear();
|
||||
|
||||
/**
|
||||
* Obtains multiple cache items by their unique keys.
|
||||
*
|
||||
* @param iterable $keys A list of keys that can obtained in a single operation.
|
||||
* @param mixed $default Default value to return for keys that do not exist.
|
||||
*
|
||||
* @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if $keys is neither an array nor a Traversable,
|
||||
* or if any of the $keys are not a legal value.
|
||||
*/
|
||||
public function getMultiple($keys, $default = null);
|
||||
|
||||
/**
|
||||
* Persists a set of key => value pairs in the cache, with an optional TTL.
|
||||
*
|
||||
* @param iterable $values A list of key => value pairs for a multiple-set operation.
|
||||
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
|
||||
* the driver supports TTL then the library may set a default value
|
||||
* for it or let the driver take care of that.
|
||||
*
|
||||
* @return bool True on success and false on failure.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if $values is neither an array nor a Traversable,
|
||||
* or if any of the $values are not a legal value.
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null);
|
||||
|
||||
/**
|
||||
* Deletes multiple cache items in a single operation.
|
||||
*
|
||||
* @param iterable $keys A list of string-based keys to be deleted.
|
||||
*
|
||||
* @return bool True if the items were successfully removed. False if there was an error.
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if $keys is neither an array nor a Traversable,
|
||||
* or if any of the $keys are not a legal value.
|
||||
*/
|
||||
public function deleteMultiple($keys);
|
||||
|
||||
/**
|
||||
* Determines whether an item is present in the cache.
|
||||
*
|
||||
* NOTE: It is recommended that has() is only to be used for cache warming type purposes
|
||||
* and not to be used within your live applications operations for get/set, as this method
|
||||
* is subject to a race condition where your has() will return true and immediately after,
|
||||
* another script can remove it making the state of your app out of date.
|
||||
*
|
||||
* @param string $key The cache item key.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
* MUST be thrown if the $key string is not a legal value.
|
||||
*/
|
||||
public function has($key);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\SimpleCache;
|
||||
|
||||
/**
|
||||
* Exception interface for invalid cache arguments.
|
||||
*
|
||||
* When an invalid argument is passed it must throw an exception which implements
|
||||
* this interface
|
||||
*/
|
||||
interface InvalidArgumentException extends CacheException
|
||||
{
|
||||
}
|
@ -1,3 +1,15 @@
|
||||
# Changelog 4.0.1 (2019-03-03)
|
||||
|
||||
- hide "warning" about Zend OPcache API is restricted by "restrict_api"
|
||||
|
||||
|
||||
# Changelog 4.0.0 (2019-02-24)
|
||||
|
||||
- add "CacheAdapterAutoManager"
|
||||
- fix typos in "CachePsr16"
|
||||
- "iCache->setItemToDate()" now accepts DateTimeInterface instead of DateTime
|
||||
|
||||
|
||||
# Changelog 3.2.2 (2018-12-21)
|
||||
|
||||
- fix APC(u) detection for CLI usage
|
||||
|
@ -6,10 +6,10 @@
|
||||
[](https://packagist.org/packages/voku/simple-cache)
|
||||
[](https://packagist.org/packages/voku/simple-cache)
|
||||
[](https://packagist.org/packages/voku/simple-cache)
|
||||
[](https://www.paypal.me/moelleken)
|
||||
[](https://www.patreon.com/voku)
|
||||
|
||||
|
||||
:zap: Simple Cache Class
|
||||
===================
|
||||
# :zap: Simple Cache Class
|
||||
|
||||
This is a simple Cache Abstraction Layer for PHP >= 7.0 that provides a simple interaction
|
||||
with your cache-server. You can define the Adapter / Serializer in the "constructor" or the class will auto-detect you server-cache in this order:
|
||||
@ -21,27 +21,26 @@ with your cache-server. You can define the Adapter / Serializer in the "construc
|
||||
5. OpCache (via PHP-files)
|
||||
6. Static-PHP-Cache
|
||||
|
||||
## Get "Simple Cache"
|
||||
### Get "Simple Cache"
|
||||
|
||||
You can download it from here, or require it using [composer](https://packagist.org/packages/voku/simple-cache).
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"voku/simple-cache": "3.*"
|
||||
"voku/simple-cache": "4.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Install via "composer require"
|
||||
### Install via "composer require"
|
||||
|
||||
```shell
|
||||
composer require voku/simple-cache
|
||||
composer require predis/predis # if you will use redis as cache, then add predis
|
||||
```
|
||||
|
||||
|
||||
## Quick Start
|
||||
### Quick Start
|
||||
|
||||
```php
|
||||
use voku\cache\Cache;
|
||||
@ -55,7 +54,7 @@ $bar = $cache->getItem('foo');
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
```php
|
||||
use voku\cache\Cache;
|
||||
@ -100,6 +99,84 @@ If you use the parameter "$checkForUser" (=== true) in the constructor, then the
|
||||
|
||||
-> You can also overwrite the check for the user, if you add a global function named "checkForDev()".
|
||||
|
||||
## Overwrite the auto-connection option
|
||||
|
||||
## License
|
||||
You can overwrite the cache auto-detect via "CacheAdapterAutoManager" and the
|
||||
"$cacheAdapterManagerForAutoConnect" option in the "Cache"-constructor. Additional you can also
|
||||
activate the "$cacheAdapterManagerForAutoConnectOverwrite" option in the "Cache"-constructor, so that
|
||||
you can implement your own cache auto-detect logic.
|
||||
|
||||
```php
|
||||
|
||||
$cacheManager = new \voku\cache\CacheAdapterAutoManager();
|
||||
|
||||
// 1. check for "APCu" support first
|
||||
$cacheManager->addAdapter(
|
||||
\voku\cache\AdapterApcu::class
|
||||
);
|
||||
|
||||
// 2. check for "APC" support
|
||||
$cacheManager->addAdapter(
|
||||
\voku\cache\AdapterApcu::class
|
||||
);
|
||||
|
||||
// 3. try "OpCache"-Cache
|
||||
$cacheManager->addAdapter(
|
||||
\voku\cache\AdapterOpCache::class,
|
||||
static function () {
|
||||
$cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache_opcache';
|
||||
|
||||
return $cacheDir;
|
||||
}
|
||||
);
|
||||
|
||||
// 4. try "File"-Cache
|
||||
$cacheManager->addAdapter(
|
||||
\voku\cache\AdapterFileSimple::class,
|
||||
static function () {
|
||||
$cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache_file';
|
||||
|
||||
return $cacheDir;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// 5. use Memory Cache as final fallback
|
||||
$cacheManager->addAdapter(
|
||||
\voku\cache\AdapterArray::class
|
||||
);
|
||||
|
||||
$cache = new \voku\cache\CachePsr16(
|
||||
null, // use auto-detection
|
||||
null, // use auto-detection
|
||||
false, // do not check for usage
|
||||
true, // enable the cache
|
||||
false, // do not check for admin session
|
||||
false, // do not check for dev
|
||||
false, // do not check for admin session
|
||||
false, // do not check for server vs. client ip
|
||||
'', // do not use "_GET"-parameter for disabling
|
||||
$cacheManager, // new auto-detection logic
|
||||
true // overwrite the auto-detection logic
|
||||
);
|
||||
```
|
||||
|
||||
### Support
|
||||
|
||||
For support and donations please visit [Github](https://github.com/voku/simple-cache/) | [Issues](https://github.com/voku/simple-cache/issues) | [PayPal](https://paypal.me/moelleken) | [Patreon](https://www.patreon.com/voku).
|
||||
|
||||
For status updates and release announcements please visit [Releases](https://github.com/voku/simple-cache/releases) | [Twitter](https://twitter.com/suckup_de) | [Patreon](https://www.patreon.com/voku/posts).
|
||||
|
||||
For professional support please contact [me](https://about.me/voku).
|
||||
|
||||
### Thanks
|
||||
|
||||
- Thanks to [GitHub](https://github.com) (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
|
||||
- Thanks to [IntelliJ](https://www.jetbrains.com) as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
|
||||
- Thanks to [Travis CI](https://travis-ci.com/) for being the most awesome, easiest continous integration tool out there!
|
||||
- Thanks to [StyleCI](https://styleci.io/) for the simple but powerfull code style check.
|
||||
- Thanks to [PHPStan](https://github.com/phpstan/phpstan) && [Psalm](https://github.com/vimeo/psalm) for relly great Static analysis tools and for discover bugs in the code!
|
||||
|
||||
|
||||
### License
|
||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fvoku%2Fsimple-cache?ref=badge_large)
|
||||
|
@ -25,7 +25,7 @@
|
||||
"psr/simple-cache": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0"
|
||||
"phpunit/phpunit": "~6.0 || ~7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -85,7 +85,8 @@ class AdapterApc implements iAdapter
|
||||
* @param bool $limited - If $limited is TRUE, the return value will exclude the individual list of cache
|
||||
* entries. This is useful when trying to optimize calls for statistics gathering
|
||||
*
|
||||
* @return array|bool <p>Array of cached data (and meta-data) or FALSE on failure.</p>
|
||||
* @return array|false
|
||||
* <p>Array of cached data (and meta-data) or FALSE on failure.</p>
|
||||
*/
|
||||
public function cacheInfo(string $type = '', bool $limited = false): array
|
||||
{
|
||||
|
@ -84,7 +84,8 @@ class AdapterApcu implements iAdapter
|
||||
* @param bool $limited - If $limited is TRUE, the return value will exclude the individual list of cache
|
||||
* entries. This is useful when trying to optimize calls for statistics gathering
|
||||
*
|
||||
* @return array|bool <p>Array of cached data (and meta-data) or FALSE on failure.</p>
|
||||
* @return array|false
|
||||
* <p>Array of cached data (and meta-data) or FALSE on failure.</p>
|
||||
*/
|
||||
public function cacheInfo(bool $limited = false): array
|
||||
{
|
||||
|
@ -86,7 +86,9 @@ class AdapterFile extends AdapterFileAbstract
|
||||
\fflush($fp);
|
||||
\flock($fp, \LOCK_UN);
|
||||
}
|
||||
\fclose($fp);
|
||||
if ($fp !== false) {
|
||||
\fclose($fp);
|
||||
}
|
||||
|
||||
return $octetWritten !== false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ abstract class AdapterFileAbstract implements iAdapter
|
||||
protected $fileMode = '0755';
|
||||
|
||||
/**
|
||||
* @param string|null $cacheDir
|
||||
* @param \callable|string|null $cacheDir
|
||||
*/
|
||||
public function __construct($cacheDir = null)
|
||||
{
|
||||
@ -44,9 +44,13 @@ abstract class AdapterFileAbstract implements iAdapter
|
||||
$cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache';
|
||||
}
|
||||
|
||||
$this->cacheDir = (string) $cacheDir;
|
||||
if (\is_callable($cacheDir)) {
|
||||
$this->cacheDir = (string) \call_user_func($cacheDir);
|
||||
} else {
|
||||
$this->cacheDir = (string) $cacheDir;
|
||||
}
|
||||
|
||||
if ($this->createCacheDirectory($cacheDir) === true) {
|
||||
if ($this->createCacheDirectory($this->cacheDir) === true) {
|
||||
$this->installed = true;
|
||||
}
|
||||
}
|
||||
@ -106,14 +110,14 @@ abstract class AdapterFileAbstract implements iAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cacheFile
|
||||
* @param string $cacheFileWithPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function deleteFile($cacheFile): bool
|
||||
protected function deleteFile($cacheFileWithPath): bool
|
||||
{
|
||||
if (\is_file($cacheFile)) {
|
||||
return \unlink($cacheFile);
|
||||
if (\is_file($cacheFileWithPath)) {
|
||||
return \unlink($cacheFileWithPath);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -199,7 +203,7 @@ abstract class AdapterFileAbstract implements iAdapter
|
||||
*
|
||||
* e.g. '0777', or '0755' ...
|
||||
*
|
||||
* @param $fileMode
|
||||
* @param string $fileMode
|
||||
*/
|
||||
public function setFileMode($fileMode)
|
||||
{
|
||||
@ -207,7 +211,7 @@ abstract class AdapterFileAbstract implements iAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ttl
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -29,7 +29,12 @@ class AdapterOpCache extends AdapterFileSimple
|
||||
|
||||
if (self::$hasCompileFileFunction === null) {
|
||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||
self::$hasCompileFileFunction = \function_exists('opcache_compile_file') && !empty(\opcache_get_status());
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
self::$hasCompileFileFunction = (
|
||||
\function_exists('opcache_compile_file')
|
||||
&&
|
||||
!empty(@\opcache_get_status())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,27 @@ use voku\cache\Exception\InvalidArgumentException;
|
||||
class Cache implements iCache
|
||||
{
|
||||
/**
|
||||
* @var iAdapter
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE_EXPIRE = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE_COUNTER = [];
|
||||
|
||||
/**
|
||||
* @var iAdapter|null
|
||||
*/
|
||||
protected $adapter;
|
||||
|
||||
/**
|
||||
* @var iSerializer
|
||||
* @var iSerializer|null
|
||||
*/
|
||||
protected $serializer;
|
||||
|
||||
@ -69,21 +84,6 @@ class Cache implements iCache
|
||||
*/
|
||||
protected $isAdminSession;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE_EXPIRE = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $STATIC_CACHE_COUNTER = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@ -92,19 +92,27 @@ class Cache implements iCache
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param iAdapter|null $adapter
|
||||
* @param iSerializer|null $serializer
|
||||
* @param bool $checkForUsage <p>admin-session || server-ip == client-ip || check for
|
||||
* dev</p>
|
||||
* @param bool $cacheEnabled <p>false will disable the cache (use it e.g. for global
|
||||
* settings)</p>
|
||||
* @param bool|string $isAdminSession <p>set a admin-id, if the user is a admin (so we can
|
||||
* disable cache for this user)
|
||||
* @param bool $useCheckForAdminSession <p>use $isAdminSession flag or not</p>
|
||||
* @param bool $useCheckForDev <p>use checkForDev() or not</p>
|
||||
* @param bool $useCheckForServerIpIsClientIp <p>use check for server-ip == client-ip or not</p>
|
||||
* @param string $disableCacheGetParameter <p>set the _GET parameter for disabling the cache,
|
||||
* disable this check via empty string</p>
|
||||
* @param iAdapter|null $adapter
|
||||
* @param iSerializer|null $serializer
|
||||
* @param bool $checkForUsage <p>check for admin-session && check for
|
||||
* server-ip == client-ip
|
||||
* && check for dev</p>
|
||||
* @param bool $cacheEnabled <p>false === disable the cache (use it
|
||||
* e.g. for global settings)</p>
|
||||
* @param bool $isAdminSession <p>true === disable cache for this user
|
||||
* (use it e.g. for admin user settings)
|
||||
* @param bool $useCheckForAdminSession <p>use $isAdminSession flag or not</p>
|
||||
* @param bool $useCheckForDev <p>use checkForDev() or not</p>
|
||||
* @param bool $useCheckForServerIpIsClientIp <p>use check for server-ip == client-ip
|
||||
* or
|
||||
* not</p>
|
||||
* @param string $disableCacheGetParameter <p>set the _GET parameter for disabling
|
||||
* the cache, disable this check via empty
|
||||
* string</p>
|
||||
* @param CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect <p>Overwrite some Adapters for the
|
||||
* auto-connect-function.</p>
|
||||
* @param bool $cacheAdapterManagerForAutoConnectOverwrite <p>true === Use only Adapters from your
|
||||
* "CacheAdapterManager".</p>
|
||||
*/
|
||||
public function __construct(
|
||||
iAdapter $adapter = null,
|
||||
@ -115,7 +123,9 @@ class Cache implements iCache
|
||||
bool $useCheckForDev = true,
|
||||
bool $useCheckForAdminSession = true,
|
||||
bool $useCheckForServerIpIsClientIp = true,
|
||||
string $disableCacheGetParameter = 'testWithoutCache'
|
||||
string $disableCacheGetParameter = 'testWithoutCache',
|
||||
CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect = null,
|
||||
bool $cacheAdapterManagerForAutoConnectOverwrite = false
|
||||
) {
|
||||
$this->isAdminSession = $isAdminSession;
|
||||
|
||||
@ -128,19 +138,19 @@ class Cache implements iCache
|
||||
// First check if the cache is active at all.
|
||||
$this->isActive = $cacheEnabled;
|
||||
if (
|
||||
$this->isActive === true
|
||||
$this->isActive
|
||||
&&
|
||||
$checkForUsage === true
|
||||
$checkForUsage
|
||||
) {
|
||||
$this->setActive($this->isCacheActiveForTheCurrentUser());
|
||||
}
|
||||
|
||||
// If the cache is active, then try to auto-connect to the best possible cache-system.
|
||||
if ($this->isActive === true) {
|
||||
if ($this->isActive) {
|
||||
$this->setPrefix($this->getTheDefaultPrefix());
|
||||
|
||||
if ($adapter === null) {
|
||||
$adapter = $this->autoConnectToAvailableCacheSystem();
|
||||
$adapter = $this->autoConnectToAvailableCacheSystem($cacheAdapterManagerForAutoConnect, $cacheAdapterManagerForAutoConnectOverwrite);
|
||||
}
|
||||
|
||||
// INFO: Memcache(d) has his own "serializer", so don't use it twice
|
||||
@ -172,93 +182,81 @@ class Cache implements iCache
|
||||
}
|
||||
|
||||
/**
|
||||
* enable / disable the cache
|
||||
* Auto-connect to the available cache-system on the server.
|
||||
*
|
||||
* @param bool $isActive
|
||||
*/
|
||||
public function setActive(bool $isActive)
|
||||
{
|
||||
$this->isActive = $isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the current use is a admin || dev || server == client
|
||||
* @param CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect <p>Overwrite some Adapters for the
|
||||
* auto-connect-function.</p>
|
||||
* @param bool $cacheAdapterManagerForAutoConnectOverwrite <p>true === Use only Adapters from your
|
||||
* "CacheAdapterManager".</p>
|
||||
*
|
||||
* @return bool
|
||||
* @return iAdapter
|
||||
*/
|
||||
public function isCacheActiveForTheCurrentUser(): bool
|
||||
{
|
||||
$active = true;
|
||||
protected function autoConnectToAvailableCacheSystem(
|
||||
CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect = null,
|
||||
bool $cacheAdapterManagerForAutoConnectOverwrite = false
|
||||
): iAdapter {
|
||||
static $AUTO_ADAPTER_STATIC_CACHE = null;
|
||||
|
||||
// test the cache, with this GET-parameter
|
||||
if ($this->disableCacheGetParameter) {
|
||||
$testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int) $_GET[$this->disableCacheGetParameter] : 0;
|
||||
} else {
|
||||
$testCache = 0;
|
||||
if (
|
||||
\is_object($AUTO_ADAPTER_STATIC_CACHE)
|
||||
&&
|
||||
$AUTO_ADAPTER_STATIC_CACHE instanceof iAdapter
|
||||
) {
|
||||
return $AUTO_ADAPTER_STATIC_CACHE;
|
||||
}
|
||||
|
||||
if ($testCache !== 1) {
|
||||
if (
|
||||
// admin session is active
|
||||
(
|
||||
$this->useCheckForAdminSession
|
||||
&&
|
||||
$this->isAdminSession
|
||||
)
|
||||
||
|
||||
// server == client
|
||||
(
|
||||
$this->useCheckForServerIpIsClientIp === true
|
||||
&&
|
||||
isset($_SERVER['SERVER_ADDR'])
|
||||
&&
|
||||
$_SERVER['SERVER_ADDR'] === $this->getClientIp()
|
||||
)
|
||||
||
|
||||
// user is a dev
|
||||
(
|
||||
$this->useCheckForDev === true
|
||||
&&
|
||||
$this->checkForDev() === true
|
||||
)
|
||||
) {
|
||||
$active = false;
|
||||
// init
|
||||
$adapter = null;
|
||||
|
||||
$cacheAdapterManagerDefault = CacheAdapterAutoManager::getDefaultsForAutoInit();
|
||||
|
||||
if ($cacheAdapterManagerForAutoConnect !== null) {
|
||||
if ($cacheAdapterManagerForAutoConnectOverwrite) {
|
||||
$cacheAdapterManagerDefault = $cacheAdapterManagerForAutoConnect;
|
||||
} else {
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManagerDefault->merge($cacheAdapterManagerForAutoConnect);
|
||||
}
|
||||
}
|
||||
|
||||
return $active;
|
||||
foreach ($cacheAdapterManagerDefault->getAdapters() as $adapterTmp => $callableFunctionTmp) {
|
||||
|
||||
/** @var iAdapter $adapterTest */
|
||||
if ($callableFunctionTmp !== null) {
|
||||
$adapterTest = new $adapterTmp($callableFunctionTmp);
|
||||
} else {
|
||||
$adapterTest = new $adapterTmp();
|
||||
}
|
||||
|
||||
if ($adapterTest->installed()) {
|
||||
$adapter = $adapterTest;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// save to static cache
|
||||
$AUTO_ADAPTER_STATIC_CACHE = $adapter;
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the IP address of the client
|
||||
* Calculate store-key (prefix + $rawKey).
|
||||
*
|
||||
* @param bool $trust_proxy_headers <p>
|
||||
* Whether or not to trust the
|
||||
* proxy headers HTTP_CLIENT_IP
|
||||
* and HTTP_X_FORWARDED_FOR. ONLY
|
||||
* use if your $_SERVER is behind a
|
||||
* proxy that sets these values
|
||||
* </p>
|
||||
* @param string $rawKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getClientIp(bool $trust_proxy_headers = false): string
|
||||
protected function calculateStoreKey(string $rawKey): string
|
||||
{
|
||||
$remoteAddr = $_SERVER['REMOTE_ADDR'] ?? 'NO_REMOTE_ADDR';
|
||||
$str = $this->getPrefix() . $rawKey;
|
||||
|
||||
if ($trust_proxy_headers) {
|
||||
return $remoteAddr;
|
||||
if ($this->adapter instanceof AdapterFileAbstract) {
|
||||
$str = $this->cleanStoreKey($str);
|
||||
}
|
||||
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip = $remoteAddr;
|
||||
}
|
||||
|
||||
return $ip;
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -297,182 +295,54 @@ class Cache implements iCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default-prefix via "SERVER"-var + "SESSION"-language.
|
||||
*/
|
||||
protected function getTheDefaultPrefix(): string
|
||||
{
|
||||
return ($_SERVER['SERVER_NAME'] ?? '') . '_' .
|
||||
($_SERVER['THEME'] ?? '') . '_' .
|
||||
($_SERVER['STAGE'] ?? '') . '_' .
|
||||
($_SESSION['language'] ?? '') . '_' .
|
||||
($_SESSION['language_extra'] ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-connect to the available cache-system on the server.
|
||||
*
|
||||
* @return iAdapter
|
||||
*/
|
||||
protected function autoConnectToAvailableCacheSystem(): iAdapter
|
||||
{
|
||||
static $adapterCache;
|
||||
|
||||
if (\is_object($adapterCache) && $adapterCache instanceof iAdapter) {
|
||||
return $adapterCache;
|
||||
}
|
||||
|
||||
$memcached = null;
|
||||
$isMemcachedAvailable = false;
|
||||
if (\extension_loaded('memcached')) {
|
||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||
$memcached = new \Memcached();
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
$isMemcachedAvailable = @$memcached->addServer('127.0.0.1', 11211);
|
||||
}
|
||||
|
||||
if ($isMemcachedAvailable === false) {
|
||||
$memcached = null;
|
||||
}
|
||||
|
||||
$adapterMemcached = new AdapterMemcached($memcached);
|
||||
if ($adapterMemcached->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// "Memcached"
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterMemcached;
|
||||
} else {
|
||||
$memcache = null;
|
||||
$isMemcacheAvailable = false;
|
||||
/** @noinspection ClassConstantCanBeUsedInspection */
|
||||
if (\class_exists('\Memcache')) {
|
||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||
$memcache = new \Memcache();
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
$isMemcacheAvailable = @$memcache->connect('127.0.0.1', 11211);
|
||||
}
|
||||
|
||||
if ($isMemcacheAvailable === false) {
|
||||
$memcache = null;
|
||||
}
|
||||
|
||||
$adapterMemcache = new AdapterMemcache($memcache);
|
||||
if ($adapterMemcache->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// "Memcache"
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterMemcache;
|
||||
} else {
|
||||
$redis = null;
|
||||
$isRedisAvailable = false;
|
||||
if (
|
||||
\extension_loaded('redis')
|
||||
&&
|
||||
\class_exists('\Predis\Client')
|
||||
) {
|
||||
/** @noinspection PhpUndefinedNamespaceInspection */
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
$redis = new \Predis\Client(
|
||||
[
|
||||
'scheme' => 'tcp',
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'timeout' => '2.0',
|
||||
]
|
||||
);
|
||||
|
||||
try {
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$redis->connect();
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$isRedisAvailable = $redis->getConnection()->isConnected();
|
||||
} catch (\Exception $e) {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
if ($isRedisAvailable === false) {
|
||||
$redis = null;
|
||||
}
|
||||
|
||||
$adapterRedis = new AdapterPredis($redis);
|
||||
if ($adapterRedis->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Redis
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterRedis;
|
||||
} else {
|
||||
$adapterXcache = new AdapterXcache();
|
||||
if ($adapterXcache->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// "Xcache"
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterXcache;
|
||||
} else {
|
||||
$adapterApcu = new AdapterApcu();
|
||||
if ($adapterApcu->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// "APCu"
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterApcu;
|
||||
} else {
|
||||
$adapterApc = new AdapterApc();
|
||||
if ($adapterApc->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// "APC"
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterApc;
|
||||
} else {
|
||||
$adapterObCache = new AdapterOpCache();
|
||||
if ($adapterObCache->installed() === true) {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// OpCache (via PHP-files)
|
||||
// -------------------------------------------------------------
|
||||
$adapter = $adapterObCache;
|
||||
} else {
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Static-PHP-Cache
|
||||
// -------------------------------------------------------------
|
||||
$adapter = new AdapterArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save to static cache
|
||||
$adapterCache = $adapter;
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "isReady" state.
|
||||
*
|
||||
* @param bool $isReady
|
||||
*/
|
||||
protected function setCacheIsReady(bool $isReady)
|
||||
{
|
||||
$this->isReady = $isReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "isReady" state.
|
||||
* @param string $storeKey
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getCacheIsReady(): bool
|
||||
protected function checkForStaticCache(string $storeKey): bool
|
||||
{
|
||||
return $this->isReady;
|
||||
return !empty(self::$STATIC_CACHE)
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE)
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE_EXPIRE)
|
||||
&&
|
||||
\time() <= self::$STATIC_CACHE_EXPIRE[$storeKey];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean store-key (required e.g. for the "File"-Adapter).
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function cleanStoreKey(string $str): string
|
||||
{
|
||||
return \md5($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if cached-item exists.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function existsItem(string $key): bool
|
||||
{
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$storeKey = $this->calculateStoreKey($key);
|
||||
|
||||
// check static-cache
|
||||
if ($this->checkForStaticCache($storeKey)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->adapter->exists($storeKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -503,21 +373,21 @@ class Cache implements iCache
|
||||
|
||||
// get from static-cache
|
||||
if (
|
||||
$useStaticCache === true
|
||||
$useStaticCache
|
||||
&&
|
||||
$this->checkForStaticCache($storeKey) === true
|
||||
$this->checkForStaticCache($storeKey)
|
||||
) {
|
||||
return self::$STATIC_CACHE[$storeKey];
|
||||
}
|
||||
|
||||
$serialized = $this->adapter->get($storeKey);
|
||||
$value = $serialized ? $this->serializer->unserialize($serialized) : null;
|
||||
$value = $serialized && $this->serializer ? $this->serializer->unserialize($serialized) : null;
|
||||
|
||||
self::$STATIC_CACHE_COUNTER[$storeKey]++;
|
||||
|
||||
// save into static-cache if needed
|
||||
if (
|
||||
$useStaticCache === true
|
||||
$useStaticCache
|
||||
&&
|
||||
(
|
||||
(
|
||||
@ -540,97 +410,55 @@ class Cache implements iCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate store-key (prefix + $rawKey).
|
||||
*
|
||||
* @param string $rawKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function calculateStoreKey(string $rawKey): string
|
||||
{
|
||||
$str = $this->getPrefix() . $rawKey;
|
||||
|
||||
if ($this->adapter instanceof AdapterFileAbstract) {
|
||||
$str = $this->cleanStoreKey($str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean store-key (required e.g. for the "File"-Adapter).
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function cleanStoreKey(string $str): string
|
||||
{
|
||||
return \md5($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrefix(): string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!! Set the prefix. !!!
|
||||
*
|
||||
* WARNING: Do not use if you don't know what you do. Because this will overwrite the default prefix.
|
||||
*
|
||||
* @param string $prefix
|
||||
*/
|
||||
public function setPrefix(string $prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value, when the static cache is used.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStaticCacheHitCounter(): int
|
||||
{
|
||||
return $this->staticCacheHitCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the static-hit-counter: Who often do we hit the cache, before we use static cache?
|
||||
*
|
||||
* @param int $staticCacheHitCounter
|
||||
*/
|
||||
public function setStaticCacheHitCounter(int $staticCacheHitCounter)
|
||||
{
|
||||
$this->staticCacheHitCounter = $staticCacheHitCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache-item by key => value + date.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param \DateTime $date <p>If the date is in the past, we will remove the existing cache-item.</p>
|
||||
*
|
||||
* @throws InvalidArgumentException <p>If the $date is in the past.</p>
|
||||
* Remove all cached-items.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setItemToDate(string $key, $value, \DateTime $date): bool
|
||||
public function removeAll(): bool
|
||||
{
|
||||
$ttl = $date->getTimestamp() - \time();
|
||||
|
||||
if ($ttl <= 0) {
|
||||
throw new InvalidArgumentException('Date in the past.');
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->setItem($key, $value, $ttl);
|
||||
// remove static-cache
|
||||
if (!empty(self::$STATIC_CACHE)) {
|
||||
self::$STATIC_CACHE = [];
|
||||
self::$STATIC_CACHE_COUNTER = [];
|
||||
self::$STATIC_CACHE_EXPIRE = [];
|
||||
}
|
||||
|
||||
return $this->adapter->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cached-item.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeItem(string $key): bool
|
||||
{
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$storeKey = $this->calculateStoreKey($key);
|
||||
|
||||
// remove static-cache
|
||||
if (
|
||||
!empty(self::$STATIC_CACHE)
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE)
|
||||
) {
|
||||
unset(
|
||||
self::$STATIC_CACHE[$storeKey],
|
||||
self::$STATIC_CACHE_COUNTER[$storeKey],
|
||||
self::$STATIC_CACHE_EXPIRE[$storeKey]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->adapter->remove($storeKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -658,15 +486,15 @@ class Cache implements iCache
|
||||
$serialized = $this->serializer->serialize($value);
|
||||
|
||||
// update static-cache, if it's exists
|
||||
if (\array_key_exists($storeKey, self::$STATIC_CACHE) === true) {
|
||||
if (\array_key_exists($storeKey, self::$STATIC_CACHE)) {
|
||||
self::$STATIC_CACHE[$storeKey] = $value;
|
||||
}
|
||||
|
||||
if ($ttl) {
|
||||
if ($ttl instanceof \DateInterval) {
|
||||
// Converting to a TTL in seconds
|
||||
$dateTimeNow = new \DateTime('now');
|
||||
$ttl = $dateTimeNow->add($ttl)->getTimestamp() - \time();
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$ttl = (new \DateTimeImmutable('now'))->add($ttl)->getTimestamp() - \time();
|
||||
}
|
||||
|
||||
// always cache the TTL time, maybe we need this later ...
|
||||
@ -679,91 +507,100 @@ class Cache implements iCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a cached-item.
|
||||
* Set cache-item by key => value + date.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param \DateTimeInterface $date <p>If the date is in the past, we will remove the existing cache-item.</p>
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* <p>If the $date is in the past.</p>
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeItem(string $key): bool
|
||||
public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool
|
||||
{
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
$ttl = $date->getTimestamp() - \time();
|
||||
|
||||
if ($ttl <= 0) {
|
||||
throw new InvalidArgumentException('Date in the past.');
|
||||
}
|
||||
|
||||
$storeKey = $this->calculateStoreKey($key);
|
||||
|
||||
// remove static-cache
|
||||
if (
|
||||
!empty(self::$STATIC_CACHE)
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE) === true
|
||||
) {
|
||||
unset(self::$STATIC_CACHE[$storeKey], self::$STATIC_CACHE_COUNTER[$storeKey], self::$STATIC_CACHE_EXPIRE[$storeKey]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->adapter->remove($storeKey);
|
||||
return $this->setItem($key, $value, $ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all cached-items.
|
||||
* Get the "isReady" state.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeAll(): bool
|
||||
public function getCacheIsReady(): bool
|
||||
{
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove static-cache
|
||||
if (!empty(self::$STATIC_CACHE)) {
|
||||
self::$STATIC_CACHE = [];
|
||||
self::$STATIC_CACHE_COUNTER = [];
|
||||
self::$STATIC_CACHE_EXPIRE = [];
|
||||
}
|
||||
|
||||
return $this->adapter->removeAll();
|
||||
return $this->isReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if cached-item exists.
|
||||
* returns the IP address of the client
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool $trust_proxy_headers <p>
|
||||
* Whether or not to trust the
|
||||
* proxy headers HTTP_CLIENT_IP
|
||||
* and HTTP_X_FORWARDED_FOR. ONLY
|
||||
* use if your $_SERVER is behind a
|
||||
* proxy that sets these values
|
||||
* </p>
|
||||
*
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function existsItem(string $key): bool
|
||||
protected function getClientIp(bool $trust_proxy_headers = false): string
|
||||
{
|
||||
if (!$this->adapter instanceof iAdapter) {
|
||||
return false;
|
||||
$remoteAddr = $_SERVER['REMOTE_ADDR'] ?? 'NO_REMOTE_ADDR';
|
||||
|
||||
if ($trust_proxy_headers) {
|
||||
return $remoteAddr;
|
||||
}
|
||||
|
||||
$storeKey = $this->calculateStoreKey($key);
|
||||
|
||||
// check static-cache
|
||||
if ($this->checkForStaticCache($storeKey) === true) {
|
||||
return true;
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip = $remoteAddr;
|
||||
}
|
||||
|
||||
return $this->adapter->exists($storeKey);
|
||||
return $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $storeKey
|
||||
* Get the prefix.
|
||||
*
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
protected function checkForStaticCache(string $storeKey): bool
|
||||
public function getPrefix(): string
|
||||
{
|
||||
return !empty(self::$STATIC_CACHE)
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE) === true
|
||||
&&
|
||||
\array_key_exists($storeKey, self::$STATIC_CACHE_EXPIRE) === true
|
||||
&&
|
||||
\time() <= self::$STATIC_CACHE_EXPIRE[$storeKey];
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value, when the static cache is used.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStaticCacheHitCounter(): int
|
||||
{
|
||||
return $this->staticCacheHitCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default-prefix via "SERVER"-var + "SESSION"-language.
|
||||
*/
|
||||
protected function getTheDefaultPrefix(): string
|
||||
{
|
||||
return ($_SERVER['SERVER_NAME'] ?? '') . '_' .
|
||||
($_SERVER['THEME'] ?? '') . '_' .
|
||||
($_SERVER['STAGE'] ?? '') . '_' .
|
||||
($_SESSION['language'] ?? '') . '_' .
|
||||
($_SESSION['language_extra'] ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -795,4 +632,94 @@ class Cache implements iCache
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the current use is a admin || dev || server == client
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCacheActiveForTheCurrentUser(): bool
|
||||
{
|
||||
$active = true;
|
||||
|
||||
// test the cache, with this GET-parameter
|
||||
if ($this->disableCacheGetParameter) {
|
||||
$testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int) $_GET[$this->disableCacheGetParameter] : 0;
|
||||
} else {
|
||||
$testCache = 0;
|
||||
}
|
||||
|
||||
if ($testCache !== 1) {
|
||||
if (
|
||||
// admin session is active
|
||||
(
|
||||
$this->useCheckForAdminSession
|
||||
&&
|
||||
$this->isAdminSession
|
||||
)
|
||||
||
|
||||
// server == client
|
||||
(
|
||||
$this->useCheckForServerIpIsClientIp
|
||||
&&
|
||||
isset($_SERVER['SERVER_ADDR'])
|
||||
&&
|
||||
$_SERVER['SERVER_ADDR'] === $this->getClientIp()
|
||||
)
|
||||
||
|
||||
// user is a dev
|
||||
(
|
||||
$this->useCheckForDev
|
||||
&&
|
||||
$this->checkForDev()
|
||||
)
|
||||
) {
|
||||
$active = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* enable / disable the cache
|
||||
*
|
||||
* @param bool $isActive
|
||||
*/
|
||||
public function setActive(bool $isActive)
|
||||
{
|
||||
$this->isActive = $isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "isReady" state.
|
||||
*
|
||||
* @param bool $isReady
|
||||
*/
|
||||
protected function setCacheIsReady(bool $isReady)
|
||||
{
|
||||
$this->isReady = $isReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!! Set the prefix. !!!
|
||||
*
|
||||
* WARNING: Do not use if you don't know what you do. Because this will overwrite the default prefix.
|
||||
*
|
||||
* @param string $prefix
|
||||
*/
|
||||
public function setPrefix(string $prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the static-hit-counter: Who often do we hit the cache, before we use static cache?
|
||||
*
|
||||
* @param int $staticCacheHitCounter
|
||||
*/
|
||||
public function setStaticCacheHitCounter(int $staticCacheHitCounter)
|
||||
{
|
||||
$this->staticCacheHitCounter = $staticCacheHitCounter;
|
||||
}
|
||||
}
|
||||
|
230
bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php
vendored
Normal file
230
bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php
vendored
Normal file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace voku\cache;
|
||||
|
||||
use voku\cache\Exception\InvalidArgumentException;
|
||||
|
||||
class CacheAdapterAutoManager
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $adapter = [];
|
||||
|
||||
/**
|
||||
* @var callable[]|null[]
|
||||
*/
|
||||
private $callableFunctions = [];
|
||||
|
||||
/**
|
||||
* @param string $adapter
|
||||
* @param callable|null $callableFunction
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addAdapter(
|
||||
string $adapter,
|
||||
callable $callableFunction = null
|
||||
): self
|
||||
{
|
||||
$this->validateAdapter($adapter);
|
||||
$this->validateCallable($callableFunction);
|
||||
|
||||
$this->adapter[] = $adapter;
|
||||
$this->callableFunctions[] = $callableFunction;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator|\Generator<string, callable>
|
||||
*/
|
||||
public function getAdapters(): \Generator
|
||||
{
|
||||
foreach ($this->adapter as $key => $value) {
|
||||
yield $this->adapter[$key] => $this->callableFunctions[$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param self $adapterManager
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return CacheAdapterAutoManager
|
||||
*/
|
||||
public function merge(self $adapterManager): self
|
||||
{
|
||||
foreach ($adapterManager->getAdapters() as $adapterTmp => $callableFunctionTmp) {
|
||||
$this->validateAdapter($adapterTmp);
|
||||
$this->validateCallable($callableFunctionTmp);
|
||||
|
||||
$key = \array_search($adapterTmp, $this->adapter, true);
|
||||
|
||||
if ($key) {
|
||||
$this->adapter[$key] = $adapterTmp;
|
||||
$this->callableFunctions[$key] = $callableFunctionTmp;
|
||||
} else {
|
||||
$this->adapter[] = $adapterTmp;
|
||||
$this->callableFunctions[] = $callableFunctionTmp;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $replaceAdapter
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function validateAdapter(string $replaceAdapter)
|
||||
{
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$interfaces = (new \ReflectionClass($replaceAdapter))->getInterfaces();
|
||||
if (!\array_key_exists(iAdapter::class, $interfaces)) {
|
||||
throw new InvalidArgumentException('"' . $replaceAdapter . '" did not implement the "iAdapter"-interface [' . \print_r($interfaces, true) . ']');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callableFunction
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function validateCallable(callable $callableFunction = null)
|
||||
{
|
||||
if (
|
||||
$callableFunction !== null
|
||||
&&
|
||||
!\is_callable($callableFunction)
|
||||
) {
|
||||
throw new InvalidArgumentException('$callableFunction is not callable');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CacheAdapterAutoManager
|
||||
*/
|
||||
public static function getDefaultsForAutoInit(): self
|
||||
{
|
||||
$cacheAdapterManager = new self();
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterMemcached::class,
|
||||
static function () {
|
||||
$memcached = null;
|
||||
$isMemcachedAvailable = false;
|
||||
if (\extension_loaded('memcached')) {
|
||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||
$memcached = new \Memcached();
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
$isMemcachedAvailable = @$memcached->addServer('127.0.0.1', 11211);
|
||||
}
|
||||
|
||||
if (!$isMemcachedAvailable) {
|
||||
$memcached = null;
|
||||
}
|
||||
|
||||
return $memcached;
|
||||
}
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterMemcache::class,
|
||||
static function () {
|
||||
$memcache = null;
|
||||
$isMemcacheAvailable = false;
|
||||
/** @noinspection ClassConstantCanBeUsedInspection */
|
||||
if (\class_exists('\Memcache')) {
|
||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||
$memcache = new \Memcache();
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
$isMemcacheAvailable = @$memcache->connect('127.0.0.1', 11211);
|
||||
}
|
||||
|
||||
if (!$isMemcacheAvailable) {
|
||||
$memcache = null;
|
||||
}
|
||||
|
||||
return $memcache;
|
||||
}
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterPredis::class,
|
||||
static function () {
|
||||
$redis = null;
|
||||
$isRedisAvailable = false;
|
||||
if (
|
||||
\extension_loaded('redis')
|
||||
&&
|
||||
\class_exists('\Predis\Client')
|
||||
) {
|
||||
/** @noinspection PhpUndefinedNamespaceInspection */
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
$redis = new \Predis\Client(
|
||||
[
|
||||
'scheme' => 'tcp',
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'timeout' => '2.0',
|
||||
]
|
||||
);
|
||||
|
||||
try {
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$redis->connect();
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$isRedisAvailable = $redis->getConnection()->isConnected();
|
||||
} catch (\Exception $e) {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
if ($isRedisAvailable === false) {
|
||||
$redis = null;
|
||||
}
|
||||
|
||||
return $redis;
|
||||
}
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterXcache::class
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterApcu::class
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterApc::class
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterOpCache::class,
|
||||
static function () {
|
||||
return \realpath(\sys_get_temp_dir()) . '/simple_php_cache';
|
||||
}
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$cacheAdapterManager->addAdapter(
|
||||
AdapterArray::class
|
||||
);
|
||||
|
||||
return $cacheAdapterManager;
|
||||
}
|
||||
}
|
@ -4,9 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace voku\cache;
|
||||
|
||||
/**
|
||||
* CacheChain: global-cache-chain class
|
||||
*/
|
||||
class CacheChain implements iCache
|
||||
{
|
||||
/**
|
||||
@ -87,13 +84,13 @@ class CacheChain implements iCache
|
||||
$results[] = $cache->setItem($key, $value, $ttl);
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setItemToDate(string $key, $value, \DateTime $date): bool
|
||||
public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool
|
||||
{
|
||||
// init
|
||||
$results = [];
|
||||
@ -103,7 +100,7 @@ class CacheChain implements iCache
|
||||
$results[] = $cache->setItemToDate($key, $value, $date);
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +115,7 @@ class CacheChain implements iCache
|
||||
$results[] = $cache->removeItem($key);
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,6 +144,6 @@ class CacheChain implements iCache
|
||||
$results[] = $cache->removeAll();
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
/**
|
||||
* Deletes multiple cache items in a single operation.
|
||||
*
|
||||
* @param \iterable $keys a list of string-based keys to be deleted
|
||||
* @param iterable $keys a list of string-based keys to be deleted
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
@ -48,16 +48,20 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
*/
|
||||
public function deleteMultiple($keys): bool
|
||||
{
|
||||
if (!\is_array($keys) && !($keys instanceof \Traversable)) {
|
||||
if (
|
||||
!\is_array($keys)
|
||||
&&
|
||||
!($keys instanceof \Traversable)
|
||||
) {
|
||||
throw new InvalidArgumentException('$keys is not iterable:' . \print_r($keys, true));
|
||||
}
|
||||
|
||||
$results = [];
|
||||
foreach ((array) $keys as $key) {
|
||||
$results = $this->delete($key);
|
||||
$results[] = $this->delete($key);
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +76,7 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->has($key) === true) {
|
||||
if ($this->has($key)) {
|
||||
return $this->getItem($key);
|
||||
}
|
||||
|
||||
@ -82,17 +86,21 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
/**
|
||||
* Obtains multiple cache items by their unique keys.
|
||||
*
|
||||
* @param \iterable $keys a list of keys that can obtained in a single operation
|
||||
* @param mixed $default default value to return for keys that do not exist
|
||||
* @param iterable $keys a list of keys that can obtained in a single operation
|
||||
* @param mixed $default default value to return for keys that do not exist
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return \iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as
|
||||
* value.
|
||||
* @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as
|
||||
* value.
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
if (!\is_array($keys) && !($keys instanceof \Traversable)) {
|
||||
if (
|
||||
!\is_array($keys)
|
||||
&&
|
||||
!($keys instanceof \Traversable)
|
||||
) {
|
||||
throw new InvalidArgumentException('$keys is not iterable:' . \print_r($keys, true));
|
||||
}
|
||||
|
||||
@ -152,7 +160,7 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
/**
|
||||
* Persists a set of key => value pairs in the cache, with an optional TTL.
|
||||
*
|
||||
* @param \iterable $values a list of key => value pairs for a multiple-set operation
|
||||
* @param iterable $values a list of key => value pairs for a multiple-set operation
|
||||
* @param \DateInterval|int|null $ttl Optional. The TTL value of this item. If no value is sent and
|
||||
* the driver supports TTL then the library may set a default value
|
||||
* for it or let the driver take care of that.
|
||||
@ -163,15 +171,19 @@ class CachePsr16 extends Cache implements CacheInterface
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null): bool
|
||||
{
|
||||
if (!\is_array($values) && !($values instanceof \Traversable)) {
|
||||
if (
|
||||
!\is_array($values)
|
||||
&&
|
||||
!($values instanceof \Traversable)
|
||||
) {
|
||||
throw new InvalidArgumentException('$values is not iterable:' . \print_r($values, true));
|
||||
}
|
||||
|
||||
$results = [];
|
||||
foreach ((array) $values as $key => $value) {
|
||||
$results = $this->set($key, $value, $ttl);
|
||||
$results[] = $this->set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
return \in_array(false, $results, true) === false;
|
||||
return !\in_array(false, $results, true);
|
||||
}
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ interface iCache
|
||||
/**
|
||||
* set item a special expire-date
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param \DateTime $date
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param \DateTimeInterface $date
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setItemToDate(string $key, $value, \DateTime $date): bool;
|
||||
public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool;
|
||||
|
||||
/**
|
||||
* remove item
|
||||
|
@ -12,18 +12,14 @@ interface iSerializer
|
||||
/**
|
||||
* serialize
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function serialize($value);
|
||||
|
||||
/**
|
||||
* unserialize
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @param string $value
|
||||
*/
|
||||
public function unserialize($value);
|
||||
}
|
||||
|
5
bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh
Normal file
5
bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Configure MySQL test database"
|
||||
|
||||
mysql --user=root --password=Password123 -e 'create database zenddb_test;'
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Configure MySQL test database"
|
||||
|
||||
mysql -u root -e 'create database zenddb_test;'
|
6
bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh
Normal file
6
bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Configure PostgreSQL test database"
|
||||
|
||||
psql -U postgres -c 'create database zenddb_test;'
|
||||
psql -U postgres -c "alter role postgres password 'postgres'"
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Configure SQL server test database"
|
||||
|
||||
sqlcmd -S localhost -U sa -P Password123 -Q "CREATE DATABASE zenddb_test;"
|
445
bundled-libs/zendframework/zend-db/CHANGELOG.md
Normal file
445
bundled-libs/zendframework/zend-db/CHANGELOG.md
Normal file
@ -0,0 +1,445 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file, in reverse chronological order by release.
|
||||
|
||||
## 2.10.0 - 2019-02-25
|
||||
|
||||
### Added
|
||||
|
||||
- [#157](https://github.com/zendframework/zend-db/pull/157) added support of
|
||||
`Zend\Db\Sql\TableIdentifier` in DDL
|
||||
- [#345](https://github.com/zendframework/zend-db/pull/345) allow usage with
|
||||
zend-hydrator v3
|
||||
- [#346](https://github.com/zendframework/zend-db/pull/346) adds support for PHP
|
||||
7.3
|
||||
|
||||
### Changed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#303](https://github.com/zendframework/zend-db/pull/303) fixes #295 issue:
|
||||
handle empty array as datasource at `AbstractResultSet::initialize()` at PHP
|
||||
7.2
|
||||
- [#313](https://github.com/zendframework/zend-db/pull/313) test
|
||||
`AbstractResultSet::current()` to return null on empty array
|
||||
- [#329](https://github.com/zendframework/zend-db/pull/329) fixes Exception
|
||||
thrown when calling `prepareStatementForSqlObject` on a Select with a
|
||||
sub-Select that has limit and/or offset set
|
||||
- [#337](https://github.com/zendframework/zend-db/pull/337) fixes #330 current
|
||||
NULL for mysqli
|
||||
- [#338](https://github.com/zendframework/zend-db/pull/338) restore missing use
|
||||
`ResultSet` in `AbstractTableGateway`
|
||||
- [#341](https://github.com/zendframework/zend-db/pull/341) fixes undefined
|
||||
variable bug in MetadataFeature
|
||||
- [#357](https://github.com/zendframework/zend-db/pull/357) fixes named params
|
||||
in subquery - limit and offset (issue #355)
|
||||
|
||||
## 2.9.3 - 2018-04-09
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Changed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#295](https://github.com/zendframework/zend-db/pull/295) fix error when
|
||||
datasource passed to `AbstractResultSet::initialize()` is empty array at
|
||||
php 7.2 environment
|
||||
|
||||
- [#300](https://github.com/zendframework/zend-db/pull/300) Fix error for nested
|
||||
queries inside field parameters
|
||||
|
||||
- [#301](https://github.com/zendframework/zend-db/pull/301) fix for issue with
|
||||
set fields that exists in different tables in one query
|
||||
|
||||
- [#304](https://github.com/zendframework/zend-db/pull/304) fix PDO bind
|
||||
parameter name to use field name with extended charset (PDO only supports
|
||||
alphanumeric and underscore for placeholder/parameter names).
|
||||
|
||||
## 2.9.2 - 2017-12-11
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Changed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#292](https://github.com/zendframework/zend-db/pull/292) ensures that you may
|
||||
reference bound parameter names using a leading colon (`:`) character when
|
||||
using the PDO adapter. (The leading colon is not technically necessary, as the
|
||||
adapter will prefix for you; however, this ensures portability with vanilla
|
||||
PDO.)
|
||||
|
||||
## 2.9.1 - 2017-12-07
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Changed
|
||||
|
||||
- [#289](https://github.com/zendframework/zend-db/pull/289) reverts a change
|
||||
introduced in 2.9.0 and modifies the behavior of the PDO adapter slightly
|
||||
to remove a regression. In 2.9.0, when binding parameters with names that
|
||||
contained characters not supported by PDO, we would pass the parameter names
|
||||
to `md5()`; this caused a regression, as the SQL string containing the
|
||||
parameter name was not also updated.
|
||||
|
||||
This patch modifies the behavior during a bind-operation to instead raise an
|
||||
exception if a parameter name contains characters not supported by PDO.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Nothing.
|
||||
|
||||
## 2.9.0 - 2017-12-06
|
||||
|
||||
### Added
|
||||
|
||||
- [#216](https://github.com/zendframework/zend-db/pull/216) added AFTER support
|
||||
in ALTER TABLE syntax for MySQL
|
||||
- [#223](https://github.com/zendframework/zend-db/pull/223) added support for
|
||||
empty values set with IN predicate
|
||||
- [#271](https://github.com/zendframework/zend-db/pull/271) added support for
|
||||
dash character on MySQL identifier
|
||||
- [#273](https://github.com/zendframework/zend-db/pull/273) added support for
|
||||
implementing an error handler for db2_prepare
|
||||
- [#275](https://github.com/zendframework/zend-db/pull/275) added support for
|
||||
LIMIT OFFSET for db2
|
||||
- [#280](https://github.com/zendframework/zend-db/pull/280) added version dsn
|
||||
parameter for pdo_dblib
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#205](https://github.com/zendframework/zend-db/pull/205) fixes the spaces in
|
||||
ORDER BY syntax
|
||||
- [#224](https://github.com/zendframework/zend-db/pull/224) fixes how parameters
|
||||
are bound to statements in the PDO adapter. PDO has a restriction on parameter
|
||||
names of `[0-9a-zA_Z_]`; as such, the driver now hashes the parameter names
|
||||
using `md5()` in order to ensure compatibility with other drivers.
|
||||
- [#229](https://github.com/zendframework/zend-db/pull/229) fixes the support
|
||||
of SSL for mysqli
|
||||
- [#255](https://github.com/zendframework/zend-db/pull/255) fixes ResultSet with
|
||||
array values
|
||||
- [#261](https://github.com/zendframework/zend-db/pull/261) fixes Exception in
|
||||
Firebird driver doesn't support lastInsertId
|
||||
- [#276](https://github.com/zendframework/zend-db/pull/276) fixes the support
|
||||
of PHP 7.2
|
||||
- [#287](https://github.com/zendframework/zend-db/pull/287) fixes the usage of
|
||||
count() with PHP 7.2
|
||||
|
||||
## 2.8.2 - 2016-08-09
|
||||
|
||||
### Added
|
||||
|
||||
- [#110](https://github.com/zendframework/zend-db/pull/110) prepared the
|
||||
documentation for publication at https://zendframework.github.io/zend-db/
|
||||
- [#114](https://github.com/zendframework/zend-db/pull/114) add
|
||||
Adapter\Adapter::class to alias against Adapter\AdapterInterface::class
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#154](https://github.com/zendframework/zend-db/pull/154) fixes the how the
|
||||
COMBINE operator is applied to SQLite adapters, ensuring a valid UNION
|
||||
statement is generated.
|
||||
- [#112](https://github.com/zendframework/zend-db/pull/112) fixes the test on
|
||||
the number of replacements when using the same variable name.
|
||||
- [#115](https://github.com/zendframework/zend-db/pull/115) TableGateway update
|
||||
method was incorrect when specifying default join declaration.
|
||||
- [#145](https://github.com/zendframework/zend-db/pull/145) Fix MSSQL Select
|
||||
when encounting DISTINCT and OFFSET and LIMIT together.
|
||||
- [#153](https://github.com/zendframework/zend-db/pull/153) Runtime exception
|
||||
threw fatal error due to incorrect spelling of the class when a DSN did not
|
||||
exist.
|
||||
|
||||
## 2.8.1 - 2016-04-14
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#100](https://github.com/zendframework/zend-db/pull/100) fixes the JOIN
|
||||
behavior to re-allow selecting an empty column set from the joined table.
|
||||
- [#106](https://github.com/zendframework/zend-db/pull/106) fixes an issue in
|
||||
the test suite when ext/pgsql is enabled, but no databases are avaiable.
|
||||
|
||||
## 2.8.0 - 2016-04-12
|
||||
|
||||
### Added
|
||||
|
||||
- [#92](https://github.com/zendframework/zend-db/pull/92) adds the class
|
||||
`Zend\Db\Sql\Join` for creating and aggregating JOIN specifications. This is
|
||||
now consumed by all `Zend\Db\Sql` implementations in order to represent JOIN
|
||||
statements.
|
||||
- [#92](https://github.com/zendframework/zend-db/pull/92) adds support for JOIN
|
||||
operations to UPDATE statements.
|
||||
- [#92](https://github.com/zendframework/zend-db/pull/92) adds support for joins
|
||||
to `AbstractTableGateway::update`; you can now pass an array of
|
||||
specifications via a third argument to the method.
|
||||
- [#96](https://github.com/zendframework/zend-db/pull/96) exposes the package as
|
||||
config-provider/component, but adding:
|
||||
- `Zend\Db\ConfigProvider`, which maps the `AdapterInterface` to the
|
||||
`AdapterServiceFactory`, and enables the `AdapterAbstractServiceFactory`.
|
||||
- `Zend\Db\Module`, which does the same, for a zend-mvc context.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Nothing.
|
||||
|
||||
## 2.7.1 - 2016-04-12
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#71](https://github.com/zendframework/zend-db/pull/71) updates the `Pgsql`
|
||||
adapter to allow passing the connection charset; this can be done with the
|
||||
`charset` option when creating your adapter.
|
||||
- [#76](https://github.com/zendframework/zend-db/pull/76) fixes the behavior of
|
||||
`Zend\Db\Sql\Insert` when an array of names is used for columns to ensure the
|
||||
string names are used, and not the array indices.
|
||||
- [#91](https://github.com/zendframework/zend-db/pull/91) fixes the behavior of
|
||||
the `Oci8` adapter when initializing a result set; previously, it was
|
||||
improperly assigning the count of affected rows to the generated value.
|
||||
- [#95](https://github.com/zendframework/zend-db/pull/95) fixes the `IbmDb2`
|
||||
platform's `quoteIdentifier()` method to properly allow `#` characters in
|
||||
identifiers (as they are commonly used on that platform).
|
||||
|
||||
## 2.7.0 - 2016-02-22
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#85](https://github.com/zendframework/zend-db/pull/85) and
|
||||
[#87](https://github.com/zendframework/zend-db/pull/87) update the code base
|
||||
to be forwards compatible with:
|
||||
- zend-eventmanager v3
|
||||
- zend-hydrator v2.1
|
||||
- zend-servicemanager v3
|
||||
- zend-stdlib v3
|
||||
|
||||
## 2.6.2 - 2015-12-09
|
||||
|
||||
### Added
|
||||
|
||||
- [#49](https://github.com/zendframework/zend-db/pull/49) Add docbook
|
||||
documentation.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#55](https://github.com/zendframework/zend-db/pull/55) Implement FeatureSet
|
||||
canCallMagicCall and callMagicCall methods
|
||||
- [#56](https://github.com/zendframework/zend-db/pull/56)
|
||||
AbstractResultSet::current now does validation to ensure an array.
|
||||
- [#58](https://github.com/zendframework/zend-db/pull/58) Fix unbuffered result
|
||||
on MySQLi.
|
||||
- [#59](https://github.com/zendframework/zend-db/pull/59) Allow unix_socket
|
||||
parameter
|
||||
|
||||
## 2.6.1 - 2015-10-14
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#31](https://github.com/zendframework/zend-db/pull/31) fixes table gateway
|
||||
update when there is a table alias utilized.
|
||||
|
||||
## 2.6.1 - 2015-10-14
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#43](https://github.com/zendframework/zend-db/pull/43) unset and get during
|
||||
an insert operation would throw an InvalidArgumentException during an insert.
|
||||
|
||||
## 2.6.0 - 2015-09-22
|
||||
|
||||
### Added
|
||||
|
||||
- [#42](https://github.com/zendframework/zend-db/pull/42) updates the component
|
||||
to use zend-hydrator for hydrator functionality; this provides forward
|
||||
compatibility with zend-hydrator, and backwards compatibility with
|
||||
hydrators from older versions of zend-stdlib.
|
||||
- [#15](https://github.com/zendframework/zend-db/pull/15) adds a new predicate,
|
||||
`Zend\Db\Sql\Predicate\NotBetween`, which can be invoked via `Sql`
|
||||
instances: `$sql->notBetween($field, $min, $max)`.
|
||||
- [#22](https://github.com/zendframework/zend-db/pull/22) extracts a factory,
|
||||
`Zend\Db\Metadata\Source\Factory`, from `Zend\Db\Metadata\Metadata`,
|
||||
removing the (non-public) `createSourceFromAdapter()` method from that
|
||||
class. Additionally, it extracts `Zend\Db\Metadata\MetadataInterface`, to
|
||||
allow creating alternate implementations.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- [#27](https://github.com/zendframework/zend-db/pull/27) deprecates the
|
||||
constants `JOIN_OUTER_LEFT` and `JOIN_OUTER_RIGHT` in favor of
|
||||
`JOIN_LEFT_OUTER` and `JOIN_RIGHT_OUTER`.
|
||||
|
||||
### Removed
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Nothing.
|
||||
|
||||
## 2.5.2 - 2015-09-22
|
||||
|
||||
### Added
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Nothing.
|
||||
|
||||
### Removed
|
||||
|
||||
- [#29](https://github.com/zendframework/zend-db/pull/29) removes the required
|
||||
second argument to `Zend\Db\Predicate\Predicate::expression()`, allowing it to
|
||||
be nullable, and mirroring the constructor of `Zend\Db\Predicate\Expression`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#40](https://github.com/zendframework/zend-db/pull/40) updates the
|
||||
zend-stdlib dependency to reference `>=2.5.0,<2.7.0` to ensure hydrators
|
||||
will work as expected following extraction of hydrators to the zend-hydrator
|
||||
repository.
|
||||
- [#34](https://github.com/zendframework/zend-db/pull/34) fixes retrieval of
|
||||
constraint metadata in the Oracle adapter.
|
||||
- [#41](https://github.com/zendframework/zend-db/pull/41) removes hard dependency
|
||||
on EventManager in AbstractTableGateway.
|
||||
- [#17](https://github.com/zendframework/zend-db/pull/17) removes an executable
|
||||
bit on a regular file.
|
||||
- [#3](https://github.com/zendframework/zend-db/pull/3) updates the code to use
|
||||
closure binding (now that we're on 5.5+, this is possible).
|
||||
- [#9](https://github.com/zendframework/zend-db/pull/9) thoroughly audits the
|
||||
OCI8 (Oracle) driver, ensuring it provides feature parity with other drivers,
|
||||
and fixes issues with subselects, limits, and offsets.
|
27
bundled-libs/zendframework/zend-db/LICENSE.md
Normal file
27
bundled-libs/zendframework/zend-db/LICENSE.md
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2005-2017, Zend Technologies USA, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
- Neither the name of Zend Technologies USA, Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
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.
|
12
bundled-libs/zendframework/zend-db/README.md
Normal file
12
bundled-libs/zendframework/zend-db/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# zend-db
|
||||
|
||||
[](https://secure.travis-ci.org/zendframework/zend-db)
|
||||
[](https://coveralls.io/github/zendframework/zend-db?branch=master)
|
||||
|
||||
`Zend\Db` is a component that abstract the access to a Database using an object
|
||||
oriented API to build the queries. `Zend\Db` consumes different storage adapters
|
||||
to access different database vendors such as MySQL, PostgreSQL, Oracle, IBM DB2,
|
||||
Microsoft Sql Server, PDO, etc.
|
||||
|
||||
- File issues at https://github.com/zendframework/zend-db/issues
|
||||
- Documentation is at https://docs.zendframework.com/zend-db/
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter;
|
||||
|
||||
use Zend\ServiceManager\FactoryInterface;
|
||||
use Zend\ServiceManager\ServiceLocatorInterface;
|
||||
|
||||
class AdapterServiceFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Create db adapter service
|
||||
*
|
||||
* @param ServiceLocatorInterface $serviceLocator
|
||||
* @return Adapter
|
||||
*/
|
||||
public function createService(ServiceLocatorInterface $serviceLocator)
|
||||
{
|
||||
$config = $serviceLocator->get('Config');
|
||||
return new Adapter($config['db']);
|
||||
}
|
||||
}
|
@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
class IbmDb2 implements PlatformInterface
|
||||
{
|
||||
|
||||
protected $quoteValueAllowed = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $quoteIdentifiers = true;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $identifierSeparator = '.';
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
if (isset($options['quote_identifiers'])
|
||||
&& ($options['quote_identifiers'] == false
|
||||
|| $options['quote_identifiers'] === 'false')
|
||||
) {
|
||||
$this->quoteIdentifiers = false;
|
||||
}
|
||||
|
||||
if (isset($options['identifier_separator'])) {
|
||||
$this->identifierSeparator = $options['identifier_separator'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'IBM DB2';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote indentifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return $identifier;
|
||||
}
|
||||
return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return (is_array($identifierChain)) ? implode($this->identifierSeparator, $identifierChain) : $identifierChain;
|
||||
}
|
||||
$identifierChain = str_replace('"', '\\"', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('"' . $this->identifierSeparator . '"', $identifierChain);
|
||||
}
|
||||
return '"' . $identifierChain . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
if (function_exists('db2_escape_string')) {
|
||||
return '\'' . db2_escape_string($value) . '\'';
|
||||
}
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . str_replace("'", "''", $value) . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
if (function_exists('db2_escape_string')) {
|
||||
return '\'' . db2_escape_string($value) . '\'';
|
||||
}
|
||||
return '\'' . str_replace("'", "''", $value) . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return $this->identifierSeparator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return $identifier;
|
||||
}
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,214 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\Driver\Mysqli;
|
||||
use Zend\Db\Adapter\Driver\Pdo;
|
||||
use Zend\Db\Adapter\Exception;
|
||||
|
||||
class Mysql implements PlatformInterface
|
||||
{
|
||||
/** @var \mysqli|\PDO */
|
||||
protected $resource = null;
|
||||
|
||||
public function __construct($driver = null)
|
||||
{
|
||||
if ($driver) {
|
||||
$this->setDriver($driver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Zend\Db\Adapter\Driver\Mysqli\Mysqli|\Zend\Db\Adapter\Driver\Pdo\Pdo||\mysqli|\PDO $driver
|
||||
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setDriver($driver)
|
||||
{
|
||||
// handle Zend\Db drivers
|
||||
if ($driver instanceof Mysqli\Mysqli
|
||||
|| ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Mysql')
|
||||
|| ($driver instanceof \mysqli)
|
||||
|| ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql')
|
||||
) {
|
||||
$this->resource = $driver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new Exception\InvalidArgumentException('$driver must be a Mysqli or Mysql PDO Zend\Db\Adapter\Driver, Mysqli instance or MySQL PDO instance');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'MySQL';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote identifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return '`' . str_replace('`', '``', $identifier) . '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
$identifierChain = str_replace('`', '``', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('`.`', $identifierChain);
|
||||
}
|
||||
return '`' . $identifierChain . '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \mysqli) {
|
||||
return '\'' . $this->resource->real_escape_string($value) . '\'';
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \mysqli) {
|
||||
return '\'' . $this->resource->real_escape_string($value) . '\'';
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
// regex taken from @link http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
|
||||
$parts = preg_split('#([^0-9,a-z,A-Z$_])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '`' . str_replace('`', '``', $part) . '`';
|
||||
}
|
||||
}
|
||||
return implode('', $parts);
|
||||
}
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
class Oracle implements PlatformInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $quoteIdentifiers = true;
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
if (isset($options['quote_identifiers'])
|
||||
&& ($options['quote_identifiers'] == false
|
||||
|| $options['quote_identifiers'] === 'false')
|
||||
) {
|
||||
$this->quoteIdentifiers = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'Oracle';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote identifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return $identifier;
|
||||
}
|
||||
return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return (is_array($identifierChain)) ? implode('.', $identifierChain) : $identifierChain;
|
||||
}
|
||||
$identifierChain = str_replace('"', '\\"', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('"."', $identifierChain);
|
||||
}
|
||||
return '"' . $identifierChain . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
if ($this->quoteIdentifiers === false) {
|
||||
return $identifier;
|
||||
}
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
|
||||
}
|
||||
}
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\Driver\Pdo;
|
||||
use Zend\Db\Adapter\Driver\Pgsql;
|
||||
use Zend\Db\Adapter\Exception;
|
||||
|
||||
class Postgresql implements PlatformInterface
|
||||
{
|
||||
/** @var resource|\PDO */
|
||||
protected $resource = null;
|
||||
|
||||
public function __construct($driver = null)
|
||||
{
|
||||
if ($driver) {
|
||||
$this->setDriver($driver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Zend\Db\Adapter\Driver\Pgsql\Pgsql|\Zend\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver
|
||||
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setDriver($driver)
|
||||
{
|
||||
if ($driver instanceof Pgsql\Pgsql
|
||||
|| ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Postgresql')
|
||||
|| (is_resource($driver) && (in_array(get_resource_type($driver), array('pgsql link', 'pgsql link persistent'))))
|
||||
|| ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'pgsql')
|
||||
) {
|
||||
$this->resource = $driver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new Exception\InvalidArgumentException('$driver must be a Pgsql or Postgresql PDO Zend\Db\Adapter\Driver, pgsql link resource or Postgresql PDO instance');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'PostgreSQL';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote indentifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
$identifierChain = str_replace('"', '\\"', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('"."', $identifierChain);
|
||||
}
|
||||
return '"' . $identifierChain . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if (is_resource($this->resource)) {
|
||||
return '\'' . pg_escape_string($this->resource, $value) . '\'';
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if (is_resource($this->resource)) {
|
||||
return '\'' . pg_escape_string($this->resource, $value) . '\'';
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
|
||||
}
|
||||
}
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
class Sql92 implements PlatformInterface
|
||||
{
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQL92';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote indentifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
$identifierChain = str_replace('"', '\\"', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('"."', $identifierChain);
|
||||
}
|
||||
return '"' . $identifierChain . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
trigger_error(
|
||||
'Attempting to quote a value without specific driver level support can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\Driver\Pdo;
|
||||
use Zend\Db\Adapter\Exception;
|
||||
|
||||
class SqlServer implements PlatformInterface
|
||||
{
|
||||
|
||||
/** @var resource|\PDO */
|
||||
protected $resource = null;
|
||||
|
||||
public function __construct($driver = null)
|
||||
{
|
||||
if ($driver) {
|
||||
$this->setDriver($driver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
|
||||
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setDriver($driver)
|
||||
{
|
||||
// handle Zend_Db drivers
|
||||
if (($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), array('Sqlsrv', 'Dblib')))
|
||||
|| (($driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), array('sqlsrv', 'dblib'))))
|
||||
) {
|
||||
$this->resource = $driver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\Db\Adapter\Driver or Sqlsrv PDO instance');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLServer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote identifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return array('[', ']');
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return '[' . $identifier . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('].[', $identifierChain);
|
||||
}
|
||||
return '[' . $identifierChain . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . str_replace('\'', '\'\'', $value) . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
return '\'' . str_replace('\'', '\'\'', $value) . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '[' . $part . ']';
|
||||
}
|
||||
}
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\Driver\Pdo;
|
||||
use Zend\Db\Adapter\Exception;
|
||||
|
||||
class Sqlite implements PlatformInterface
|
||||
{
|
||||
|
||||
/** @var \PDO */
|
||||
protected $resource = null;
|
||||
|
||||
public function __construct($driver = null)
|
||||
{
|
||||
if ($driver) {
|
||||
$this->setDriver($driver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Zend\Db\Adapter\Driver\Pdo\Pdo||\PDO $driver
|
||||
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setDriver($driver)
|
||||
{
|
||||
if (($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlite')
|
||||
|| ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlite')
|
||||
) {
|
||||
$this->resource = $driver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new Exception\InvalidArgumentException('$driver must be a Sqlite PDO Zend\Db\Adapter\Driver, Sqlite PDO instance');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLite';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote identifier symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteIdentifierSymbol()
|
||||
{
|
||||
return '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier chain
|
||||
*
|
||||
* @param string|string[] $identifierChain
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierChain($identifierChain)
|
||||
{
|
||||
$identifierChain = str_replace('"', '\\"', $identifierChain);
|
||||
if (is_array($identifierChain)) {
|
||||
$identifierChain = implode('"."', $identifierChain);
|
||||
}
|
||||
return '"' . $identifierChain . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quote value symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuoteValueSymbol()
|
||||
{
|
||||
return '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
trigger_error(
|
||||
'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
|
||||
. 'can introduce security vulnerabilities in a production environment.'
|
||||
);
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote Trusted Value
|
||||
*
|
||||
* The ability to quote values without notices
|
||||
*
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function quoteTrustedValue($value)
|
||||
{
|
||||
if ($this->resource instanceof DriverInterface) {
|
||||
$this->resource = $this->resource->getConnection()->getResource();
|
||||
}
|
||||
if ($this->resource instanceof \PDO) {
|
||||
return $this->resource->quote($value);
|
||||
}
|
||||
return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote value list
|
||||
*
|
||||
* @param string|string[] $valueList
|
||||
* @return string
|
||||
*/
|
||||
public function quoteValueList($valueList)
|
||||
{
|
||||
if (!is_array($valueList)) {
|
||||
return $this->quoteValue($valueList);
|
||||
}
|
||||
$value = reset($valueList);
|
||||
do {
|
||||
$valueList[key($valueList)] = $this->quoteValue($value);
|
||||
} while ($value = next($valueList));
|
||||
return implode(', ', $valueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier separator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierSeparator()
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote identifier in fragment
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param array $safeWords
|
||||
* @return string
|
||||
*/
|
||||
public function quoteIdentifierInFragment($identifier, array $safeWords = array())
|
||||
{
|
||||
$parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if ($safeWords) {
|
||||
$safeWords = array_flip($safeWords);
|
||||
$safeWords = array_change_key_case($safeWords, CASE_LOWER);
|
||||
}
|
||||
foreach ($parts as $i => $part) {
|
||||
if ($safeWords && isset($safeWords[strtolower($part)])) {
|
||||
continue;
|
||||
}
|
||||
switch ($part) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case '*':
|
||||
case 'AS':
|
||||
case 'As':
|
||||
case 'aS':
|
||||
case 'as':
|
||||
break;
|
||||
default:
|
||||
$parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
|
||||
}
|
||||
}
|
||||
return implode('', $parts);
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Zend\Db\Adapter\Profiler;
|
||||
|
||||
interface ProfilerAwareInterface
|
||||
{
|
||||
public function setProfiler(ProfilerInterface $profiler);
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Zend\Db\Adapter\Profiler;
|
||||
|
||||
interface ProfilerInterface
|
||||
{
|
||||
/**
|
||||
* @param string|\Zend\Db\Adapter\StatementContainerInterface $target
|
||||
* @return mixed
|
||||
*/
|
||||
public function profilerStart($target);
|
||||
public function profilerFinish();
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Metadata;
|
||||
|
||||
interface MetadataInterface
|
||||
{
|
||||
public function getSchemas();
|
||||
|
||||
public function getTableNames($schema = null, $includeViews = false);
|
||||
public function getTables($schema = null, $includeViews = false);
|
||||
public function getTable($tableName, $schema = null);
|
||||
|
||||
public function getViewNames($schema = null);
|
||||
public function getViews($schema = null);
|
||||
public function getView($viewName, $schema = null);
|
||||
|
||||
public function getColumnNames($table, $schema = null);
|
||||
public function getColumns($table, $schema = null);
|
||||
public function getColumn($columnName, $table, $schema = null);
|
||||
|
||||
public function getConstraints($table, $schema = null);
|
||||
public function getConstraint($constraintName, $table, $schema = null);
|
||||
public function getConstraintKeys($constraint, $table, $schema = null);
|
||||
|
||||
public function getTriggerNames($schema = null);
|
||||
public function getTriggers($schema = null);
|
||||
public function getTrigger($triggerName, $schema = null);
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
DB Component from ZF2
|
||||
=====================
|
||||
|
||||
This is the DB component for ZF2.
|
||||
|
||||
- File issues at https://github.com/zendframework/zf2/issues
|
||||
- Create pull requests against https://github.com/zendframework/zf2
|
||||
- Documentation is at http://framework.zend.com/docs
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
|
||||
The files in this archive are released under the [Zend Framework
|
||||
license](http://framework.zend.com/license), which is a 3-clause BSD license.
|
||||
|
@ -1,188 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\StatementContainer;
|
||||
|
||||
abstract class AbstractSql
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $specifications = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $processInfo = array('paramPrefix' => '', 'subselectCount' => 0);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $instanceParameterIndex = array();
|
||||
|
||||
protected function processExpression(ExpressionInterface $expression, PlatformInterface $platform, DriverInterface $driver = null, $namedParameterPrefix = null)
|
||||
{
|
||||
// static counter for the number of times this method was invoked across the PHP runtime
|
||||
static $runtimeExpressionPrefix = 0;
|
||||
|
||||
if ($driver && ((!is_string($namedParameterPrefix) || $namedParameterPrefix == ''))) {
|
||||
$namedParameterPrefix = sprintf('expr%04dParam', ++$runtimeExpressionPrefix);
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
$statementContainer = new StatementContainer;
|
||||
$parameterContainer = $statementContainer->getParameterContainer();
|
||||
|
||||
// initialize variables
|
||||
$parts = $expression->getExpressionData();
|
||||
|
||||
if (!isset($this->instanceParameterIndex[$namedParameterPrefix])) {
|
||||
$this->instanceParameterIndex[$namedParameterPrefix] = 1;
|
||||
}
|
||||
|
||||
$expressionParamIndex = &$this->instanceParameterIndex[$namedParameterPrefix];
|
||||
|
||||
foreach ($parts as $part) {
|
||||
|
||||
// if it is a string, simply tack it onto the return sql "specification" string
|
||||
if (is_string($part)) {
|
||||
$sql .= $part;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_array($part)) {
|
||||
throw new Exception\RuntimeException('Elements returned from getExpressionData() array must be a string or array.');
|
||||
}
|
||||
|
||||
// process values and types (the middle and last position of the expression data)
|
||||
$values = $part[1];
|
||||
$types = (isset($part[2])) ? $part[2] : array();
|
||||
foreach ($values as $vIndex => $value) {
|
||||
if (isset($types[$vIndex]) && $types[$vIndex] == ExpressionInterface::TYPE_IDENTIFIER) {
|
||||
$values[$vIndex] = $platform->quoteIdentifierInFragment($value);
|
||||
} elseif (isset($types[$vIndex]) && $types[$vIndex] == ExpressionInterface::TYPE_VALUE && $value instanceof Select) {
|
||||
// process sub-select
|
||||
if ($driver) {
|
||||
$values[$vIndex] = '(' . $this->processSubSelect($value, $platform, $driver, $parameterContainer) . ')';
|
||||
} else {
|
||||
$values[$vIndex] = '(' . $this->processSubSelect($value, $platform) . ')';
|
||||
}
|
||||
} elseif (isset($types[$vIndex]) && $types[$vIndex] == ExpressionInterface::TYPE_VALUE && $value instanceof ExpressionInterface) {
|
||||
// recursive call to satisfy nested expressions
|
||||
$innerStatementContainer = $this->processExpression($value, $platform, $driver, $namedParameterPrefix . $vIndex . 'subpart');
|
||||
$values[$vIndex] = $innerStatementContainer->getSql();
|
||||
if ($driver) {
|
||||
$parameterContainer->merge($innerStatementContainer->getParameterContainer());
|
||||
}
|
||||
} elseif (isset($types[$vIndex]) && $types[$vIndex] == ExpressionInterface::TYPE_VALUE) {
|
||||
|
||||
// if prepareType is set, it means that this particular value must be
|
||||
// passed back to the statement in a way it can be used as a placeholder value
|
||||
if ($driver) {
|
||||
$name = $namedParameterPrefix . $expressionParamIndex++;
|
||||
$parameterContainer->offsetSet($name, $value);
|
||||
$values[$vIndex] = $driver->formatParameterName($name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// if not a preparable statement, simply quote the value and move on
|
||||
$values[$vIndex] = $platform->quoteValue($value);
|
||||
} elseif (isset($types[$vIndex]) && $types[$vIndex] == ExpressionInterface::TYPE_LITERAL) {
|
||||
$values[$vIndex] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// after looping the values, interpolate them into the sql string (they might be placeholder names, or values)
|
||||
$sql .= vsprintf($part[0], $values);
|
||||
}
|
||||
|
||||
$statementContainer->setSql($sql);
|
||||
return $statementContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $specifications
|
||||
* @param $parameters
|
||||
* @return string
|
||||
* @throws Exception\RuntimeException
|
||||
*/
|
||||
protected function createSqlFromSpecificationAndParameters($specifications, $parameters)
|
||||
{
|
||||
if (is_string($specifications)) {
|
||||
return vsprintf($specifications, $parameters);
|
||||
}
|
||||
|
||||
$parametersCount = count($parameters);
|
||||
foreach ($specifications as $specificationString => $paramSpecs) {
|
||||
if ($parametersCount == count($paramSpecs)) {
|
||||
break;
|
||||
}
|
||||
unset($specificationString, $paramSpecs);
|
||||
}
|
||||
|
||||
if (!isset($specificationString)) {
|
||||
throw new Exception\RuntimeException(
|
||||
'A number of parameters was found that is not supported by this specification'
|
||||
);
|
||||
}
|
||||
|
||||
$topParameters = array();
|
||||
foreach ($parameters as $position => $paramsForPosition) {
|
||||
if (isset($paramSpecs[$position]['combinedby'])) {
|
||||
$multiParamValues = array();
|
||||
foreach ($paramsForPosition as $multiParamsForPosition) {
|
||||
$ppCount = count($multiParamsForPosition);
|
||||
if (!isset($paramSpecs[$position][$ppCount])) {
|
||||
throw new Exception\RuntimeException('A number of parameters (' . $ppCount . ') was found that is not supported by this specification');
|
||||
}
|
||||
$multiParamValues[] = vsprintf($paramSpecs[$position][$ppCount], $multiParamsForPosition);
|
||||
}
|
||||
$topParameters[] = implode($paramSpecs[$position]['combinedby'], $multiParamValues);
|
||||
} elseif ($paramSpecs[$position] !== null) {
|
||||
$ppCount = count($paramsForPosition);
|
||||
if (!isset($paramSpecs[$position][$ppCount])) {
|
||||
throw new Exception\RuntimeException('A number of parameters (' . $ppCount . ') was found that is not supported by this specification');
|
||||
}
|
||||
$topParameters[] = vsprintf($paramSpecs[$position][$ppCount], $paramsForPosition);
|
||||
} else {
|
||||
$topParameters[] = $paramsForPosition;
|
||||
}
|
||||
}
|
||||
return vsprintf($specificationString, $topParameters);
|
||||
}
|
||||
|
||||
protected function processSubSelect(Select $subselect, PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($driver) {
|
||||
$stmtContainer = new StatementContainer;
|
||||
|
||||
// Track subselect prefix and count for parameters
|
||||
$this->processInfo['subselectCount']++;
|
||||
$subselect->processInfo['subselectCount'] = $this->processInfo['subselectCount'];
|
||||
$subselect->processInfo['paramPrefix'] = 'subselect' . $subselect->processInfo['subselectCount'];
|
||||
|
||||
// call subselect
|
||||
$subselect->prepareStatement(new \Zend\Db\Adapter\Adapter($driver, $platform), $stmtContainer);
|
||||
|
||||
// copy count
|
||||
$this->processInfo['subselectCount'] = $subselect->processInfo['subselectCount'];
|
||||
|
||||
$parameterContainer->merge($stmtContainer->getParameterContainer()->getNamedArray());
|
||||
$sql = $stmtContainer->getSql();
|
||||
} else {
|
||||
$sql = $subselect->getSqlString($platform);
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Blob extends Column
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* @var string Change type to blob
|
||||
*/
|
||||
protected $type = 'BLOB';
|
||||
|
||||
/**
|
||||
* @param null $name
|
||||
* @param int $length
|
||||
* @param bool $nullable
|
||||
* @param null $default
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct($name, $length, $nullable = false, $default = null, array $options = array())
|
||||
{
|
||||
$this->setName($name);
|
||||
$this->setLength($length);
|
||||
$this->setNullable($nullable);
|
||||
$this->setDefault($default);
|
||||
$this->setOptions($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $length
|
||||
* @return self
|
||||
*/
|
||||
public function setLength($length)
|
||||
{
|
||||
$this->length = $length;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLength()
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
|
||||
$params = array();
|
||||
$params[] = $this->name;
|
||||
$params[] = $this->type;
|
||||
|
||||
if ($this->length) {
|
||||
$params[1] .= ' ' . $this->length;
|
||||
}
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
|
||||
if (!$this->isNullable) {
|
||||
$params[1] .= ' NOT NULL';
|
||||
}
|
||||
|
||||
if ($this->default !== null) {
|
||||
$spec .= ' DEFAULT %s';
|
||||
$params[] = $this->default;
|
||||
$types[] = self::TYPE_VALUE;
|
||||
}
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Boolean extends Column
|
||||
{
|
||||
/**
|
||||
* @var string specification
|
||||
*/
|
||||
protected $specification = '%s TINYINT NOT NULL';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array($this->name);
|
||||
$types = array(self::TYPE_IDENTIFIER);
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Char extends Column
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s CHAR(%s) %s %s';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $length
|
||||
*/
|
||||
public function __construct($name, $length)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->length = $length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
$params[] = $this->name;
|
||||
$params[] = $this->length;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Date extends Column
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s DATE %s %s';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER);
|
||||
$params[] = $this->name;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Decimal extends Column
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $precision;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $scale;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s DECIMAL(%s) %s %s';
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @param int $precision
|
||||
* @param null|int $scale
|
||||
*/
|
||||
public function __construct($name, $precision, $scale = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->precision = $precision;
|
||||
$this->scale = $scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
$params[] = $this->name;
|
||||
$params[] = $this->precision;
|
||||
|
||||
if ($this->scale !== null) {
|
||||
$params[1] .= ', ' . $this->scale;
|
||||
}
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Float extends Column
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $decimal;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $digits;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s DECIMAL(%s) %s %s';
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @param int $digits
|
||||
* @param int $decimal
|
||||
*/
|
||||
public function __construct($name, $digits, $decimal)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->digits = $digits;
|
||||
$this->decimal = $decimal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
$params[] = $this->name;
|
||||
$params[] = $this->digits;
|
||||
$params[1] .= ', ' . $this->decimal;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Integer extends Column
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @param bool $nullable
|
||||
* @param null|string|int $default
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct($name, $nullable = false, $default = null, array $options = array())
|
||||
{
|
||||
$this->setName($name);
|
||||
$this->setNullable($nullable);
|
||||
$this->setDefault($default);
|
||||
$this->setOptions($options);
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
use Zend\Db\Sql\Ddl\Column\Column;
|
||||
|
||||
class Text extends Column
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s TEXT %s %s';
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
$params[] = $this->name;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Time extends Column
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s TIME %s %s';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER);
|
||||
$params[] = $this->name;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
class Varchar extends Column
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = '%s VARCHAR(%s) %s %s';
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @param int $length
|
||||
*/
|
||||
public function __construct($name, $length)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->length = $length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$spec = $this->specification;
|
||||
$params = array();
|
||||
|
||||
$types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
|
||||
$params[] = $this->name;
|
||||
$params[] = $this->length;
|
||||
|
||||
$types[] = self::TYPE_LITERAL;
|
||||
$params[] = (!$this->isNullable) ? 'NOT NULL' : '';
|
||||
|
||||
$types[] = ($this->default !== null) ? self::TYPE_VALUE : self::TYPE_LITERAL;
|
||||
$params[] = ($this->default !== null) ? $this->default : '';
|
||||
|
||||
return array(array(
|
||||
$spec,
|
||||
$params,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Constraint;
|
||||
|
||||
abstract class AbstractConstraint implements ConstraintInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $columns = array();
|
||||
|
||||
/**
|
||||
* @param null|string|array $columns
|
||||
*/
|
||||
public function __construct($columns = null)
|
||||
{
|
||||
(!$columns) ?: $this->setColumns($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string|array $columns
|
||||
* @return self
|
||||
*/
|
||||
public function setColumns($columns)
|
||||
{
|
||||
if (!is_array($columns)) {
|
||||
$columns = array($columns);
|
||||
}
|
||||
|
||||
$this->columns = $columns;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @return self
|
||||
*/
|
||||
public function addColumn($column)
|
||||
{
|
||||
$this->columns[] = $column;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Constraint;
|
||||
|
||||
class ForeignKey extends AbstractConstraint
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $onDeleteRule = 'NO ACTION';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $onUpdateRule = 'NO ACTION';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $referenceColumn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $referenceTable;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = 'CONSTRAINT %1$s FOREIGN KEY (%2$s) REFERENCES %3$s (%4$s) ON DELETE %5$s ON UPDATE %6$s';
|
||||
|
||||
/**
|
||||
* @param array|null|string $name
|
||||
* @param string $column
|
||||
* @param string $referenceTable
|
||||
* @param string $referenceColumn
|
||||
* @param null|string $onDeleteRule
|
||||
* @param null|string $onUpdateRule
|
||||
*/
|
||||
public function __construct($name, $column, $referenceTable, $referenceColumn, $onDeleteRule = null, $onUpdateRule = null)
|
||||
{
|
||||
$this->setName($name);
|
||||
$this->setColumns($column);
|
||||
$this->setReferenceTable($referenceTable);
|
||||
$this->setReferenceColumn($referenceColumn);
|
||||
(!$onDeleteRule) ?: $this->setOnDeleteRule($onDeleteRule);
|
||||
(!$onUpdateRule) ?: $this->setOnUpdateRule($onUpdateRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $referenceTable
|
||||
* @return self
|
||||
*/
|
||||
public function setReferenceTable($referenceTable)
|
||||
{
|
||||
$this->referenceTable = $referenceTable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getReferenceTable()
|
||||
{
|
||||
return $this->referenceTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $referenceColumn
|
||||
* @return self
|
||||
*/
|
||||
public function setReferenceColumn($referenceColumn)
|
||||
{
|
||||
$this->referenceColumn = $referenceColumn;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getReferenceColumn()
|
||||
{
|
||||
return $this->referenceColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $onDeleteRule
|
||||
* @return self
|
||||
*/
|
||||
public function setOnDeleteRule($onDeleteRule)
|
||||
{
|
||||
$this->onDeleteRule = $onDeleteRule;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOnDeleteRule()
|
||||
{
|
||||
return $this->onDeleteRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $onUpdateRule
|
||||
* @return self
|
||||
*/
|
||||
public function setOnUpdateRule($onUpdateRule)
|
||||
{
|
||||
$this->onUpdateRule = $onUpdateRule;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOnUpdateRule()
|
||||
{
|
||||
return $this->onUpdateRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
return array(array(
|
||||
$this->specification,
|
||||
array(
|
||||
$this->name,
|
||||
$this->columns[0],
|
||||
$this->referenceTable,
|
||||
$this->referenceColumn,
|
||||
$this->onDeleteRule,
|
||||
$this->onUpdateRule,
|
||||
),
|
||||
array(
|
||||
self::TYPE_IDENTIFIER,
|
||||
self::TYPE_IDENTIFIER,
|
||||
self::TYPE_IDENTIFIER,
|
||||
self::TYPE_IDENTIFIER,
|
||||
self::TYPE_LITERAL,
|
||||
self::TYPE_LITERAL,
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Constraint;
|
||||
|
||||
class PrimaryKey extends AbstractConstraint
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = 'PRIMARY KEY (%s)';
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$colCount = count($this->columns);
|
||||
$newSpecParts = array_fill(0, $colCount, '%s');
|
||||
$newSpecTypes = array_fill(0, $colCount, self::TYPE_IDENTIFIER);
|
||||
|
||||
$newSpec = sprintf($this->specification, implode(', ', $newSpecParts));
|
||||
|
||||
return array(array(
|
||||
$newSpec,
|
||||
$this->columns,
|
||||
$newSpecTypes,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl\Constraint;
|
||||
|
||||
class UniqueKey extends AbstractConstraint
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $specification = 'CONSTRAINT UNIQUE KEY %s(...)';
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param null|string $name
|
||||
*/
|
||||
public function __construct($column, $name = null)
|
||||
{
|
||||
$this->setColumns($column);
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$colCount = count($this->columns);
|
||||
|
||||
$values = array();
|
||||
$values[] = ($this->name) ? $this->name : '';
|
||||
|
||||
$newSpecTypes = array(self::TYPE_IDENTIFIER);
|
||||
$newSpecParts = array();
|
||||
|
||||
for ($i = 0; $i < $colCount; $i++) {
|
||||
$newSpecParts[] = '%s';
|
||||
$newSpecTypes[] = self::TYPE_IDENTIFIER;
|
||||
}
|
||||
|
||||
$newSpec = str_replace('...', implode(', ', $newSpecParts), $this->specification);
|
||||
|
||||
return array(array(
|
||||
$newSpec,
|
||||
array_merge($values, $this->columns),
|
||||
$newSpecTypes,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Ddl;
|
||||
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\Platform\Sql92 as AdapterSql92Platform;
|
||||
use Zend\Db\Sql\AbstractSql;
|
||||
|
||||
class DropTable extends AbstractSql implements SqlInterface
|
||||
{
|
||||
const TABLE = 'table';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $specifications = array(
|
||||
self::TABLE => 'DROP TABLE %1$s'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = '';
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*/
|
||||
public function __construct($table = '')
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|PlatformInterface $adapterPlatform
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
// get platform, or create default
|
||||
$adapterPlatform = ($adapterPlatform) ?: new AdapterSql92Platform;
|
||||
|
||||
$sqls = array();
|
||||
$parameters = array();
|
||||
|
||||
foreach ($this->specifications as $name => $specification) {
|
||||
$parameters[$name] = $this->{'process' . $name}(
|
||||
$adapterPlatform,
|
||||
null,
|
||||
null,
|
||||
$sqls,
|
||||
$parameters
|
||||
);
|
||||
|
||||
if ($specification && is_array($parameters[$name])) {
|
||||
$sqls[$name] = $this->createSqlFromSpecificationAndParameters(
|
||||
$specification,
|
||||
$parameters[$name]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = implode(' ', $sqls);
|
||||
return $sql;
|
||||
}
|
||||
|
||||
protected function processTable(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
return array($adapterPlatform->quoteIdentifier($this->table));
|
||||
}
|
||||
}
|
@ -1,244 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\Platform\Sql92;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property Where $where
|
||||
*/
|
||||
class Delete extends AbstractSql implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
/**@#+
|
||||
* @const
|
||||
*/
|
||||
const SPECIFICATION_DELETE = 'delete';
|
||||
const SPECIFICATION_WHERE = 'where';
|
||||
/**@#-*/
|
||||
|
||||
/**
|
||||
* @var array Specifications
|
||||
*/
|
||||
protected $specifications = array(
|
||||
self::SPECIFICATION_DELETE => 'DELETE FROM %1$s',
|
||||
self::SPECIFICATION_WHERE => 'WHERE %1$s'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string|TableIdentifier
|
||||
*/
|
||||
protected $table = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $emptyWhereProtection = true;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $set = array();
|
||||
|
||||
/**
|
||||
* @var null|string|Where
|
||||
*/
|
||||
protected $where = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string|TableIdentifier $table
|
||||
*/
|
||||
public function __construct($table = null)
|
||||
{
|
||||
if ($table) {
|
||||
$this->from($table);
|
||||
}
|
||||
$this->where = new Where();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from statement
|
||||
*
|
||||
* @param string|TableIdentifier $table
|
||||
* @return Delete
|
||||
*/
|
||||
public function from($table)
|
||||
{
|
||||
$this->table = $table;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRawState($key = null)
|
||||
{
|
||||
$rawState = array(
|
||||
'emptyWhereProtection' => $this->emptyWhereProtection,
|
||||
'table' => $this->table,
|
||||
'set' => $this->set,
|
||||
'where' => $this->where
|
||||
);
|
||||
return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create where clause
|
||||
*
|
||||
* @param Where|\Closure|string|array $predicate
|
||||
* @param string $combination One of the OP_* constants from Predicate\PredicateSet
|
||||
* @return Delete
|
||||
*/
|
||||
public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
|
||||
{
|
||||
if ($predicate instanceof Where) {
|
||||
$this->where = $predicate;
|
||||
} elseif ($predicate instanceof \Closure) {
|
||||
$predicate($this->where);
|
||||
} else {
|
||||
|
||||
if (is_string($predicate)) {
|
||||
// String $predicate should be passed as an expression
|
||||
$predicate = new Predicate\Expression($predicate);
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
} elseif (is_array($predicate)) {
|
||||
|
||||
foreach ($predicate as $pkey => $pvalue) {
|
||||
// loop through predicates
|
||||
|
||||
if (is_string($pkey) && strpos($pkey, '?') !== false) {
|
||||
// First, process strings that the abstraction replacement character ?
|
||||
// as an Expression predicate
|
||||
$predicate = new Predicate\Expression($pkey, $pvalue);
|
||||
|
||||
} elseif (is_string($pkey)) {
|
||||
// Otherwise, if still a string, do something intelligent with the PHP type provided
|
||||
|
||||
if ($pvalue === null) {
|
||||
// map PHP null to SQL IS NULL expression
|
||||
$predicate = new Predicate\IsNull($pkey, $pvalue);
|
||||
} elseif (is_array($pvalue)) {
|
||||
// if the value is an array, assume IN() is desired
|
||||
$predicate = new Predicate\In($pkey, $pvalue);
|
||||
} else {
|
||||
// otherwise assume that array('foo' => 'bar') means "foo" = 'bar'
|
||||
$predicate = new Predicate\Operator($pkey, Predicate\Operator::OP_EQ, $pvalue);
|
||||
}
|
||||
} elseif ($pvalue instanceof Predicate\PredicateInterface) {
|
||||
// Predicate type is ok
|
||||
$predicate = $pvalue;
|
||||
} else {
|
||||
// must be an array of expressions (with int-indexed array)
|
||||
$predicate = new Predicate\Expression($pvalue);
|
||||
}
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the delete statement
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
* @return void
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
$driver = $adapter->getDriver();
|
||||
$platform = $adapter->getPlatform();
|
||||
$parameterContainer = $statementContainer->getParameterContainer();
|
||||
|
||||
if (!$parameterContainer instanceof ParameterContainer) {
|
||||
$parameterContainer = new ParameterContainer();
|
||||
$statementContainer->setParameterContainer($parameterContainer);
|
||||
}
|
||||
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in delete processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $platform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$sql = sprintf($this->specifications[self::SPECIFICATION_DELETE], $table);
|
||||
|
||||
// process where
|
||||
if ($this->where->count() > 0) {
|
||||
$whereParts = $this->processExpression($this->where, $platform, $driver, 'where');
|
||||
$parameterContainer->merge($whereParts->getParameterContainer());
|
||||
$sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql());
|
||||
}
|
||||
$statementContainer->setSql($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SQL string, based on the platform
|
||||
*
|
||||
* Platform defaults to Sql92 if none provided
|
||||
*
|
||||
* @param null|PlatformInterface $adapterPlatform
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
$adapterPlatform = ($adapterPlatform) ?: new Sql92;
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in delete processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $adapterPlatform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $adapterPlatform->quoteIdentifier($schema) . $adapterPlatform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$sql = sprintf($this->specifications[self::SPECIFICATION_DELETE], $table);
|
||||
|
||||
if ($this->where->count() > 0) {
|
||||
$whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where');
|
||||
$sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql());
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Property overloading
|
||||
*
|
||||
* Overloads "where" only.
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
switch (strtolower($name)) {
|
||||
case 'where':
|
||||
return $this->where;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,302 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\Platform\Sql92;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
|
||||
class Insert extends AbstractSql implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
/**#@+
|
||||
* Constants
|
||||
*
|
||||
* @const
|
||||
*/
|
||||
const SPECIFICATION_INSERT = 'insert';
|
||||
const VALUES_MERGE = 'merge';
|
||||
const VALUES_SET = 'set';
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* @var array Specification array
|
||||
*/
|
||||
protected $specifications = array(
|
||||
self::SPECIFICATION_INSERT => 'INSERT INTO %1$s (%2$s) VALUES (%3$s)'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string|TableIdentifier
|
||||
*/
|
||||
protected $table = null;
|
||||
protected $columns = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $values = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string|TableIdentifier $table
|
||||
*/
|
||||
public function __construct($table = null)
|
||||
{
|
||||
if ($table) {
|
||||
$this->into($table);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crete INTO clause
|
||||
*
|
||||
* @param string|TableIdentifier $table
|
||||
* @return Insert
|
||||
*/
|
||||
public function into($table)
|
||||
{
|
||||
$this->table = $table;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify columns
|
||||
*
|
||||
* @param array $columns
|
||||
* @return Insert
|
||||
*/
|
||||
public function columns(array $columns)
|
||||
{
|
||||
$this->columns = $columns;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify values to insert
|
||||
*
|
||||
* @param array $values
|
||||
* @param string $flag one of VALUES_MERGE or VALUES_SET; defaults to VALUES_SET
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Insert
|
||||
*/
|
||||
public function values(array $values, $flag = self::VALUES_SET)
|
||||
{
|
||||
if ($values == null) {
|
||||
throw new \InvalidArgumentException('values() expects an array of values');
|
||||
}
|
||||
|
||||
// determine if this is assoc or a set of values
|
||||
$keys = array_keys($values);
|
||||
$firstKey = current($keys);
|
||||
|
||||
if ($flag == self::VALUES_SET) {
|
||||
$this->columns = array();
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
if (is_string($firstKey)) {
|
||||
foreach ($keys as $key) {
|
||||
if (($index = array_search($key, $this->columns)) !== false) {
|
||||
$this->values[$index] = $values[$key];
|
||||
} else {
|
||||
$this->columns[] = $key;
|
||||
$this->values[] = $values[$key];
|
||||
}
|
||||
}
|
||||
} elseif (is_int($firstKey)) {
|
||||
// determine if count of columns should match count of values
|
||||
$this->values = array_merge($this->values, array_values($values));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRawState($key = null)
|
||||
{
|
||||
$rawState = array(
|
||||
'table' => $this->table,
|
||||
'columns' => $this->columns,
|
||||
'values' => $this->values
|
||||
);
|
||||
return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare statement
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
* @return void
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
$driver = $adapter->getDriver();
|
||||
$platform = $adapter->getPlatform();
|
||||
$parameterContainer = $statementContainer->getParameterContainer();
|
||||
|
||||
if (!$parameterContainer instanceof ParameterContainer) {
|
||||
$parameterContainer = new ParameterContainer();
|
||||
$statementContainer->setParameterContainer($parameterContainer);
|
||||
}
|
||||
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in insert processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $platform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$columns = array();
|
||||
$values = array();
|
||||
|
||||
foreach ($this->columns as $cIndex => $column) {
|
||||
$columns[$cIndex] = $platform->quoteIdentifier($column);
|
||||
if (isset($this->values[$cIndex]) && $this->values[$cIndex] instanceof Expression) {
|
||||
$exprData = $this->processExpression($this->values[$cIndex], $platform, $driver);
|
||||
$values[$cIndex] = $exprData->getSql();
|
||||
$parameterContainer->merge($exprData->getParameterContainer());
|
||||
} else {
|
||||
$values[$cIndex] = $driver->formatParameterName($column);
|
||||
if (isset($this->values[$cIndex])) {
|
||||
$parameterContainer->offsetSet($column, $this->values[$cIndex]);
|
||||
} else {
|
||||
$parameterContainer->offsetSet($column, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
$this->specifications[self::SPECIFICATION_INSERT],
|
||||
$table,
|
||||
implode(', ', $columns),
|
||||
implode(', ', $values)
|
||||
);
|
||||
|
||||
$statementContainer->setSql($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL string for this statement
|
||||
*
|
||||
* @param null|PlatformInterface $adapterPlatform Defaults to Sql92 if none provided
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
$adapterPlatform = ($adapterPlatform) ?: new Sql92;
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in insert processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $adapterPlatform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $adapterPlatform->quoteIdentifier($schema) . $adapterPlatform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$columns = array_map(array($adapterPlatform, 'quoteIdentifier'), $this->columns);
|
||||
$columns = implode(', ', $columns);
|
||||
|
||||
$values = array();
|
||||
foreach ($this->values as $value) {
|
||||
if ($value instanceof Expression) {
|
||||
$exprData = $this->processExpression($value, $adapterPlatform);
|
||||
$values[] = $exprData->getSql();
|
||||
} elseif ($value === null) {
|
||||
$values[] = 'NULL';
|
||||
} else {
|
||||
$values[] = $adapterPlatform->quoteValue($value);
|
||||
}
|
||||
}
|
||||
|
||||
$values = implode(', ', $values);
|
||||
|
||||
return sprintf($this->specifications[self::SPECIFICATION_INSERT], $table, $columns, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading: variable setting
|
||||
*
|
||||
* Proxies to values, using VALUES_MERGE strategy
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return Insert
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$values = array($name => $value);
|
||||
$this->values($values, self::VALUES_MERGE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading: variable unset
|
||||
*
|
||||
* Proxies to values and columns
|
||||
*
|
||||
* @param string $name
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return void
|
||||
*/
|
||||
public function __unset($name)
|
||||
{
|
||||
if (($position = array_search($name, $this->columns)) === false) {
|
||||
throw new Exception\InvalidArgumentException('The key ' . $name . ' was not found in this objects column list');
|
||||
}
|
||||
|
||||
unset($this->columns[$position]);
|
||||
unset($this->values[$position]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading: variable isset
|
||||
*
|
||||
* Proxies to columns; does a column of that name exist?
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
return in_array($name, $this->columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading: variable retrieval
|
||||
*
|
||||
* Retrieves value by column name
|
||||
*
|
||||
* @param string $name
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if (($position = array_search($name, $this->columns)) === false) {
|
||||
throw new Exception\InvalidArgumentException('The key ' . $name . ' was not found in this objects column list');
|
||||
}
|
||||
return $this->values[$position];
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Platform;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
use Zend\Db\Sql\Exception;
|
||||
use Zend\Db\Sql\PreparableSqlInterface;
|
||||
use Zend\Db\Sql\SqlInterface;
|
||||
|
||||
class AbstractPlatform implements PlatformDecoratorInterface, PreparableSqlInterface, SqlInterface
|
||||
{
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
protected $subject = null;
|
||||
|
||||
/**
|
||||
* @var PlatformDecoratorInterface[]
|
||||
*/
|
||||
protected $decorators = array();
|
||||
|
||||
/**
|
||||
* @param $subject
|
||||
*/
|
||||
public function setSubject($subject)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param PlatformDecoratorInterface $decorator
|
||||
*/
|
||||
public function setTypeDecorator($type, PlatformDecoratorInterface $decorator)
|
||||
{
|
||||
$this->decorators[$type] = $decorator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|PlatformDecoratorInterface[]
|
||||
*/
|
||||
public function getDecorators()
|
||||
{
|
||||
return $this->decorators;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
* @throws Exception\RuntimeException
|
||||
* @return void
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
if (!$this->subject instanceof PreparableSqlInterface) {
|
||||
throw new Exception\RuntimeException('The subject does not appear to implement Zend\Db\Sql\PreparableSqlInterface, thus calling prepareStatement() has no effect');
|
||||
}
|
||||
|
||||
$decoratorForType = false;
|
||||
foreach ($this->decorators as $type => $decorator) {
|
||||
if ($this->subject instanceof $type && $decorator instanceof PreparableSqlInterface) {
|
||||
/** @var $decoratorForType PreparableSqlInterface|PlatformDecoratorInterface */
|
||||
$decoratorForType = $decorator;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($decoratorForType) {
|
||||
$decoratorForType->setSubject($this->subject);
|
||||
$decoratorForType->prepareStatement($adapter, $statementContainer);
|
||||
} else {
|
||||
$this->subject->prepareStatement($adapter, $statementContainer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|\Zend\Db\Adapter\Platform\PlatformInterface $adapterPlatform
|
||||
* @return mixed
|
||||
* @throws Exception\RuntimeException
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
if (!$this->subject instanceof SqlInterface) {
|
||||
throw new Exception\RuntimeException('The subject does not appear to implement Zend\Db\Sql\PreparableSqlInterface, thus calling prepareStatement() has no effect');
|
||||
}
|
||||
|
||||
$decoratorForType = false;
|
||||
foreach ($this->decorators as $type => $decorator) {
|
||||
if ($this->subject instanceof $type && $decorator instanceof SqlInterface) {
|
||||
/** @var $decoratorForType SqlInterface|PlatformDecoratorInterface */
|
||||
$decoratorForType = $decorator;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($decoratorForType) {
|
||||
$decoratorForType->setSubject($this->subject);
|
||||
return $decoratorForType->getSqlString($adapterPlatform);
|
||||
}
|
||||
|
||||
return $this->subject->getSqlString($adapterPlatform);
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Platform\Mysql\Ddl;
|
||||
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Sql\Ddl\CreateTable;
|
||||
use Zend\Db\Sql\Platform\PlatformDecoratorInterface;
|
||||
|
||||
class CreateTableDecorator extends CreateTable implements PlatformDecoratorInterface
|
||||
{
|
||||
/**
|
||||
* @var CreateTable
|
||||
*/
|
||||
protected $createTable;
|
||||
|
||||
/**
|
||||
* @param CreateTable $subject
|
||||
*/
|
||||
public function setSubject($subject)
|
||||
{
|
||||
$this->createTable = $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|PlatformInterface $platform
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $platform = null)
|
||||
{
|
||||
// localize variables
|
||||
foreach (get_object_vars($this->createTable) as $name => $value) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
return parent::getSqlString($platform);
|
||||
}
|
||||
|
||||
protected function processColumns(PlatformInterface $platform = null)
|
||||
{
|
||||
$sqls = array();
|
||||
foreach ($this->columns as $i => $column) {
|
||||
$stmtContainer = $this->processExpression($column, $platform);
|
||||
$sql = $stmtContainer->getSql();
|
||||
$columnOptions = $column->getOptions();
|
||||
|
||||
foreach ($columnOptions as $coName => $coValue) {
|
||||
switch (strtolower(str_replace(array('-', '_', ' '), '', $coName))) {
|
||||
case 'identity':
|
||||
case 'serial':
|
||||
case 'autoincrement':
|
||||
$sql .= ' AUTO_INCREMENT';
|
||||
break;
|
||||
/*
|
||||
case 'primary':
|
||||
case 'primarykey':
|
||||
$sql .= ' PRIMARY KEY';
|
||||
break;
|
||||
case 'unique':
|
||||
case 'uniquekey':
|
||||
$sql .= ' UNIQUE KEY';
|
||||
break;
|
||||
*/
|
||||
case 'comment':
|
||||
$sql .= ' COMMENT \'' . $coValue . '\'';
|
||||
break;
|
||||
case 'columnformat':
|
||||
case 'format':
|
||||
$sql .= ' COLUMN_FORMAT ' . strtoupper($coValue);
|
||||
break;
|
||||
case 'storage':
|
||||
$sql .= ' STORAGE ' . strtoupper($coValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmtContainer->setSql($sql);
|
||||
$sqls[$i] = $stmtContainer;
|
||||
}
|
||||
return array($sqls);
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Platform\Mysql;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
use Zend\Db\Sql\Platform\PlatformDecoratorInterface;
|
||||
use Zend\Db\Sql\Select;
|
||||
|
||||
class SelectDecorator extends Select implements PlatformDecoratorInterface
|
||||
{
|
||||
/**
|
||||
* @var Select
|
||||
*/
|
||||
protected $select = null;
|
||||
|
||||
/**
|
||||
* @param Select $select
|
||||
*/
|
||||
public function setSubject($select)
|
||||
{
|
||||
$this->select = $select;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
// localize variables
|
||||
foreach (get_object_vars($this->select) as $name => $value) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
parent::prepareStatement($adapter, $statementContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PlatformInterface $platform
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $platform = null)
|
||||
{
|
||||
// localize variables
|
||||
foreach (get_object_vars($this->select) as $name => $value) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
return parent::getSqlString($platform);
|
||||
}
|
||||
|
||||
protected function processLimit(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->limit === null) {
|
||||
return null;
|
||||
}
|
||||
if ($driver) {
|
||||
$sql = $driver->formatParameterName('limit');
|
||||
$parameterContainer->offsetSet('limit', (int) $this->limit, ParameterContainer::TYPE_INTEGER);
|
||||
} else {
|
||||
$sql = $this->limit;
|
||||
}
|
||||
|
||||
return array($sql);
|
||||
}
|
||||
|
||||
protected function processOffset(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->offset === null) {
|
||||
return null;
|
||||
}
|
||||
if ($driver) {
|
||||
$parameterContainer->offsetSet('offset', (int) $this->offset, ParameterContainer::TYPE_INTEGER);
|
||||
return array($driver->formatParameterName('offset'));
|
||||
}
|
||||
|
||||
return array($this->offset);
|
||||
}
|
||||
}
|
@ -1,182 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Platform\Oracle;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
use Zend\Db\Sql\ExpressionInterface;
|
||||
use Zend\Db\Sql\Platform\PlatformDecoratorInterface;
|
||||
use Zend\Db\Sql\Select;
|
||||
|
||||
class SelectDecorator extends Select implements PlatformDecoratorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Select
|
||||
*/
|
||||
protected $select = null;
|
||||
|
||||
/**
|
||||
* @param Select $select
|
||||
*/
|
||||
public function setSubject($select)
|
||||
{
|
||||
$this->select = $select;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \Zend\Db\Sql\Select::renderTable
|
||||
*/
|
||||
protected function renderTable($table, $alias = null)
|
||||
{
|
||||
return $table . ' ' . $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
// localize variables
|
||||
foreach (get_object_vars($this->select) as $name => $value) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
// set specifications
|
||||
unset($this->specifications[self::LIMIT]);
|
||||
unset($this->specifications[self::OFFSET]);
|
||||
|
||||
$this->specifications['LIMITOFFSET'] = null;
|
||||
parent::prepareStatement($adapter, $statementContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PlatformInterface $platform
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $platform = null)
|
||||
{
|
||||
// localize variables
|
||||
foreach (get_object_vars($this->select) as $name => $value) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
// set specifications
|
||||
unset($this->specifications[self::LIMIT]);
|
||||
unset($this->specifications[self::OFFSET]);
|
||||
|
||||
$this->specifications['LIMITOFFSET'] = null;
|
||||
return parent::getSqlString($platform);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PlatformInterface $platform
|
||||
* @param DriverInterface $driver
|
||||
* @param ParameterContainer $parameterContainer
|
||||
* @param $sqls
|
||||
* @param $parameters
|
||||
* @return null
|
||||
*/
|
||||
protected function processLimitOffset(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null, &$sqls, &$parameters)
|
||||
{
|
||||
if ($this->limit === null && $this->offset === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$selectParameters = $parameters[self::SELECT];
|
||||
|
||||
$starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR;
|
||||
foreach ($selectParameters[0] as $i => $columnParameters) {
|
||||
if ($columnParameters[0] == self::SQL_STAR || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) || strpos($columnParameters[0], $starSuffix)) {
|
||||
$selectParameters[0] = array(array(self::SQL_STAR));
|
||||
break;
|
||||
}
|
||||
if (isset($columnParameters[1])) {
|
||||
array_shift($columnParameters);
|
||||
$selectParameters[0][$i] = $columnParameters;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->offset === null) {
|
||||
$this->offset = 0;
|
||||
}
|
||||
|
||||
// first, produce column list without compound names (using the AS portion only)
|
||||
array_unshift($sqls, $this->createSqlFromSpecificationAndParameters(
|
||||
array('SELECT %1$s FROM (SELECT b.%1$s, rownum b_rownum FROM (' => current($this->specifications[self::SELECT])), $selectParameters
|
||||
));
|
||||
|
||||
if ($parameterContainer) {
|
||||
if ($this->limit === null) {
|
||||
array_push($sqls, ') b ) WHERE b_rownum > (:offset)');
|
||||
$parameterContainer->offsetSet('offset', $this->offset, $parameterContainer::TYPE_INTEGER);
|
||||
} else {
|
||||
// create bottom part of query, with offset and limit using row_number
|
||||
array_push($sqls, ') b WHERE rownum <= (:offset+:limit)) WHERE b_rownum >= (:offset + 1)');
|
||||
$parameterContainer->offsetSet('offset', $this->offset, $parameterContainer::TYPE_INTEGER);
|
||||
$parameterContainer->offsetSet('limit', $this->limit, $parameterContainer::TYPE_INTEGER);
|
||||
}
|
||||
} else {
|
||||
if ($this->limit === null) {
|
||||
array_push($sqls, ') b ) WHERE b_rownum > ('. (int) $this->offset. ')'
|
||||
);
|
||||
} else {
|
||||
array_push($sqls, ') b WHERE rownum <= ('
|
||||
. (int) $this->offset
|
||||
. '+'
|
||||
. (int) $this->limit
|
||||
. ')) WHERE b_rownum >= ('
|
||||
. (int) $this->offset
|
||||
. ' + 1)'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters(
|
||||
$this->specifications[self::SELECT], $parameters[self::SELECT]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function processJoins(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if (!$this->joins) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// process joins
|
||||
$joinSpecArgArray = array();
|
||||
foreach ($this->joins as $j => $join) {
|
||||
$joinSpecArgArray[$j] = array();
|
||||
// type
|
||||
$joinSpecArgArray[$j][] = strtoupper($join['type']);
|
||||
// table name
|
||||
$joinSpecArgArray[$j][] = (is_array($join['name']))
|
||||
? $platform->quoteIdentifier(current($join['name'])) . ' ' . $platform->quoteIdentifier(key($join['name']))
|
||||
: $platform->quoteIdentifier($join['name']);
|
||||
// on expression
|
||||
$joinSpecArgArray[$j][] = ($join['on'] instanceof ExpressionInterface)
|
||||
? $this->processExpression($join['on'], $platform, $driver, $this->processInfo['paramPrefix'] . 'join')
|
||||
: $platform->quoteIdentifierInFragment($join['on'], array('=', 'AND', 'OR', '(', ')', 'BETWEEN')); // on
|
||||
if ($joinSpecArgArray[$j][2] instanceof StatementContainerInterface) {
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($joinSpecArgArray[$j][2]->getParameterContainer());
|
||||
}
|
||||
$joinSpecArgArray[$j][2] = $joinSpecArgArray[$j][2]->getSql();
|
||||
}
|
||||
}
|
||||
|
||||
return array($joinSpecArgArray);
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Platform;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
|
||||
class Platform extends AbstractPlatform
|
||||
{
|
||||
|
||||
/**
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter = null;
|
||||
|
||||
public function __construct(AdapterInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$platform = $adapter->getPlatform();
|
||||
switch (strtolower($platform->getName())) {
|
||||
case 'mysql':
|
||||
$platform = new Mysql\Mysql();
|
||||
$this->decorators = $platform->decorators;
|
||||
break;
|
||||
case 'sqlserver':
|
||||
$platform = new SqlServer\SqlServer();
|
||||
$this->decorators = $platform->decorators;
|
||||
break;
|
||||
case 'oracle':
|
||||
$platform = new Oracle\Oracle();
|
||||
$this->decorators = $platform->decorators;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Predicate;
|
||||
|
||||
use Zend\Db\Sql\Exception;
|
||||
use Zend\Db\Sql\Select;
|
||||
|
||||
class In implements PredicateInterface
|
||||
{
|
||||
protected $identifier;
|
||||
protected $valueSet;
|
||||
|
||||
protected $selectSpecification = '%s IN %s';
|
||||
protected $valueSpecSpecification = '%%s IN (%s)';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string $identifier
|
||||
* @param array $valueSet
|
||||
*/
|
||||
public function __construct($identifier = null, $valueSet = null)
|
||||
{
|
||||
if ($identifier) {
|
||||
$this->setIdentifier($identifier);
|
||||
}
|
||||
if ($valueSet) {
|
||||
$this->setValueSet($valueSet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set identifier for comparison
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return In
|
||||
*/
|
||||
public function setIdentifier($identifier)
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identifier of comparison
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set set of values for IN comparison
|
||||
*
|
||||
* @param array $valueSet
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return In
|
||||
*/
|
||||
public function setValueSet($valueSet)
|
||||
{
|
||||
if (!is_array($valueSet) && !$valueSet instanceof Select) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'$valueSet must be either an array or a Zend\Db\Sql\Select object, ' . gettype($valueSet) . ' given'
|
||||
);
|
||||
}
|
||||
$this->valueSet = $valueSet;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueSet()
|
||||
{
|
||||
return $this->valueSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of parts for where statement
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$values = $this->getValueSet();
|
||||
if ($values instanceof Select) {
|
||||
$specification = $this->selectSpecification;
|
||||
$types = array(self::TYPE_VALUE);
|
||||
$values = array($values);
|
||||
} else {
|
||||
$specification = sprintf($this->valueSpecSpecification, implode(', ', array_fill(0, count($values), '%s')));
|
||||
$types = array_fill(0, count($values), self::TYPE_VALUE);
|
||||
}
|
||||
|
||||
$identifier = $this->getIdentifier();
|
||||
array_unshift($values, $identifier);
|
||||
array_unshift($types, self::TYPE_IDENTIFIER);
|
||||
|
||||
return array(array(
|
||||
$specification,
|
||||
$values,
|
||||
$types,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Zend\Db\Sql\Predicate;
|
||||
|
||||
use Zend\Db\Sql\Literal as BaseLiteral;
|
||||
|
||||
class Literal extends BaseLiteral implements PredicateInterface
|
||||
{
|
||||
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql\Predicate;
|
||||
|
||||
use Countable;
|
||||
|
||||
class PredicateSet implements PredicateInterface, Countable
|
||||
{
|
||||
const COMBINED_BY_AND = 'AND';
|
||||
const OP_AND = 'AND';
|
||||
|
||||
const COMBINED_BY_OR = 'OR';
|
||||
const OP_OR = 'OR';
|
||||
|
||||
protected $defaultCombination = self::COMBINED_BY_AND;
|
||||
protected $predicates = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|array $predicates
|
||||
* @param string $defaultCombination
|
||||
*/
|
||||
public function __construct(array $predicates = null, $defaultCombination = self::COMBINED_BY_AND)
|
||||
{
|
||||
$this->defaultCombination = $defaultCombination;
|
||||
if ($predicates) {
|
||||
foreach ($predicates as $predicate) {
|
||||
$this->addPredicate($predicate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add predicate to set
|
||||
*
|
||||
* @param PredicateInterface $predicate
|
||||
* @param string $combination
|
||||
* @return PredicateSet
|
||||
*/
|
||||
public function addPredicate(PredicateInterface $predicate, $combination = null)
|
||||
{
|
||||
if ($combination === null || !in_array($combination, array(self::OP_AND, self::OP_OR))) {
|
||||
$combination = $this->defaultCombination;
|
||||
}
|
||||
|
||||
if ($combination == self::OP_OR) {
|
||||
$this->orPredicate($predicate);
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->andPredicate($predicate);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the predicates
|
||||
*
|
||||
* @return PredicateInterface[]
|
||||
*/
|
||||
public function getPredicates()
|
||||
{
|
||||
return $this->predicates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add predicate using OR operator
|
||||
*
|
||||
* @param PredicateInterface $predicate
|
||||
* @return PredicateSet
|
||||
*/
|
||||
public function orPredicate(PredicateInterface $predicate)
|
||||
{
|
||||
$this->predicates[] = array(self::OP_OR, $predicate);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add predicate using AND operator
|
||||
*
|
||||
* @param PredicateInterface $predicate
|
||||
* @return PredicateSet
|
||||
*/
|
||||
public function andPredicate(PredicateInterface $predicate)
|
||||
{
|
||||
$this->predicates[] = array(self::OP_AND, $predicate);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get predicate parts for where statement
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressionData()
|
||||
{
|
||||
$parts = array();
|
||||
for ($i = 0, $count = count($this->predicates); $i < $count; $i++) {
|
||||
|
||||
/** @var $predicate PredicateInterface */
|
||||
$predicate = $this->predicates[$i][1];
|
||||
|
||||
if ($predicate instanceof PredicateSet) {
|
||||
$parts[] = '(';
|
||||
}
|
||||
|
||||
$parts = array_merge($parts, $predicate->getExpressionData());
|
||||
|
||||
if ($predicate instanceof PredicateSet) {
|
||||
$parts[] = ')';
|
||||
}
|
||||
|
||||
if (isset($this->predicates[$i+1])) {
|
||||
$parts[] = sprintf(' %s ', $this->predicates[$i+1][0]);
|
||||
}
|
||||
}
|
||||
return $parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of attached predicates
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->predicates);
|
||||
}
|
||||
}
|
@ -1,996 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\Driver\DriverInterface;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\Platform\Sql92 as AdapterSql92Platform;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property Where $where
|
||||
* @property Having $having
|
||||
*/
|
||||
class Select extends AbstractSql implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
/**#@+
|
||||
* Constant
|
||||
* @const
|
||||
*/
|
||||
const SELECT = 'select';
|
||||
const QUANTIFIER = 'quantifier';
|
||||
const COLUMNS = 'columns';
|
||||
const TABLE = 'table';
|
||||
const JOINS = 'joins';
|
||||
const WHERE = 'where';
|
||||
const GROUP = 'group';
|
||||
const HAVING = 'having';
|
||||
const ORDER = 'order';
|
||||
const LIMIT = 'limit';
|
||||
const OFFSET = 'offset';
|
||||
const QUANTIFIER_DISTINCT = 'DISTINCT';
|
||||
const QUANTIFIER_ALL = 'ALL';
|
||||
const JOIN_INNER = 'inner';
|
||||
const JOIN_OUTER = 'outer';
|
||||
const JOIN_LEFT = 'left';
|
||||
const JOIN_RIGHT = 'right';
|
||||
const SQL_STAR = '*';
|
||||
const ORDER_ASCENDING = 'ASC';
|
||||
const ORDER_DESCENDING = 'DESC';
|
||||
const COMBINE = 'combine';
|
||||
const COMBINE_UNION = 'union';
|
||||
const COMBINE_EXCEPT = 'except';
|
||||
const COMBINE_INTERSECT = 'intersect';
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* @var array Specifications
|
||||
*/
|
||||
protected $specifications = array(
|
||||
'statementStart' => '%1$s',
|
||||
self::SELECT => array(
|
||||
'SELECT %1$s FROM %2$s' => array(
|
||||
array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
|
||||
null
|
||||
),
|
||||
'SELECT %1$s %2$s FROM %3$s' => array(
|
||||
null,
|
||||
array(1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '),
|
||||
null
|
||||
),
|
||||
),
|
||||
self::JOINS => array(
|
||||
'%1$s' => array(
|
||||
array(3 => '%1$s JOIN %2$s ON %3$s', 'combinedby' => ' ')
|
||||
)
|
||||
),
|
||||
self::WHERE => 'WHERE %1$s',
|
||||
self::GROUP => array(
|
||||
'GROUP BY %1$s' => array(
|
||||
array(1 => '%1$s', 'combinedby' => ', ')
|
||||
)
|
||||
),
|
||||
self::HAVING => 'HAVING %1$s',
|
||||
self::ORDER => array(
|
||||
'ORDER BY %1$s' => array(
|
||||
array(1 => '%1$s', 2 => '%1$s %2$s', 'combinedby' => ', ')
|
||||
)
|
||||
),
|
||||
self::LIMIT => 'LIMIT %1$s',
|
||||
self::OFFSET => 'OFFSET %1$s',
|
||||
'statementEnd' => '%1$s',
|
||||
self::COMBINE => '%1$s ( %2$s )',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $tableReadOnly = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $prefixColumnsWithTable = true;
|
||||
|
||||
/**
|
||||
* @var string|array|TableIdentifier
|
||||
*/
|
||||
protected $table = null;
|
||||
|
||||
/**
|
||||
* @var null|string|Expression
|
||||
*/
|
||||
protected $quantifier = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $columns = array(self::SQL_STAR);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $joins = array();
|
||||
|
||||
/**
|
||||
* @var Where
|
||||
*/
|
||||
protected $where = null;
|
||||
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
protected $order = array();
|
||||
|
||||
/**
|
||||
* @var null|array
|
||||
*/
|
||||
protected $group = null;
|
||||
|
||||
/**
|
||||
* @var null|string|array
|
||||
*/
|
||||
protected $having = null;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $limit = null;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $offset = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $combine = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string|array|TableIdentifier $table
|
||||
*/
|
||||
public function __construct($table = null)
|
||||
{
|
||||
if ($table) {
|
||||
$this->from($table);
|
||||
$this->tableReadOnly = true;
|
||||
}
|
||||
|
||||
$this->where = new Where;
|
||||
$this->having = new Having;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from clause
|
||||
*
|
||||
* @param string|array|TableIdentifier $table
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Select
|
||||
*/
|
||||
public function from($table)
|
||||
{
|
||||
if ($this->tableReadOnly) {
|
||||
throw new Exception\InvalidArgumentException('Since this object was created with a table and/or schema in the constructor, it is read only.');
|
||||
}
|
||||
|
||||
if (!is_string($table) && !is_array($table) && !$table instanceof TableIdentifier) {
|
||||
throw new Exception\InvalidArgumentException('$table must be a string, array, or an instance of TableIdentifier');
|
||||
}
|
||||
|
||||
if (is_array($table) && (!is_string(key($table)) || count($table) !== 1)) {
|
||||
throw new Exception\InvalidArgumentException('from() expects $table as an array is a single element associative array');
|
||||
}
|
||||
|
||||
$this->table = $table;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|Expression $quantifier DISTINCT|ALL
|
||||
* @return Select
|
||||
*/
|
||||
public function quantifier($quantifier)
|
||||
{
|
||||
if (!is_string($quantifier) && !$quantifier instanceof Expression) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Quantifier must be one of DISTINCT, ALL, or some platform specific Expression object'
|
||||
);
|
||||
}
|
||||
$this->quantifier = $quantifier;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify columns from which to select
|
||||
*
|
||||
* Possible valid states:
|
||||
*
|
||||
* array(*)
|
||||
*
|
||||
* array(value, ...)
|
||||
* value can be strings or Expression objects
|
||||
*
|
||||
* array(string => value, ...)
|
||||
* key string will be use as alias,
|
||||
* value can be string or Expression objects
|
||||
*
|
||||
* @param array $columns
|
||||
* @param bool $prefixColumnsWithTable
|
||||
* @return Select
|
||||
*/
|
||||
public function columns(array $columns, $prefixColumnsWithTable = true)
|
||||
{
|
||||
$this->columns = $columns;
|
||||
$this->prefixColumnsWithTable = (bool) $prefixColumnsWithTable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create join clause
|
||||
*
|
||||
* @param string|array $name
|
||||
* @param string $on
|
||||
* @param string|array $columns
|
||||
* @param string $type one of the JOIN_* constants
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Select
|
||||
*/
|
||||
public function join($name, $on, $columns = self::SQL_STAR, $type = self::JOIN_INNER)
|
||||
{
|
||||
if (is_array($name) && (!is_string(key($name)) || count($name) !== 1)) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
sprintf("join() expects '%s' as an array is a single element associative array", array_shift($name))
|
||||
);
|
||||
}
|
||||
if (!is_array($columns)) {
|
||||
$columns = array($columns);
|
||||
}
|
||||
$this->joins[] = array(
|
||||
'name' => $name,
|
||||
'on' => $on,
|
||||
'columns' => $columns,
|
||||
'type' => $type
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create where clause
|
||||
*
|
||||
* @param Where|\Closure|string|array|Predicate\PredicateInterface $predicate
|
||||
* @param string $combination One of the OP_* constants from Predicate\PredicateSet
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Select
|
||||
*/
|
||||
public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
|
||||
{
|
||||
if ($predicate instanceof Where) {
|
||||
$this->where = $predicate;
|
||||
} elseif ($predicate instanceof Predicate\PredicateInterface) {
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
} elseif ($predicate instanceof \Closure) {
|
||||
$predicate($this->where);
|
||||
} else {
|
||||
if (is_string($predicate)) {
|
||||
// String $predicate should be passed as an expression
|
||||
$predicate = (strpos($predicate, Expression::PLACEHOLDER) !== false)
|
||||
? new Predicate\Expression($predicate) : new Predicate\Literal($predicate);
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
} elseif (is_array($predicate)) {
|
||||
|
||||
foreach ($predicate as $pkey => $pvalue) {
|
||||
// loop through predicates
|
||||
|
||||
if (is_string($pkey) && strpos($pkey, '?') !== false) {
|
||||
// First, process strings that the abstraction replacement character ?
|
||||
// as an Expression predicate
|
||||
$predicate = new Predicate\Expression($pkey, $pvalue);
|
||||
|
||||
} elseif (is_string($pkey)) {
|
||||
// Otherwise, if still a string, do something intelligent with the PHP type provided
|
||||
|
||||
if ($pvalue === null) {
|
||||
// map PHP null to SQL IS NULL expression
|
||||
$predicate = new Predicate\IsNull($pkey, $pvalue);
|
||||
} elseif (is_array($pvalue)) {
|
||||
// if the value is an array, assume IN() is desired
|
||||
$predicate = new Predicate\In($pkey, $pvalue);
|
||||
} elseif ($pvalue instanceof Predicate\PredicateInterface) {
|
||||
//
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Using Predicate must not use string keys'
|
||||
);
|
||||
} else {
|
||||
// otherwise assume that array('foo' => 'bar') means "foo" = 'bar'
|
||||
$predicate = new Predicate\Operator($pkey, Predicate\Operator::OP_EQ, $pvalue);
|
||||
}
|
||||
} elseif ($pvalue instanceof Predicate\PredicateInterface) {
|
||||
// Predicate type is ok
|
||||
$predicate = $pvalue;
|
||||
} else {
|
||||
// must be an array of expressions (with int-indexed array)
|
||||
$predicate = (strpos($pvalue, Expression::PLACEHOLDER) !== false)
|
||||
? new Predicate\Expression($pvalue) : new Predicate\Literal($pvalue);
|
||||
}
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function group($group)
|
||||
{
|
||||
if (is_array($group)) {
|
||||
foreach ($group as $o) {
|
||||
$this->group[] = $o;
|
||||
}
|
||||
} else {
|
||||
$this->group[] = $group;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create where clause
|
||||
*
|
||||
* @param Where|\Closure|string|array $predicate
|
||||
* @param string $combination One of the OP_* constants from Predicate\PredicateSet
|
||||
* @return Select
|
||||
*/
|
||||
public function having($predicate, $combination = Predicate\PredicateSet::OP_AND)
|
||||
{
|
||||
if ($predicate instanceof Having) {
|
||||
$this->having = $predicate;
|
||||
} elseif ($predicate instanceof \Closure) {
|
||||
$predicate($this->having);
|
||||
} else {
|
||||
if (is_string($predicate)) {
|
||||
$predicate = new Predicate\Expression($predicate);
|
||||
$this->having->addPredicate($predicate, $combination);
|
||||
} elseif (is_array($predicate)) {
|
||||
foreach ($predicate as $pkey => $pvalue) {
|
||||
if (is_string($pkey) && strpos($pkey, '?') !== false) {
|
||||
$predicate = new Predicate\Expression($pkey, $pvalue);
|
||||
} elseif (is_string($pkey)) {
|
||||
$predicate = new Predicate\Operator($pkey, Predicate\Operator::OP_EQ, $pvalue);
|
||||
} else {
|
||||
$predicate = new Predicate\Expression($pvalue);
|
||||
}
|
||||
$this->having->addPredicate($predicate, $combination);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $order
|
||||
* @return Select
|
||||
*/
|
||||
public function order($order)
|
||||
{
|
||||
if (is_string($order)) {
|
||||
if (strpos($order, ',') !== false) {
|
||||
$order = preg_split('#,\s+#', $order);
|
||||
} else {
|
||||
$order = (array) $order;
|
||||
}
|
||||
} elseif (!is_array($order)) {
|
||||
$order = array($order);
|
||||
}
|
||||
foreach ($order as $k => $v) {
|
||||
if (is_string($k)) {
|
||||
$this->order[$k] = $v;
|
||||
} else {
|
||||
$this->order[] = $v;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
* @return Select
|
||||
*/
|
||||
public function limit($limit)
|
||||
{
|
||||
if (!is_numeric($limit)) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'%s expects parameter to be numeric, "%s" given',
|
||||
__METHOD__,
|
||||
(is_object($limit) ? get_class($limit) : gettype($limit))
|
||||
));
|
||||
}
|
||||
|
||||
$this->limit = $limit;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @return Select
|
||||
*/
|
||||
public function offset($offset)
|
||||
{
|
||||
if (!is_numeric($offset)) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'%s expects parameter to be numeric, "%s" given',
|
||||
__METHOD__,
|
||||
(is_object($offset) ? get_class($offset) : gettype($offset))
|
||||
));
|
||||
}
|
||||
|
||||
$this->offset = $offset;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Select $select
|
||||
* @param string $type
|
||||
* @param string $modifier
|
||||
* @return Select
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
public function combine(Select $select, $type = self::COMBINE_UNION, $modifier = '')
|
||||
{
|
||||
if ($this->combine !== array()) {
|
||||
throw new Exception\InvalidArgumentException('This Select object is already combined and cannot be combined with multiple Selects objects');
|
||||
}
|
||||
$this->combine = array(
|
||||
'select' => $select,
|
||||
'type' => $type,
|
||||
'modifier' => $modifier
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $part
|
||||
* @return Select
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
public function reset($part)
|
||||
{
|
||||
switch ($part) {
|
||||
case self::TABLE:
|
||||
if ($this->tableReadOnly) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Since this object was created with a table and/or schema in the constructor, it is read only.'
|
||||
);
|
||||
}
|
||||
$this->table = null;
|
||||
break;
|
||||
case self::QUANTIFIER:
|
||||
$this->quantifier = null;
|
||||
break;
|
||||
case self::COLUMNS:
|
||||
$this->columns = array();
|
||||
break;
|
||||
case self::JOINS:
|
||||
$this->joins = array();
|
||||
break;
|
||||
case self::WHERE:
|
||||
$this->where = new Where;
|
||||
break;
|
||||
case self::GROUP:
|
||||
$this->group = null;
|
||||
break;
|
||||
case self::HAVING:
|
||||
$this->having = new Having;
|
||||
break;
|
||||
case self::LIMIT:
|
||||
$this->limit = null;
|
||||
break;
|
||||
case self::OFFSET:
|
||||
$this->offset = null;
|
||||
break;
|
||||
case self::ORDER:
|
||||
$this->order = null;
|
||||
break;
|
||||
case self::COMBINE:
|
||||
$this->combine = array();
|
||||
break;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSpecification($index, $specification)
|
||||
{
|
||||
if (!method_exists($this, 'process' . $index)) {
|
||||
throw new Exception\InvalidArgumentException('Not a valid specification name.');
|
||||
}
|
||||
$this->specifications[$index] = $specification;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRawState($key = null)
|
||||
{
|
||||
$rawState = array(
|
||||
self::TABLE => $this->table,
|
||||
self::QUANTIFIER => $this->quantifier,
|
||||
self::COLUMNS => $this->columns,
|
||||
self::JOINS => $this->joins,
|
||||
self::WHERE => $this->where,
|
||||
self::ORDER => $this->order,
|
||||
self::GROUP => $this->group,
|
||||
self::HAVING => $this->having,
|
||||
self::LIMIT => $this->limit,
|
||||
self::OFFSET => $this->offset,
|
||||
self::COMBINE => $this->combine
|
||||
);
|
||||
return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare statement
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
* @return void
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
// ensure statement has a ParameterContainer
|
||||
$parameterContainer = $statementContainer->getParameterContainer();
|
||||
if (!$parameterContainer instanceof ParameterContainer) {
|
||||
$parameterContainer = new ParameterContainer();
|
||||
$statementContainer->setParameterContainer($parameterContainer);
|
||||
}
|
||||
|
||||
$sqls = array();
|
||||
$parameters = array();
|
||||
$platform = $adapter->getPlatform();
|
||||
$driver = $adapter->getDriver();
|
||||
|
||||
foreach ($this->specifications as $name => $specification) {
|
||||
$parameters[$name] = $this->{'process' . $name}($platform, $driver, $parameterContainer, $sqls, $parameters);
|
||||
if ($specification && is_array($parameters[$name])) {
|
||||
$sqls[$name] = $this->createSqlFromSpecificationAndParameters($specification, $parameters[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = implode(' ', $sqls);
|
||||
|
||||
$statementContainer->setSql($sql);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL string for statement
|
||||
*
|
||||
* @param null|PlatformInterface $adapterPlatform If null, defaults to Sql92
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
// get platform, or create default
|
||||
$adapterPlatform = ($adapterPlatform) ?: new AdapterSql92Platform;
|
||||
|
||||
$sqls = array();
|
||||
$parameters = array();
|
||||
|
||||
foreach ($this->specifications as $name => $specification) {
|
||||
$parameters[$name] = $this->{'process' . $name}($adapterPlatform, null, null, $sqls, $parameters);
|
||||
if ($specification && is_array($parameters[$name])) {
|
||||
$sqls[$name] = $this->createSqlFromSpecificationAndParameters($specification, $parameters[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = implode(' ', $sqls);
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the table is read only or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTableReadOnly()
|
||||
{
|
||||
return $this->tableReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render table with alias in from/join parts
|
||||
*
|
||||
* @todo move TableIdentifier concatination here
|
||||
* @param string $table
|
||||
* @param string $alias
|
||||
* @return string
|
||||
*/
|
||||
protected function renderTable($table, $alias = null)
|
||||
{
|
||||
$sql = $table;
|
||||
if ($alias) {
|
||||
$sql .= ' AS ' . $alias;
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
||||
protected function processStatementStart(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->combine !== array()) {
|
||||
return array('(');
|
||||
}
|
||||
}
|
||||
|
||||
protected function processStatementEnd(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->combine !== array()) {
|
||||
return array(')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the select part
|
||||
*
|
||||
* @param PlatformInterface $platform
|
||||
* @param DriverInterface $driver
|
||||
* @param ParameterContainer $parameterContainer
|
||||
* @return null|array
|
||||
*/
|
||||
protected function processSelect(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
$expr = 1;
|
||||
|
||||
if (!$this->table) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$table = $this->table;
|
||||
$schema = $alias = null;
|
||||
|
||||
if (is_array($table)) {
|
||||
$alias = key($this->table);
|
||||
$table = current($this->table);
|
||||
}
|
||||
|
||||
// create quoted table name to use in columns processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
if ($table instanceof Select) {
|
||||
$table = '(' . $this->processSubselect($table, $platform, $driver, $parameterContainer) . ')';
|
||||
} else {
|
||||
$table = $platform->quoteIdentifier($table);
|
||||
}
|
||||
|
||||
if ($schema) {
|
||||
$table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
if ($alias) {
|
||||
$fromTable = $platform->quoteIdentifier($alias);
|
||||
$table = $this->renderTable($table, $fromTable);
|
||||
} else {
|
||||
$fromTable = $table;
|
||||
}
|
||||
|
||||
if ($this->prefixColumnsWithTable) {
|
||||
$fromTable .= $platform->getIdentifierSeparator();
|
||||
} else {
|
||||
$fromTable = '';
|
||||
}
|
||||
|
||||
// process table columns
|
||||
$columns = array();
|
||||
foreach ($this->columns as $columnIndexOrAs => $column) {
|
||||
|
||||
$columnName = '';
|
||||
if ($column === self::SQL_STAR) {
|
||||
$columns[] = array($fromTable . self::SQL_STAR);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($column instanceof Expression) {
|
||||
$columnParts = $this->processExpression(
|
||||
$column,
|
||||
$platform,
|
||||
$driver,
|
||||
$this->processInfo['paramPrefix'] . ((is_string($columnIndexOrAs)) ? $columnIndexOrAs : 'column')
|
||||
);
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($columnParts->getParameterContainer());
|
||||
}
|
||||
$columnName .= $columnParts->getSql();
|
||||
} else {
|
||||
$columnName .= $fromTable . $platform->quoteIdentifier($column);
|
||||
}
|
||||
|
||||
// process As portion
|
||||
if (is_string($columnIndexOrAs)) {
|
||||
$columnAs = $platform->quoteIdentifier($columnIndexOrAs);
|
||||
} elseif (stripos($columnName, ' as ') === false) {
|
||||
$columnAs = (is_string($column)) ? $platform->quoteIdentifier($column) : 'Expression' . $expr++;
|
||||
}
|
||||
$columns[] = (isset($columnAs)) ? array($columnName, $columnAs) : array($columnName);
|
||||
}
|
||||
|
||||
$separator = $platform->getIdentifierSeparator();
|
||||
|
||||
// process join columns
|
||||
foreach ($this->joins as $join) {
|
||||
foreach ($join['columns'] as $jKey => $jColumn) {
|
||||
$jColumns = array();
|
||||
if ($jColumn instanceof ExpressionInterface) {
|
||||
$jColumnParts = $this->processExpression(
|
||||
$jColumn,
|
||||
$platform,
|
||||
$driver,
|
||||
$this->processInfo['paramPrefix'] . ((is_string($jKey)) ? $jKey : 'column')
|
||||
);
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($jColumnParts->getParameterContainer());
|
||||
}
|
||||
$jColumns[] = $jColumnParts->getSql();
|
||||
} else {
|
||||
$name = (is_array($join['name'])) ? key($join['name']) : $name = $join['name'];
|
||||
if ($name instanceof TableIdentifier) {
|
||||
$name = $platform->quoteIdentifier($name->getSchema()) . $separator . $platform->quoteIdentifier($name->getTable());
|
||||
} else {
|
||||
$name = $platform->quoteIdentifier($name);
|
||||
}
|
||||
$jColumns[] = $name . $separator . $platform->quoteIdentifierInFragment($jColumn);
|
||||
}
|
||||
if (is_string($jKey)) {
|
||||
$jColumns[] = $platform->quoteIdentifier($jKey);
|
||||
} elseif ($jColumn !== self::SQL_STAR) {
|
||||
$jColumns[] = $platform->quoteIdentifier($jColumn);
|
||||
}
|
||||
$columns[] = $jColumns;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->quantifier) {
|
||||
if ($this->quantifier instanceof Expression) {
|
||||
$quantifierParts = $this->processExpression($this->quantifier, $platform, $driver, 'quantifier');
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($quantifierParts->getParameterContainer());
|
||||
}
|
||||
$quantifier = $quantifierParts->getSql();
|
||||
} else {
|
||||
$quantifier = $this->quantifier;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($quantifier)) {
|
||||
return array($quantifier, $columns, $table);
|
||||
} else {
|
||||
return array($columns, $table);
|
||||
}
|
||||
}
|
||||
|
||||
protected function processJoins(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if (!$this->joins) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// process joins
|
||||
$joinSpecArgArray = array();
|
||||
foreach ($this->joins as $j => $join) {
|
||||
$joinSpecArgArray[$j] = array();
|
||||
$joinName = null;
|
||||
$joinAs = null;
|
||||
|
||||
// type
|
||||
$joinSpecArgArray[$j][] = strtoupper($join['type']);
|
||||
|
||||
// table name
|
||||
if (is_array($join['name'])) {
|
||||
$joinName = current($join['name']);
|
||||
$joinAs = $platform->quoteIdentifier(key($join['name']));
|
||||
} else {
|
||||
$joinName = $join['name'];
|
||||
}
|
||||
if ($joinName instanceof TableIdentifier) {
|
||||
$joinName = $joinName->getTableAndSchema();
|
||||
$joinName = $platform->quoteIdentifier($joinName[1]) . $platform->getIdentifierSeparator() . $platform->quoteIdentifier($joinName[0]);
|
||||
} else {
|
||||
if ($joinName instanceof Select) {
|
||||
$joinName = '(' . $joinName->processSubSelect($joinName, $platform, $driver, $parameterContainer) . ')';
|
||||
} else {
|
||||
$joinName = $platform->quoteIdentifier($joinName);
|
||||
}
|
||||
}
|
||||
$joinSpecArgArray[$j][] = (isset($joinAs)) ? $joinName . ' AS ' . $joinAs : $joinName;
|
||||
|
||||
// on expression
|
||||
// note: for Expression objects, pass them to processExpression with a prefix specific to each join (used for named parameters)
|
||||
$joinSpecArgArray[$j][] = ($join['on'] instanceof ExpressionInterface)
|
||||
? $this->processExpression($join['on'], $platform, $driver, $this->processInfo['paramPrefix'] . 'join' . ($j+1) . 'part')
|
||||
: $platform->quoteIdentifierInFragment($join['on'], array('=', 'AND', 'OR', '(', ')', 'BETWEEN', '<', '>')); // on
|
||||
if ($joinSpecArgArray[$j][2] instanceof StatementContainerInterface) {
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($joinSpecArgArray[$j][2]->getParameterContainer());
|
||||
}
|
||||
$joinSpecArgArray[$j][2] = $joinSpecArgArray[$j][2]->getSql();
|
||||
}
|
||||
}
|
||||
|
||||
return array($joinSpecArgArray);
|
||||
}
|
||||
|
||||
protected function processWhere(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->where->count() == 0) {
|
||||
return null;
|
||||
}
|
||||
$whereParts = $this->processExpression($this->where, $platform, $driver, $this->processInfo['paramPrefix'] . 'where');
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($whereParts->getParameterContainer());
|
||||
}
|
||||
return array($whereParts->getSql());
|
||||
}
|
||||
|
||||
protected function processGroup(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->group === null) {
|
||||
return null;
|
||||
}
|
||||
// process table columns
|
||||
$groups = array();
|
||||
foreach ($this->group as $column) {
|
||||
$columnSql = '';
|
||||
if ($column instanceof Expression) {
|
||||
$columnParts = $this->processExpression($column, $platform, $driver, $this->processInfo['paramPrefix'] . 'group');
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($columnParts->getParameterContainer());
|
||||
}
|
||||
$columnSql .= $columnParts->getSql();
|
||||
} else {
|
||||
$columnSql .= $platform->quoteIdentifierInFragment($column);
|
||||
}
|
||||
$groups[] = $columnSql;
|
||||
}
|
||||
return array($groups);
|
||||
}
|
||||
|
||||
protected function processHaving(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->having->count() == 0) {
|
||||
return null;
|
||||
}
|
||||
$whereParts = $this->processExpression($this->having, $platform, $driver, $this->processInfo['paramPrefix'] . 'having');
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($whereParts->getParameterContainer());
|
||||
}
|
||||
return array($whereParts->getSql());
|
||||
}
|
||||
|
||||
protected function processOrder(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if (empty($this->order)) {
|
||||
return null;
|
||||
}
|
||||
$orders = array();
|
||||
foreach ($this->order as $k => $v) {
|
||||
if ($v instanceof Expression) {
|
||||
/** @var $orderParts \Zend\Db\Adapter\StatementContainer */
|
||||
$orderParts = $this->processExpression($v, $platform, $driver);
|
||||
if ($parameterContainer) {
|
||||
$parameterContainer->merge($orderParts->getParameterContainer());
|
||||
}
|
||||
$orders[] = array($orderParts->getSql());
|
||||
continue;
|
||||
}
|
||||
if (is_int($k)) {
|
||||
if (strpos($v, ' ') !== false) {
|
||||
list($k, $v) = preg_split('# #', $v, 2);
|
||||
} else {
|
||||
$k = $v;
|
||||
$v = self::ORDER_ASCENDING;
|
||||
}
|
||||
}
|
||||
if (strtoupper($v) == self::ORDER_DESCENDING) {
|
||||
$orders[] = array($platform->quoteIdentifierInFragment($k), self::ORDER_DESCENDING);
|
||||
} else {
|
||||
$orders[] = array($platform->quoteIdentifierInFragment($k), self::ORDER_ASCENDING);
|
||||
}
|
||||
}
|
||||
return array($orders);
|
||||
}
|
||||
|
||||
protected function processLimit(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->limit === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$limit = (int) $this->limit;
|
||||
|
||||
if ($driver) {
|
||||
$sql = $driver->formatParameterName('limit');
|
||||
$parameterContainer->offsetSet('limit', $limit, ParameterContainer::TYPE_INTEGER);
|
||||
} else {
|
||||
$sql = $platform->quoteValue($limit);
|
||||
}
|
||||
|
||||
return array($sql);
|
||||
}
|
||||
|
||||
protected function processOffset(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->offset === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$offset = (int) $this->offset;
|
||||
|
||||
if ($driver) {
|
||||
$parameterContainer->offsetSet('offset', $offset, ParameterContainer::TYPE_INTEGER);
|
||||
return array($driver->formatParameterName('offset'));
|
||||
}
|
||||
|
||||
return array($platform->quoteValue($offset));
|
||||
}
|
||||
|
||||
protected function processCombine(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
|
||||
{
|
||||
if ($this->combine == array()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$type = $this->combine['type'];
|
||||
if ($this->combine['modifier']) {
|
||||
$type .= ' ' . $this->combine['modifier'];
|
||||
}
|
||||
$type = strtoupper($type);
|
||||
|
||||
if ($driver) {
|
||||
$sql = $this->processSubSelect($this->combine['select'], $platform, $driver, $parameterContainer);
|
||||
return array($type, $sql);
|
||||
}
|
||||
return array(
|
||||
$type,
|
||||
$this->processSubSelect($this->combine['select'], $platform)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variable overloading
|
||||
*
|
||||
* @param string $name
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
switch (strtolower($name)) {
|
||||
case 'where':
|
||||
return $this->where;
|
||||
case 'having':
|
||||
return $this->having;
|
||||
default:
|
||||
throw new Exception\InvalidArgumentException('Not a valid magic property for this object');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __clone
|
||||
*
|
||||
* Resets the where object each time the Select is cloned.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->where = clone $this->where;
|
||||
$this->having = clone $this->having;
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
/**
|
||||
*/
|
||||
class TableIdentifier
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $schema;
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $schema
|
||||
*/
|
||||
public function __construct($table, $schema = null)
|
||||
{
|
||||
$this->table = $table;
|
||||
$this->schema = $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*/
|
||||
public function setTable($table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSchema()
|
||||
{
|
||||
return ($this->schema != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $schema
|
||||
*/
|
||||
public function setSchema($schema)
|
||||
{
|
||||
$this->schema = $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getSchema()
|
||||
{
|
||||
return $this->schema;
|
||||
}
|
||||
|
||||
public function getTableAndSchema()
|
||||
{
|
||||
return array($this->table, $this->schema);
|
||||
}
|
||||
}
|
@ -1,316 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Sql;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\Adapter\ParameterContainer;
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\Adapter\Platform\Sql92;
|
||||
use Zend\Db\Adapter\StatementContainerInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property Where $where
|
||||
*/
|
||||
class Update extends AbstractSql implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
/**@#++
|
||||
* @const
|
||||
*/
|
||||
const SPECIFICATION_UPDATE = 'update';
|
||||
const SPECIFICATION_WHERE = 'where';
|
||||
|
||||
const VALUES_MERGE = 'merge';
|
||||
const VALUES_SET = 'set';
|
||||
/**@#-**/
|
||||
|
||||
protected $specifications = array(
|
||||
self::SPECIFICATION_UPDATE => 'UPDATE %1$s SET %2$s',
|
||||
self::SPECIFICATION_WHERE => 'WHERE %1$s'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string|TableIdentifier
|
||||
*/
|
||||
protected $table = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $emptyWhereProtection = true;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $set = array();
|
||||
|
||||
/**
|
||||
* @var string|Where
|
||||
*/
|
||||
protected $where = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string|TableIdentifier $table
|
||||
*/
|
||||
public function __construct($table = null)
|
||||
{
|
||||
if ($table) {
|
||||
$this->table($table);
|
||||
}
|
||||
$this->where = new Where();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify table for statement
|
||||
*
|
||||
* @param string|TableIdentifier $table
|
||||
* @return Update
|
||||
*/
|
||||
public function table($table)
|
||||
{
|
||||
$this->table = $table;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set key/value pairs to update
|
||||
*
|
||||
* @param array $values Associative array of key values
|
||||
* @param string $flag One of the VALUES_* constants
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Update
|
||||
*/
|
||||
public function set(array $values, $flag = self::VALUES_SET)
|
||||
{
|
||||
if ($values == null) {
|
||||
throw new Exception\InvalidArgumentException('set() expects an array of values');
|
||||
}
|
||||
|
||||
if ($flag == self::VALUES_SET) {
|
||||
$this->set = array();
|
||||
}
|
||||
|
||||
foreach ($values as $k => $v) {
|
||||
if (!is_string($k)) {
|
||||
throw new Exception\InvalidArgumentException('set() expects a string for the value key');
|
||||
}
|
||||
$this->set[$k] = $v;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create where clause
|
||||
*
|
||||
* @param Where|\Closure|string|array $predicate
|
||||
* @param string $combination One of the OP_* constants from Predicate\PredicateSet
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Select
|
||||
*/
|
||||
public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
|
||||
{
|
||||
if ($predicate === null) {
|
||||
throw new Exception\InvalidArgumentException('Predicate cannot be null');
|
||||
}
|
||||
|
||||
if ($predicate instanceof Where) {
|
||||
$this->where = $predicate;
|
||||
} elseif ($predicate instanceof \Closure) {
|
||||
$predicate($this->where);
|
||||
} else {
|
||||
if (is_string($predicate)) {
|
||||
// String $predicate should be passed as an expression
|
||||
$predicate = new Predicate\Expression($predicate);
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
} elseif (is_array($predicate)) {
|
||||
|
||||
foreach ($predicate as $pkey => $pvalue) {
|
||||
// loop through predicates
|
||||
|
||||
if (is_string($pkey) && strpos($pkey, '?') !== false) {
|
||||
// First, process strings that the abstraction replacement character ?
|
||||
// as an Expression predicate
|
||||
$predicate = new Predicate\Expression($pkey, $pvalue);
|
||||
|
||||
} elseif (is_string($pkey)) {
|
||||
// Otherwise, if still a string, do something intelligent with the PHP type provided
|
||||
|
||||
if ($pvalue === null) {
|
||||
// map PHP null to SQL IS NULL expression
|
||||
$predicate = new Predicate\IsNull($pkey, $pvalue);
|
||||
} elseif (is_array($pvalue)) {
|
||||
// if the value is an array, assume IN() is desired
|
||||
$predicate = new Predicate\In($pkey, $pvalue);
|
||||
} else {
|
||||
// otherwise assume that array('foo' => 'bar') means "foo" = 'bar'
|
||||
$predicate = new Predicate\Operator($pkey, Predicate\Operator::OP_EQ, $pvalue);
|
||||
}
|
||||
} elseif ($pvalue instanceof Predicate\PredicateInterface) {
|
||||
// Predicate type is ok
|
||||
$predicate = $pvalue;
|
||||
} else {
|
||||
// must be an array of expressions (with int-indexed array)
|
||||
$predicate = new Predicate\Expression($pvalue);
|
||||
}
|
||||
$this->where->addPredicate($predicate, $combination);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRawState($key = null)
|
||||
{
|
||||
$rawState = array(
|
||||
'emptyWhereProtection' => $this->emptyWhereProtection,
|
||||
'table' => $this->table,
|
||||
'set' => $this->set,
|
||||
'where' => $this->where
|
||||
);
|
||||
return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare statement
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
* @param StatementContainerInterface $statementContainer
|
||||
* @return void
|
||||
*/
|
||||
public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
|
||||
{
|
||||
$driver = $adapter->getDriver();
|
||||
$platform = $adapter->getPlatform();
|
||||
$parameterContainer = $statementContainer->getParameterContainer();
|
||||
|
||||
if (!$parameterContainer instanceof ParameterContainer) {
|
||||
$parameterContainer = new ParameterContainer();
|
||||
$statementContainer->setParameterContainer($parameterContainer);
|
||||
}
|
||||
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in update processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $platform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$set = $this->set;
|
||||
if (is_array($set)) {
|
||||
$setSql = array();
|
||||
foreach ($set as $column => $value) {
|
||||
if ($value instanceof Expression) {
|
||||
$exprData = $this->processExpression($value, $platform, $driver);
|
||||
$setSql[] = $platform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
|
||||
$parameterContainer->merge($exprData->getParameterContainer());
|
||||
} else {
|
||||
$setSql[] = $platform->quoteIdentifier($column) . ' = ' . $driver->formatParameterName($column);
|
||||
$parameterContainer->offsetSet($column, $value);
|
||||
}
|
||||
}
|
||||
$set = implode(', ', $setSql);
|
||||
}
|
||||
|
||||
$sql = sprintf($this->specifications[self::SPECIFICATION_UPDATE], $table, $set);
|
||||
|
||||
// process where
|
||||
if ($this->where->count() > 0) {
|
||||
$whereParts = $this->processExpression($this->where, $platform, $driver, 'where');
|
||||
$parameterContainer->merge($whereParts->getParameterContainer());
|
||||
$sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql());
|
||||
}
|
||||
$statementContainer->setSql($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL string for statement
|
||||
*
|
||||
* @param null|PlatformInterface $adapterPlatform If null, defaults to Sql92
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null)
|
||||
{
|
||||
$adapterPlatform = ($adapterPlatform) ?: new Sql92;
|
||||
$table = $this->table;
|
||||
$schema = null;
|
||||
|
||||
// create quoted table name to use in update processing
|
||||
if ($table instanceof TableIdentifier) {
|
||||
list($table, $schema) = $table->getTableAndSchema();
|
||||
}
|
||||
|
||||
$table = $adapterPlatform->quoteIdentifier($table);
|
||||
|
||||
if ($schema) {
|
||||
$table = $adapterPlatform->quoteIdentifier($schema) . $adapterPlatform->getIdentifierSeparator() . $table;
|
||||
}
|
||||
|
||||
$set = $this->set;
|
||||
if (is_array($set)) {
|
||||
$setSql = array();
|
||||
foreach ($set as $column => $value) {
|
||||
if ($value instanceof Expression) {
|
||||
$exprData = $this->processExpression($value, $adapterPlatform);
|
||||
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
|
||||
} elseif ($value === null) {
|
||||
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = NULL';
|
||||
} else {
|
||||
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $adapterPlatform->quoteValue($value);
|
||||
}
|
||||
}
|
||||
$set = implode(', ', $setSql);
|
||||
}
|
||||
|
||||
$sql = sprintf($this->specifications[self::SPECIFICATION_UPDATE], $table, $set);
|
||||
if ($this->where->count() > 0) {
|
||||
$whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where');
|
||||
$sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql());
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variable overloading
|
||||
*
|
||||
* Proxies to "where" only
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
switch (strtolower($name)) {
|
||||
case 'where':
|
||||
return $this->where;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __clone
|
||||
*
|
||||
* Resets the where object each time the Update is cloned.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->where = clone $this->where;
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "zendframework/zend-db",
|
||||
"description": " ",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": [
|
||||
"zf2",
|
||||
"db"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Zend\\Db\\": ""
|
||||
}
|
||||
},
|
||||
"target-dir": "Zend/Db",
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-stdlib": "self.version"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev",
|
||||
"dev-develop": "2.3-dev"
|
||||
}
|
||||
}
|
||||
}
|
73
bundled-libs/zendframework/zend-db/composer.json
Normal file
73
bundled-libs/zendframework/zend-db/composer.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "zendframework/zend-db",
|
||||
"description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": [
|
||||
"zf",
|
||||
"zendframework",
|
||||
"db"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://docs.zendframework.com/zend-db/",
|
||||
"issues": "https://github.com/zendframework/zend-db/issues",
|
||||
"source": "https://github.com/zendframework/zend-db",
|
||||
"rss": "https://github.com/zendframework/zend-db/releases.atom",
|
||||
"slack": "https://zendframework-slack.herokuapp.com",
|
||||
"forum": "https://discourse.zendframework.com/c/questions/components"
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-stdlib": "^2.7 || ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7.25 || ^6.4.4",
|
||||
"zendframework/zend-coding-standard": "~1.0.0",
|
||||
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
|
||||
"zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0",
|
||||
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-eventmanager": "Zend\\EventManager component",
|
||||
"zendframework/zend-hydrator": "Zend\\Hydrator component for using HydratingResultSets",
|
||||
"zendframework/zend-servicemanager": "Zend\\ServiceManager component"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\Db\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"files": [
|
||||
"test/autoload.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"ZendTest\\Db\\": "test/unit",
|
||||
"ZendIntegrationTest\\Db\\": "test/integration"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.9-dev",
|
||||
"dev-develop": "2.10-dev"
|
||||
},
|
||||
"zf": {
|
||||
"component": "Zend\\Db",
|
||||
"config-provider": "Zend\\Db\\ConfigProvider"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"check": [
|
||||
"@cs-check",
|
||||
"@test"
|
||||
],
|
||||
"cs-check": "phpcs",
|
||||
"cs-fix": "phpcbf",
|
||||
"test": "phpunit --colors=always --testsuite \"unit test\"",
|
||||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
|
||||
"test-integration" : "phpunit --colors=always --testsuite \"integration test\"",
|
||||
"upload-coverage": "coveralls -v"
|
||||
}
|
||||
}
|
43
bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md
Normal file
43
bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
This project adheres to [The Code Manifesto](http://codemanifesto.com)
|
||||
as its guidelines for contributor interactions.
|
||||
|
||||
## The Code Manifesto
|
||||
|
||||
We want to work in an ecosystem that empowers developers to reach their
|
||||
potential — one that encourages growth and effective collaboration. A space that
|
||||
is safe for all.
|
||||
|
||||
A space such as this benefits everyone that participates in it. It encourages
|
||||
new developers to enter our field. It is through discussion and collaboration
|
||||
that we grow, and through growth that we improve.
|
||||
|
||||
In the effort to create such a place, we hold to these values:
|
||||
|
||||
1. **Discrimination limits us.** This includes discrimination on the basis of
|
||||
race, gender, sexual orientation, gender identity, age, nationality, technology
|
||||
and any other arbitrary exclusion of a group of people.
|
||||
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
|
||||
levels. Remember that, and if brought to your attention, heed it.
|
||||
3. **We are our biggest assets.** None of us were born masters of our trade.
|
||||
Each of us has been helped along the way. Return that favor, when and where
|
||||
you can.
|
||||
4. **We are resources for the future.** As an extension of #3, share what you
|
||||
know. Make yourself a resource to help those that come after you.
|
||||
5. **Respect defines us.** Treat others as you wish to be treated. Make your
|
||||
discussions, criticisms and debates from a position of respectfulness. Ask
|
||||
yourself, is it true? Is it necessary? Is it constructive? Anything less is
|
||||
unacceptable.
|
||||
6. **Reactions require grace.** Angry responses are valid, but abusive language
|
||||
and vindictive actions are toxic. When something happens that offends you,
|
||||
handle it assertively, but be respectful. Escalate reasonably, and try to
|
||||
allow the offender an opportunity to explain themselves, and possibly correct
|
||||
the issue.
|
||||
7. **Opinions are just that: opinions.** Each and every one of us, due to our
|
||||
background and upbringing, have varying opinions. The fact of the matter, is
|
||||
that is perfectly acceptable. Remember this: if you respect your own
|
||||
opinions, you should respect the opinions of others.
|
||||
8. **To err is human.** You might not intend it, but mistakes do happen and
|
||||
contribute to build experience. Tolerate honest mistakes, and don't hesitate
|
||||
to apologize if you make one yourself.
|
189
bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md
Normal file
189
bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md
Normal file
@ -0,0 +1,189 @@
|
||||
# CONTRIBUTING
|
||||
|
||||
## RESOURCES
|
||||
|
||||
If you wish to contribute to this project, please be sure to
|
||||
read/subscribe to the following resources:
|
||||
|
||||
- [Coding Standards](https://github.com/zendframework/zend-coding-standard)
|
||||
- [Forums](https://discourse.zendframework.com/c/contributors)
|
||||
- [Slack](https://zendframework-slack.herokuapp.com)
|
||||
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
||||
|
||||
If you are working on new features or refactoring
|
||||
[create a proposal](https://github.com/zendframework/zend-db/issues/new).
|
||||
|
||||
## RUNNING TESTS
|
||||
|
||||
To run tests:
|
||||
|
||||
- Clone the repository:
|
||||
|
||||
```console
|
||||
$ git clone git://github.com/zendframework/zend-db.git
|
||||
$ cd zend-db
|
||||
```
|
||||
|
||||
- Install dependencies via composer:
|
||||
|
||||
```console
|
||||
$ composer install
|
||||
```
|
||||
|
||||
If you don't have `composer` installed, please download it from https://getcomposer.org/download/
|
||||
|
||||
- Run the tests using the "test" command shipped in the `composer.json`:
|
||||
|
||||
```console
|
||||
$ composer test
|
||||
```
|
||||
|
||||
You can turn on conditional tests with the `phpunit.xml` file.
|
||||
To do so:
|
||||
|
||||
- Copy `phpunit.xml.dist` file to `phpunit.xml`
|
||||
- Edit `phpunit.xml` to enable any specific functionality you
|
||||
want to test, as well as to provide test values to utilize.
|
||||
|
||||
## Running Coding Standards Checks
|
||||
|
||||
First, ensure you've installed dependencies via composer, per the previous
|
||||
section on running tests.
|
||||
|
||||
To run CS checks only:
|
||||
|
||||
```console
|
||||
$ composer cs-check
|
||||
```
|
||||
|
||||
To attempt to automatically fix common CS issues:
|
||||
|
||||
```console
|
||||
$ composer cs-fix
|
||||
```
|
||||
|
||||
If the above fixes any CS issues, please re-run the tests to ensure
|
||||
they pass, and make sure you add and commit the changes after verification.
|
||||
|
||||
## Recommended Workflow for Contributions
|
||||
|
||||
Your first step is to establish a public repository from which we can
|
||||
pull your work into the master repository. We recommend using
|
||||
[GitHub](https://github.com), as that is where the component is already hosted.
|
||||
|
||||
1. Setup a [GitHub account](https://github.com/), if you haven't yet
|
||||
2. Fork the repository (https://github.com/zendframework/zend-db)
|
||||
3. Clone the canonical repository locally and enter it.
|
||||
|
||||
```console
|
||||
$ git clone git://github.com/zendframework/zend-db.git
|
||||
$ cd zend-db
|
||||
```
|
||||
|
||||
4. Add a remote to your fork; substitute your GitHub username in the command
|
||||
below.
|
||||
|
||||
```console
|
||||
$ git remote add {username} git@github.com:{username}/zend-db.git
|
||||
$ git fetch {username}
|
||||
```
|
||||
|
||||
### Keeping Up-to-Date
|
||||
|
||||
Periodically, you should update your fork or personal repository to
|
||||
match the canonical ZF repository. Assuming you have setup your local repository
|
||||
per the instructions above, you can do the following:
|
||||
|
||||
|
||||
```console
|
||||
$ git checkout master
|
||||
$ git fetch origin
|
||||
$ git rebase origin/master
|
||||
# OPTIONALLY, to keep your remote up-to-date -
|
||||
$ git push {username} master:master
|
||||
```
|
||||
|
||||
If you're tracking other branches -- for example, the "develop" branch, where
|
||||
new feature development occurs -- you'll want to do the same operations for that
|
||||
branch; simply substitute "develop" for "master".
|
||||
|
||||
### Working on a patch
|
||||
|
||||
We recommend you do each new feature or bugfix in a new branch. This simplifies
|
||||
the task of code review as well as the task of merging your changes into the
|
||||
canonical repository.
|
||||
|
||||
A typical workflow will then consist of the following:
|
||||
|
||||
1. Create a new local branch based off either your master or develop branch.
|
||||
2. Switch to your new local branch. (This step can be combined with the
|
||||
previous step with the use of `git checkout -b`.)
|
||||
3. Do some work, commit, repeat as necessary.
|
||||
4. Push the local branch to your remote repository.
|
||||
5. Send a pull request.
|
||||
|
||||
The mechanics of this process are actually quite trivial. Below, we will
|
||||
create a branch for fixing an issue in the tracker.
|
||||
|
||||
```console
|
||||
$ git checkout -b hotfix/9295
|
||||
Switched to a new branch 'hotfix/9295'
|
||||
```
|
||||
|
||||
... do some work ...
|
||||
|
||||
|
||||
```console
|
||||
$ git commit
|
||||
```
|
||||
|
||||
... write your log message ...
|
||||
|
||||
|
||||
```console
|
||||
$ git push {username} hotfix/9295:hotfix/9295
|
||||
Counting objects: 38, done.
|
||||
Delta compression using up to 2 threads.
|
||||
Compression objects: 100% (18/18), done.
|
||||
Writing objects: 100% (20/20), 8.19KiB, done.
|
||||
Total 20 (delta 12), reused 0 (delta 0)
|
||||
To ssh://git@github.com/{username}/zend-db.git
|
||||
b5583aa..4f51698 HEAD -> master
|
||||
```
|
||||
|
||||
To send a pull request, you have two options.
|
||||
|
||||
If using GitHub, you can do the pull request from there. Navigate to
|
||||
your repository, select the branch you just created, and then select the
|
||||
"Pull Request" button in the upper right. Select the user/organization
|
||||
"zendframework" (or whatever the upstream organization is) as the recipient.
|
||||
|
||||
#### What branch to issue the pull request against?
|
||||
|
||||
Which branch should you issue a pull request against?
|
||||
|
||||
- For fixes against the stable release, issue the pull request against the
|
||||
"master" branch.
|
||||
- For new features, or fixes that introduce new elements to the public API (such
|
||||
as new public methods or properties), issue the pull request against the
|
||||
"develop" branch.
|
||||
|
||||
### Branch Cleanup
|
||||
|
||||
As you might imagine, if you are a frequent contributor, you'll start to
|
||||
get a ton of branches both locally and on your remote.
|
||||
|
||||
Once you know that your changes have been accepted to the master
|
||||
repository, we suggest doing some cleanup of these branches.
|
||||
|
||||
- Local branch cleanup
|
||||
|
||||
```console
|
||||
$ git branch -d <branchname>
|
||||
```
|
||||
|
||||
- Remote branch removal
|
||||
|
||||
```console
|
||||
$ git push {username} :<branchname>
|
||||
```
|
19
bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md
Normal file
19
bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md
Normal file
@ -0,0 +1,19 @@
|
||||
- [ ] I was not able to find an [open](https://github.com/zendframework/zend-db/issues?q=is%3Aopen) or [closed](https://github.com/zendframework/zend-db/issues?q=is%3Aclosed) issue matching what I'm seeing.
|
||||
- [ ] This is not a question. (Questions should be asked on [slack](https://zendframework.slack.com/) ([Signup for Slack here](https://zendframework-slack.herokuapp.com/)) or our [forums](https://discourse.zendframework.com/).)
|
||||
|
||||
Provide a narrative description of what you are trying to accomplish.
|
||||
|
||||
### Code to reproduce the issue
|
||||
|
||||
<!-- Please provide the minimum code necessary to recreate the issue -->
|
||||
|
||||
```php
|
||||
```
|
||||
|
||||
### Expected results
|
||||
|
||||
<!-- What do you think should have happened? -->
|
||||
|
||||
### Actual results
|
||||
|
||||
<!-- What did you actually observe? -->
|
@ -0,0 +1,25 @@
|
||||
Provide a narrative description of what you are trying to accomplish:
|
||||
|
||||
- [ ] Are you fixing a bug?
|
||||
- [ ] Detail how the bug is invoked currently.
|
||||
- [ ] Detail the original, incorrect behavior.
|
||||
- [ ] Detail the new, expected behavior.
|
||||
- [ ] Base your feature on the `master` branch, and submit against that branch.
|
||||
- [ ] Add a regression test that demonstrates the bug, and proves the fix.
|
||||
- [ ] Add a `CHANGELOG.md` entry for the fix.
|
||||
|
||||
- [ ] Are you creating a new feature?
|
||||
- [ ] Why is the new feature needed? What purpose does it serve?
|
||||
- [ ] How will users use the new feature?
|
||||
- [ ] Base your feature on the `develop` branch, and submit against that branch.
|
||||
- [ ] Add only one feature per pull request; split multiple features over multiple pull requests
|
||||
- [ ] Add tests for the new feature.
|
||||
- [ ] Add documentation for the new feature.
|
||||
- [ ] Add a `CHANGELOG.md` entry for the new feature.
|
||||
|
||||
- [ ] Is this related to quality assurance?
|
||||
<!-- Detail why the changes are necessary -->
|
||||
|
||||
- [ ] Is this related to documentation?
|
||||
<!-- Is it a typographical and/or grammatical fix? -->
|
||||
<!-- Is it new documentation? -->
|
25
bundled-libs/zendframework/zend-db/docs/SUPPORT.md
Normal file
25
bundled-libs/zendframework/zend-db/docs/SUPPORT.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Getting Support
|
||||
|
||||
Zend Framework offers three support channels:
|
||||
|
||||
- For real-time questions, use our
|
||||
[Slack](https://zendframework-slack.herokuapp.com)
|
||||
- For detailed questions (e.g., those requiring examples) use our
|
||||
[forums](https://discourse.zendframework.com/c/questions/components)
|
||||
- To report issues, use this repository's
|
||||
[issue tracker](https://github.com/zendframework/zend-db/issues/new)
|
||||
|
||||
**DO NOT** use the issue tracker to ask questions; use Slack or the forums for
|
||||
that. Questions posed to the issue tracker will be closed.
|
||||
|
||||
When reporting an issue, please include the following details:
|
||||
|
||||
- A narrative description of what you are trying to accomplish.
|
||||
- The minimum code necessary to reproduce the issue.
|
||||
- The expected results of exercising that code.
|
||||
- The actual results received.
|
||||
|
||||
We may ask for additional details: what version of the library you are using,
|
||||
and what PHP version was used to reproduce the issue.
|
||||
|
||||
You may also submit a failing test case as a pull request.
|
498
bundled-libs/zendframework/zend-db/docs/book/adapter.md
Normal file
498
bundled-libs/zendframework/zend-db/docs/book/adapter.md
Normal file
@ -0,0 +1,498 @@
|
||||
# Adapters
|
||||
|
||||
`Zend\Db\Adapter\Adapter` is the central object of the zend-db component. It is
|
||||
responsible for adapting any code written in or for zend-db to the targeted PHP
|
||||
extensions and vendor databases. In doing this, it creates an abstraction layer
|
||||
for the PHP extensions in the `Driver` subnamespace of `Zend\Db\Adapter`. It
|
||||
also creates a lightweight "Platform" abstraction layer, for the various
|
||||
idiosyncrasies that each vendor-specific platform might have in its SQL/RDBMS
|
||||
implementation, separate from the driver implementations.
|
||||
|
||||
## Creating an adapter using configuration
|
||||
|
||||
Create an adapter by instantiating the `Zend\Db\Adapter\Adapter` class. The most
|
||||
common use case, while not the most explicit, is to pass an array of
|
||||
configuration to the `Adapter`:
|
||||
|
||||
```php
|
||||
use Zend\Db\Adapter\Adapter;
|
||||
|
||||
$adapter = new Adapter($configArray);
|
||||
```
|
||||
|
||||
This driver array is an abstraction for the extension level required parameters.
|
||||
Here is a table for the key-value pairs that should be in configuration array.
|
||||
|
||||
Key | Is Required? | Value
|
||||
---------- | ---------------------- | -----
|
||||
`driver` | required | `Mysqli`, `Sqlsrv`, `Pdo_Sqlite`, `Pdo_Mysql`, `Pdo`(= Other PDO Driver)
|
||||
`database` | generally required | the name of the database (schema)
|
||||
`username` | generally required | the connection username
|
||||
`password` | generally required | the connection password
|
||||
`hostname` | not generally required | the IP address or hostname to connect to
|
||||
`port` | not generally required | the port to connect to (if applicable)
|
||||
`charset` | not generally required | the character set to use
|
||||
|
||||
> ### Options are adapter-dependent
|
||||
>
|
||||
> Other names will work as well. Effectively, if the PHP manual uses a
|
||||
> particular naming, this naming will be supported by the associated driver. For
|
||||
> example, `dbname` in most cases will also work for 'database'. Another
|
||||
> example is that in the case of `Sqlsrv`, `UID` will work in place of
|
||||
> `username`. Which format you choose is up to you, but the above table
|
||||
> represents the official abstraction names.
|
||||
|
||||
For example, a MySQL connection using ext/mysqli:
|
||||
|
||||
```php
|
||||
$adapter = new Zend\Db\Adapter\Adapter([
|
||||
'driver' => 'Mysqli',
|
||||
'database' => 'zend_db_example',
|
||||
'username' => 'developer',
|
||||
'password' => 'developer-password',
|
||||
]);
|
||||
```
|
||||
|
||||
Another example, of a Sqlite connection via PDO:
|
||||
|
||||
```php
|
||||
$adapter = new Zend\Db\Adapter\Adapter([
|
||||
'driver' => 'Pdo_Sqlite',
|
||||
'database' => 'path/to/sqlite.db',
|
||||
]);
|
||||
```
|
||||
|
||||
Another example, of an IBM i DB2 connection via IbmDb2:
|
||||
|
||||
```php
|
||||
$adapter = new Zend\Db\Adapter\Adapter([
|
||||
'database' => '*LOCAL', // or name from WRKRDBDIRE, may be serial #
|
||||
'driver' => 'IbmDb2',
|
||||
'driver_options' => [
|
||||
'autocommit' => DB2_AUTOCOMMIT_ON,
|
||||
'i5_naming' => DB2_I5_NAMING_ON,
|
||||
'i5_libl' => 'SCHEMA1 SCHEMA2 SCHEMA3',
|
||||
],
|
||||
'username' => '__USER__',
|
||||
'password' => '__PASS__',
|
||||
// 'persistent' => true,
|
||||
'platform' => 'IbmDb2',
|
||||
'platform_options' => ['quote_identifiers' => false],
|
||||
]);
|
||||
```
|
||||
|
||||
Another example, of an IBM i DB2 connection via PDO:
|
||||
|
||||
```php
|
||||
$adapter = new Zend\Db\Adapter\Adapter([
|
||||
'dsn' => 'ibm:DB_NAME', // DB_NAME is from WRKRDBDIRE, may be serial #
|
||||
'driver' => 'pdo',
|
||||
'driver_options' => [
|
||||
// PDO::ATTR_PERSISTENT => true,
|
||||
PDO::ATTR_AUTOCOMMIT => true,
|
||||
PDO::I5_ATTR_DBC_SYS_NAMING => true,
|
||||
PDO::I5_ATTR_DBC_CURLIB => '',
|
||||
PDO::I5_ATTR_DBC_LIBL => 'SCHEMA1 SCHEMA2 SCHEMA3',
|
||||
],
|
||||
'username' => '__USER__',
|
||||
'password' => '__PASS__',
|
||||
'platform' => 'IbmDb2',
|
||||
'platform_options' => ['quote_identifiers' => false],
|
||||
]);
|
||||
```
|
||||
|
||||
It is important to know that by using this style of adapter creation, the
|
||||
`Adapter` will attempt to create any dependencies that were not explicitly
|
||||
provided. A `Driver` object will be created from the configuration array
|
||||
provided in the constructor. A `Platform` object will be created based off the
|
||||
type of `Driver` class that was instantiated. And lastly, a default `ResultSet`
|
||||
object is created and utilized. Any of these objects can be injected, to do
|
||||
this, see the next section.
|
||||
|
||||
The list of officially supported drivers:
|
||||
|
||||
- `IbmDb2`: The ext/ibm_db2 driver
|
||||
- `Mysqli`: The ext/mysqli driver
|
||||
- `Oci8`: The ext/oci8 driver
|
||||
- `Pgsql`: The ext/pgsql driver
|
||||
- `Sqlsrv`: The ext/sqlsrv driver (from Microsoft)
|
||||
- `Pdo_Mysql`: MySQL via the PDO extension
|
||||
- `Pdo_Sqlite`: SQLite via the PDO extension
|
||||
- `Pdo_Pgsql`: PostgreSQL via the PDO extension
|
||||
|
||||
## Creating an adapter using dependency injection
|
||||
|
||||
The more expressive and explicit way of creating an adapter is by injecting all
|
||||
your dependencies up front. `Zend\Db\Adapter\Adapter` uses constructor
|
||||
injection, and all required dependencies are injected through the constructor,
|
||||
which has the following signature (in pseudo-code):
|
||||
|
||||
```php
|
||||
use Zend\Db\Adapter\Platform\PlatformInterface;
|
||||
use Zend\Db\ResultSet\ResultSet;
|
||||
|
||||
class Zend\Db\Adapter\Adapter
|
||||
{
|
||||
public function __construct(
|
||||
$driver,
|
||||
PlatformInterface $platform = null,
|
||||
ResultSet $queryResultSetPrototype = null
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
What can be injected:
|
||||
|
||||
- `$driver`: an array of connection parameters (see above) or an instance of
|
||||
`Zend\Db\Adapter\Driver\DriverInterface`.
|
||||
- `$platform` (optional): an instance of `Zend\Db\Platform\PlatformInterface`;
|
||||
the default will be created based off the driver implementation.
|
||||
- `$queryResultSetPrototype` (optional): an instance of
|
||||
`Zend\Db\ResultSet\ResultSet`; to understand this object's role, see the
|
||||
section below on querying.
|
||||
|
||||
## Query Preparation
|
||||
|
||||
By default, `Zend\Db\Adapter\Adapter::query()` prefers that you use
|
||||
"preparation" as a means for processing SQL statements. This generally means
|
||||
that you will supply a SQL statement containing placeholders for the values, and
|
||||
separately provide substitutions for those placeholders. As an example:
|
||||
|
||||
```php
|
||||
$adapter->query('SELECT * FROM `artist` WHERE `id` = ?', [5]);
|
||||
```
|
||||
|
||||
The above example will go through the following steps:
|
||||
|
||||
- create a new `Statement` object.
|
||||
- prepare the array `[5]` into a `ParameterContainer` if necessary.
|
||||
- inject the `ParameterContainer` into the `Statement` object.
|
||||
- execute the `Statement` object, producing a `Result` object.
|
||||
- check the `Result` object to check if the supplied SQL was a result set
|
||||
producing statement:
|
||||
- if the query produced a result set, clone the `ResultSet` prototype,
|
||||
inject the `Result` as its datasource, and return the new `ResultSet`
|
||||
instance.
|
||||
- otherwise, return the `Result`.
|
||||
|
||||
## Query Execution
|
||||
|
||||
In some cases, you have to execute statements directly without preparation. One
|
||||
possible reason for doing so would be to execute a DDL statement, as most
|
||||
extensions and RDBMS systems are incapable of preparing such statements.
|
||||
|
||||
To execute a query without the preparation step, you will need to pass a flag as
|
||||
the second argument indicating execution is required:
|
||||
|
||||
```php
|
||||
$adapter->query(
|
||||
'ALTER TABLE ADD INDEX(`foo_index`) ON (`foo_column`)',
|
||||
Adapter::QUERY_MODE_EXECUTE
|
||||
);
|
||||
```
|
||||
|
||||
The primary difference to notice is that you must provide the
|
||||
`Adapter::QUERY_MODE_EXECUTE` (execute) flag as the second parameter.
|
||||
|
||||
## Creating Statements
|
||||
|
||||
While `query()` is highly useful for one-off and quick querying of a database
|
||||
via the `Adapter`, it generally makes more sense to create a statement and
|
||||
interact with it directly, so that you have greater control over the
|
||||
prepare-then-execute workflow. To do this, `Adapter` gives you a routine called
|
||||
`createStatement()` that allows you to create a `Driver` specific `Statement` to
|
||||
use so you can manage your own prepare-then-execute workflow.
|
||||
|
||||
```php
|
||||
// with optional parameters to bind up-front:
|
||||
$statement = $adapter->createStatement($sql, $optionalParameters);
|
||||
$result = $statement->execute();
|
||||
```
|
||||
|
||||
## Using the Driver Object
|
||||
|
||||
The `Driver` object is the primary place where `Zend\Db\Adapter\Adapter`
|
||||
implements the connection level abstraction specific to a given extension. To
|
||||
make this possible, each driver is composed of 3 objects:
|
||||
|
||||
- A connection: `Zend\Db\Adapter\Driver\ConnectionInterface`
|
||||
- A statement: `Zend\Db\Adapter\Driver\StatementInterface`
|
||||
- A result: `Zend\Db\Adapter\Driver\ResultInterface`
|
||||
|
||||
Each of the built-in drivers practice "prototyping" as a means of creating
|
||||
objects when new instances are requested. The workflow looks like this:
|
||||
|
||||
- An adapter is created with a set of connection parameters.
|
||||
- The adapter chooses the proper driver to instantiate (for example,
|
||||
`Zend\Db\Adapter\Driver\Mysqli`)
|
||||
- That driver class is instantiated.
|
||||
- If no connection, statement, or result objects are injected, defaults are
|
||||
instantiated.
|
||||
|
||||
This driver is now ready to be called on when particular workflows are
|
||||
requested. Here is what the `Driver` API looks like:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Adapter\Driver;
|
||||
|
||||
interface DriverInterface
|
||||
{
|
||||
const PARAMETERIZATION_POSITIONAL = 'positional';
|
||||
const PARAMETERIZATION_NAMED = 'named';
|
||||
const NAME_FORMAT_CAMELCASE = 'camelCase';
|
||||
const NAME_FORMAT_NATURAL = 'natural';
|
||||
|
||||
public function getDatabasePlatformName(string $nameFormat = self::NAME_FORMAT_CAMELCASE) : string;
|
||||
public function checkEnvironment() : bool;
|
||||
public function getConnection() : ConnectionInterface;
|
||||
public function createStatement(string|resource $sqlOrResource = null) : StatementInterface;
|
||||
public function createResult(resource $resource) : ResultInterface;
|
||||
public function getPrepareType() :string;
|
||||
public function formatParameterName(string $name, $type = null) : string;
|
||||
public function getLastGeneratedValue() : mixed;
|
||||
}
|
||||
```
|
||||
|
||||
From this `DriverInterface`, you can
|
||||
|
||||
- Determine the name of the platform this driver supports (useful for choosing
|
||||
the proper platform object).
|
||||
- Check that the environment can support this driver.
|
||||
- Return the `Connection` instance.
|
||||
- Create a `Statement` instance which is optionally seeded by an SQL statement
|
||||
(this will generally be a clone of a prototypical statement object).
|
||||
- Create a `Result` object which is optionally seeded by a statement resource
|
||||
(this will generally be a clone of a prototypical result object)
|
||||
- Format parameter names; this is important to distinguish the difference
|
||||
between the various ways parameters are named between extensions
|
||||
- Retrieve the overall last generated value (such as an auto-increment value).
|
||||
|
||||
Now let's turn to the `Statement` API:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Adapter\Driver;
|
||||
|
||||
interface StatementInterface extends StatementContainerInterface
|
||||
{
|
||||
public function getResource() : resource;
|
||||
public function prepare($sql = null) : void;
|
||||
public function isPrepared() : bool;
|
||||
public function execute(null|array|ParameterContainer $parameters = null) : ResultInterface;
|
||||
|
||||
/** Inherited from StatementContainerInterface */
|
||||
public function setSql(string $sql) : void;
|
||||
public function getSql() : string;
|
||||
public function setParameterContainer(ParameterContainer $parameterContainer) : void;
|
||||
public function getParameterContainer() : ParameterContainer;
|
||||
}
|
||||
```
|
||||
|
||||
And finally, the `Result` API:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Adapter\Driver;
|
||||
|
||||
use Countable;
|
||||
use Iterator;
|
||||
|
||||
interface ResultInterface extends Countable, Iterator
|
||||
{
|
||||
public function buffer() : void;
|
||||
public function isQueryResult() : bool;
|
||||
public function getAffectedRows() : int;
|
||||
public function getGeneratedValue() : mixed;
|
||||
public function getResource() : resource;
|
||||
public function getFieldCount() : int;
|
||||
}
|
||||
```
|
||||
|
||||
## Using The Platform Object
|
||||
|
||||
The `Platform` object provides an API to assist in crafting queries in a way
|
||||
that is specific to the SQL implementation of a particular vendor. The object
|
||||
handles nuances such as how identifiers or values are quoted, or what the
|
||||
identifier separator character is. To get an idea of the capabilities, the
|
||||
interface for a platform object looks like this:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Adapter\Platform;
|
||||
|
||||
interface PlatformInterface
|
||||
{
|
||||
public function getName() : string;
|
||||
public function getQuoteIdentifierSymbol() : string;
|
||||
public function quoteIdentifier(string $identifier) : string;
|
||||
public function quoteIdentifierChain(string|string[] $identiferChain) : string;
|
||||
public function getQuoteValueSymbol() : string;
|
||||
public function quoteValue(string $value) : string;
|
||||
public function quoteTrustedValue(string $value) : string;
|
||||
public function quoteValueList(string|string[] $valueList) : string;
|
||||
public function getIdentifierSeparator() : string;
|
||||
public function quoteIdentifierInFragment(string $identifier, array $additionalSafeWords = []) : string;
|
||||
}
|
||||
```
|
||||
|
||||
While you can directly instantiate a `Platform` object, generally speaking, it
|
||||
is easier to get the proper `Platform` instance from the configured adapter (by
|
||||
default the `Platform` type will match the underlying driver implementation):
|
||||
|
||||
```php
|
||||
$platform = $adapter->getPlatform();
|
||||
|
||||
// or
|
||||
$platform = $adapter->platform; // magic property access
|
||||
```
|
||||
|
||||
The following are examples of `Platform` usage:
|
||||
|
||||
```php
|
||||
// $adapter is a Zend\Db\Adapter\Adapter instance;
|
||||
// $platform is a Zend\Db\Adapter\Platform\Sql92 instance.
|
||||
$platform = $adapter->getPlatform();
|
||||
|
||||
// "first_name"
|
||||
echo $platform->quoteIdentifier('first_name');
|
||||
|
||||
// "
|
||||
echo $platform->getQuoteIdentifierSymbol();
|
||||
|
||||
// "schema"."mytable"
|
||||
echo $platform->quoteIdentifierChain(['schema', 'mytable']);
|
||||
|
||||
// '
|
||||
echo $platform->getQuoteValueSymbol();
|
||||
|
||||
// 'myvalue'
|
||||
echo $platform->quoteValue('myvalue');
|
||||
|
||||
// 'value', 'Foo O\\'Bar'
|
||||
echo $platform->quoteValueList(['value', "Foo O'Bar"]);
|
||||
|
||||
// .
|
||||
echo $platform->getIdentifierSeparator();
|
||||
|
||||
// "foo" as "bar"
|
||||
echo $platform->quoteIdentifierInFragment('foo as bar');
|
||||
|
||||
// additionally, with some safe words:
|
||||
// ("foo"."bar" = "boo"."baz")
|
||||
echo $platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']);
|
||||
```
|
||||
|
||||
## Using The Parameter Container
|
||||
|
||||
The `ParameterContainer` object is a container for the various parameters that
|
||||
need to be passed into a `Statement` object to fulfill all the various
|
||||
parameterized parts of the SQL statement. This object implements the
|
||||
`ArrayAccess` interface. Below is the `ParameterContainer` API:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Adapter;
|
||||
|
||||
use ArrayAccess;
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use Iterator;
|
||||
|
||||
class ParameterContainer implements Iterator, ArrayAccess, Countable
|
||||
{
|
||||
public function __construct(array $data = [])
|
||||
|
||||
/** methods to interact with values */
|
||||
public function offsetExists(string|int $name) : bool;
|
||||
public function offsetGet(string|int $name) : mixed;
|
||||
public function offsetSetReference(string|int $name, string|int $from) : void;
|
||||
public function offsetSet(string|int $name, mixed $value, mixed $errata = null, int $maxLength = null) : void;
|
||||
public function offsetUnset(string|int $name) : void;
|
||||
|
||||
/** set values from array (will reset first) */
|
||||
public function setFromArray(array $data) : ParameterContainer;
|
||||
|
||||
/** methods to interact with value errata */
|
||||
public function offsetSetErrata(string|int $name, mixed $errata) : void;
|
||||
public function offsetGetErrata(string|int $name) : mixed;
|
||||
public function offsetHasErrata(string|int $name) : bool;
|
||||
public function offsetUnsetErrata(string|int $name) : void;
|
||||
|
||||
/** errata only iterator */
|
||||
public function getErrataIterator() : ArrayIterator;
|
||||
|
||||
/** get array with named keys */
|
||||
public function getNamedArray() : array;
|
||||
|
||||
/** get array with int keys, ordered by position */
|
||||
public function getPositionalArray() : array;
|
||||
|
||||
/** iterator: */
|
||||
public function count() : int;
|
||||
public function current() : mixed;
|
||||
public function next() : mixed;
|
||||
public function key() : string|int;
|
||||
public function valid() : bool;
|
||||
public function rewind() : void;
|
||||
|
||||
/** merge existing array of parameters with existing parameters */
|
||||
public function merge(array $parameters) : ParameterContainer;
|
||||
}
|
||||
```
|
||||
|
||||
In addition to handling parameter names and values, the container will assist in
|
||||
tracking parameter types for PHP type to SQL type handling. For example, it
|
||||
might be important that:
|
||||
|
||||
```php
|
||||
$container->offsetSet('limit', 5);
|
||||
```
|
||||
|
||||
be bound as an integer. To achieve this, pass in the
|
||||
`ParameterContainer::TYPE_INTEGER` constant as the 3rd parameter:
|
||||
|
||||
```php
|
||||
$container->offsetSet('limit', 5, $container::TYPE_INTEGER);
|
||||
```
|
||||
|
||||
This will ensure that if the underlying driver supports typing of bound
|
||||
parameters, that this translated information will also be passed along to the
|
||||
actual php database driver.
|
||||
|
||||
## Examples
|
||||
|
||||
Creating a `Driver`, a vendor-portable query, and preparing and iterating the
|
||||
result:
|
||||
|
||||
```php
|
||||
$adapter = new Zend\Db\Adapter\Adapter($driverConfig);
|
||||
|
||||
$qi = function ($name) use ($adapter) {
|
||||
return $adapter->platform->quoteIdentifier($name);
|
||||
};
|
||||
$fp = function ($name) use ($adapter) {
|
||||
return $adapter->driver->formatParameterName($name);
|
||||
};
|
||||
|
||||
$sql = 'UPDATE ' . $qi('artist')
|
||||
. ' SET ' . $qi('name') . ' = ' . $fp('name')
|
||||
. ' WHERE ' . $qi('id') . ' = ' . $fp('id');
|
||||
|
||||
$statement = $adapter->query($sql);
|
||||
|
||||
$parameters = [
|
||||
'name' => 'Updated Artist',
|
||||
'id' => 1,
|
||||
];
|
||||
|
||||
$statement->execute($parameters);
|
||||
|
||||
// DATA INSERTED, NOW CHECK
|
||||
|
||||
$statement = $adapter->query(
|
||||
'SELECT * FROM '
|
||||
. $qi('artist')
|
||||
. ' WHERE id = ' . $fp('id')
|
||||
);
|
||||
|
||||
$results = $statement->execute(['id' => 1]);
|
||||
|
||||
$row = $results->current();
|
||||
$name = $row['name'];
|
||||
```
|
10
bundled-libs/zendframework/zend-db/docs/book/index.html
Normal file
10
bundled-libs/zendframework/zend-db/docs/book/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<div class="container">
|
||||
<div class="jumbotron">
|
||||
<h1>zend-db</h1>
|
||||
|
||||
<p>Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations.</p>
|
||||
|
||||
<pre><code class="language-bash">$ composer require zendframework/zend-db</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
229
bundled-libs/zendframework/zend-db/docs/book/metadata.md
Normal file
229
bundled-libs/zendframework/zend-db/docs/book/metadata.md
Normal file
@ -0,0 +1,229 @@
|
||||
# RDBMS Metadata
|
||||
|
||||
`Zend\Db\Metadata` is as sub-component of zend-db that makes it possible to get
|
||||
metadata information about tables, columns, constraints, triggers, and other
|
||||
information from a database in a standardized way. The primary interface for
|
||||
`Metadata` is:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\Metadata;
|
||||
|
||||
interface MetadataInterface
|
||||
{
|
||||
public function getSchemas();
|
||||
|
||||
public function getTableNames(string $schema = null, bool $includeViews = false) : string[];
|
||||
public function getTables(string $schema = null, bool $includeViews = false) : Object\TableObject[];
|
||||
public function getTable(string $tableName, string $schema = null) : Object\TableObject;
|
||||
|
||||
public function getViewNames(string $schema = null) : string[];
|
||||
public function getViews(string $schema = null) : Object\ViewObject[];
|
||||
public function getView(string $viewName, string $schema = null) : Object\ViewObject;
|
||||
|
||||
public function getColumnNames(string string $table, $schema = null) : string[];
|
||||
public function getColumns(string $table, string $schema = null) : Object\ColumnObject[];
|
||||
public function getColumn(string $columnName, string $table, string $schema = null) Object\ColumnObject;
|
||||
|
||||
public function getConstraints(string $table, $string schema = null) : Object\ConstraintObject[];
|
||||
public function getConstraint(string $constraintName, string $table, string $schema = null) : Object\ConstraintObject;
|
||||
public function getConstraintKeys(string $constraint, string $table, string $schema = null) : Object\ConstraintKeyObject[];
|
||||
|
||||
public function getTriggerNames(string $schema = null) : string[];
|
||||
public function getTriggers(string $schema = null) : Object\TriggerObject[];
|
||||
public function getTrigger(string $triggerName, string $schema = null) : Object\TriggerObject;
|
||||
}
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Usage of `Zend\Db\Metadata` involves:
|
||||
|
||||
- Constructing a `Zend\Db\Metadata\Metadata` instance with an `Adapter`.
|
||||
- Choosing a strategy for retrieving metadata, based on the database platform
|
||||
used. In most cases, information will come from querying the
|
||||
`INFORMATION_SCHEMA` tables for the currently accessible schema.
|
||||
|
||||
The `Metadata::get*Names()` methods will return arrays of strings, while the
|
||||
other methods will return value objects specific to the type queried.
|
||||
|
||||
```php
|
||||
$metadata = new Zend\Db\Metadata\Metadata($adapter);
|
||||
|
||||
// get the table names
|
||||
$tableNames = $metadata->getTableNames();
|
||||
|
||||
foreach ($tableNames as $tableName) {
|
||||
echo 'In Table ' . $tableName . PHP_EOL;
|
||||
|
||||
$table = $metadata->getTable($tableName);
|
||||
|
||||
echo ' With columns: ' . PHP_EOL;
|
||||
foreach ($table->getColumns() as $column) {
|
||||
echo ' ' . $column->getName()
|
||||
. ' -> ' . $column->getDataType()
|
||||
. PHP_EOL;
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
echo ' With constraints: ' . PHP_EOL;
|
||||
|
||||
foreach ($metadata->getConstraints($tableName) as $constraint) {
|
||||
echo ' ' . $constraint->getName()
|
||||
. ' -> ' . $constraint->getType()
|
||||
. PHP_EOL;
|
||||
|
||||
if (! $constraint->hasColumns()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo ' column: ' . implode(', ', $constraint->getColumns());
|
||||
if ($constraint->isForeignKey()) {
|
||||
$fkCols = [];
|
||||
foreach ($constraint->getReferencedColumns() as $refColumn) {
|
||||
$fkCols[] = $constraint->getReferencedTableName() . '.' . $refColumn;
|
||||
}
|
||||
echo ' => ' . implode(', ', $fkCols);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
echo '----' . PHP_EOL;
|
||||
}
|
||||
```
|
||||
|
||||
## Metadata value objects
|
||||
|
||||
Metadata returns value objects that provide an interface to help developers
|
||||
better explore the metadata. Below is the API for the various value objects:
|
||||
|
||||
### TableObject
|
||||
|
||||
```php
|
||||
class Zend\Db\Metadata\Object\TableObject
|
||||
{
|
||||
public function __construct($name);
|
||||
public function setColumns(array $columns);
|
||||
public function getColumns();
|
||||
public function setConstraints($constraints);
|
||||
public function getConstraints();
|
||||
public function setName($name);
|
||||
public function getName();
|
||||
}
|
||||
```
|
||||
|
||||
### ColumnObject
|
||||
|
||||
```php
|
||||
class Zend\Db\Metadata\Object\ColumnObject
|
||||
{
|
||||
public function __construct($name, $tableName, $schemaName = null);
|
||||
public function setName($name);
|
||||
public function getName();
|
||||
public function getTableName();
|
||||
public function setTableName($tableName);
|
||||
public function setSchemaName($schemaName);
|
||||
public function getSchemaName();
|
||||
public function getOrdinalPosition();
|
||||
public function setOrdinalPosition($ordinalPosition);
|
||||
public function getColumnDefault();
|
||||
public function setColumnDefault($columnDefault);
|
||||
public function getIsNullable();
|
||||
public function setIsNullable($isNullable);
|
||||
public function isNullable();
|
||||
public function getDataType();
|
||||
public function setDataType($dataType);
|
||||
public function getCharacterMaximumLength();
|
||||
public function setCharacterMaximumLength($characterMaximumLength);
|
||||
public function getCharacterOctetLength();
|
||||
public function setCharacterOctetLength($characterOctetLength);
|
||||
public function getNumericPrecision();
|
||||
public function setNumericPrecision($numericPrecision);
|
||||
public function getNumericScale();
|
||||
public function setNumericScale($numericScale);
|
||||
public function getNumericUnsigned();
|
||||
public function setNumericUnsigned($numericUnsigned);
|
||||
public function isNumericUnsigned();
|
||||
public function getErratas();
|
||||
public function setErratas(array $erratas);
|
||||
public function getErrata($errataName);
|
||||
public function setErrata($errataName, $errataValue);
|
||||
}
|
||||
```
|
||||
|
||||
### ConstraintObject
|
||||
|
||||
```php
|
||||
class Zend\Db\Metadata\Object\ConstraintObject
|
||||
{
|
||||
public function __construct($name, $tableName, $schemaName = null);
|
||||
public function setName($name);
|
||||
public function getName();
|
||||
public function setSchemaName($schemaName);
|
||||
public function getSchemaName();
|
||||
public function getTableName();
|
||||
public function setTableName($tableName);
|
||||
public function setType($type);
|
||||
public function getType();
|
||||
public function hasColumns();
|
||||
public function getColumns();
|
||||
public function setColumns(array $columns);
|
||||
public function getReferencedTableSchema();
|
||||
public function setReferencedTableSchema($referencedTableSchema);
|
||||
public function getReferencedTableName();
|
||||
public function setReferencedTableName($referencedTableName);
|
||||
public function getReferencedColumns();
|
||||
public function setReferencedColumns(array $referencedColumns);
|
||||
public function getMatchOption();
|
||||
public function setMatchOption($matchOption);
|
||||
public function getUpdateRule();
|
||||
public function setUpdateRule($updateRule);
|
||||
public function getDeleteRule();
|
||||
public function setDeleteRule($deleteRule);
|
||||
public function getCheckClause();
|
||||
public function setCheckClause($checkClause);
|
||||
public function isPrimaryKey();
|
||||
public function isUnique();
|
||||
public function isForeignKey();
|
||||
public function isCheck();
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### TriggerObject
|
||||
|
||||
```php
|
||||
class Zend\Db\Metadata\Object\TriggerObject
|
||||
{
|
||||
public function getName();
|
||||
public function setName($name);
|
||||
public function getEventManipulation();
|
||||
public function setEventManipulation($eventManipulation);
|
||||
public function getEventObjectCatalog();
|
||||
public function setEventObjectCatalog($eventObjectCatalog);
|
||||
public function getEventObjectSchema();
|
||||
public function setEventObjectSchema($eventObjectSchema);
|
||||
public function getEventObjectTable();
|
||||
public function setEventObjectTable($eventObjectTable);
|
||||
public function getActionOrder();
|
||||
public function setActionOrder($actionOrder);
|
||||
public function getActionCondition();
|
||||
public function setActionCondition($actionCondition);
|
||||
public function getActionStatement();
|
||||
public function setActionStatement($actionStatement);
|
||||
public function getActionOrientation();
|
||||
public function setActionOrientation($actionOrientation);
|
||||
public function getActionTiming();
|
||||
public function setActionTiming($actionTiming);
|
||||
public function getActionReferenceOldTable();
|
||||
public function setActionReferenceOldTable($actionReferenceOldTable);
|
||||
public function getActionReferenceNewTable();
|
||||
public function setActionReferenceNewTable($actionReferenceNewTable);
|
||||
public function getActionReferenceOldRow();
|
||||
public function setActionReferenceOldRow($actionReferenceOldRow);
|
||||
public function getActionReferenceNewRow();
|
||||
public function setActionReferenceNewRow($actionReferenceNewRow);
|
||||
public function getCreated();
|
||||
public function setCreated($created);
|
||||
}
|
||||
```
|
157
bundled-libs/zendframework/zend-db/docs/book/result-set.md
Normal file
157
bundled-libs/zendframework/zend-db/docs/book/result-set.md
Normal file
@ -0,0 +1,157 @@
|
||||
# Result Sets
|
||||
|
||||
`Zend\Db\ResultSet` is a sub-component of zend-db for abstracting the iteration
|
||||
of results returned from queries producing rowsets. While data sources for this
|
||||
can be anything that is iterable, generally these will be populated from
|
||||
`Zend\Db\Adapter\Driver\ResultInterface` instances.
|
||||
|
||||
Result sets must implement the `Zend\Db\ResultSet\ResultSetInterface`, and all
|
||||
sub-components of zend-db that return a result set as part of their API will
|
||||
assume an instance of a `ResultSetInterface` should be returned. In most cases,
|
||||
the prototype pattern will be used by consuming object to clone a prototype of
|
||||
a `ResultSet` and return a specialized `ResultSet` with a specific data source
|
||||
injected. `ResultSetInterface` is defined as follows:
|
||||
|
||||
```php
|
||||
use Countable;
|
||||
use Traversable;
|
||||
|
||||
interface ResultSetInterface extends Traversable, Countable
|
||||
{
|
||||
public function initialize(mixed $dataSource) : void;
|
||||
public function getFieldCount() : int;
|
||||
}
|
||||
```
|
||||
|
||||
## Quick start
|
||||
|
||||
`Zend\Db\ResultSet\ResultSet` is the most basic form of a `ResultSet` object
|
||||
that will expose each row as either an `ArrayObject`-like object or an array of
|
||||
row data. By default, `Zend\Db\Adapter\Adapter` will use a prototypical
|
||||
`Zend\Db\ResultSet\ResultSet` object for iterating when using the
|
||||
`Zend\Db\Adapter\Adapter::query()` method.
|
||||
|
||||
The following is an example workflow similar to what one might find inside
|
||||
`Zend\Db\Adapter\Adapter::query()`:
|
||||
|
||||
```php
|
||||
use Zend\Db\Adapter\Driver\ResultInterface;
|
||||
use Zend\Db\ResultSet\ResultSet;
|
||||
|
||||
$statement = $driver->createStatement('SELECT * FROM users');
|
||||
$statement->prepare();
|
||||
$result = $statement->execute($parameters);
|
||||
|
||||
if ($result instanceof ResultInterface && $result->isQueryResult()) {
|
||||
$resultSet = new ResultSet;
|
||||
$resultSet->initialize($result);
|
||||
|
||||
foreach ($resultSet as $row) {
|
||||
echo $row->my_column . PHP_EOL;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Zend\\Db\\ResultSet\\ResultSet and Zend\\Db\\ResultSet\\AbstractResultSet
|
||||
|
||||
For most purposes, either an instance of `Zend\Db\ResultSet\ResultSet` or a
|
||||
derivative of `Zend\Db\ResultSet\AbstractResultSet` will be used. The
|
||||
implementation of the `AbstractResultSet` offers the following core
|
||||
functionality:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\ResultSet;
|
||||
|
||||
use Iterator;
|
||||
|
||||
abstract class AbstractResultSet implements Iterator, ResultSetInterface
|
||||
{
|
||||
public function initialize(array|Iterator|IteratorAggregate|ResultInterface $dataSource) : self;
|
||||
public function getDataSource() : Iterator|IteratorAggregate|ResultInterface;
|
||||
public function getFieldCount() : int;
|
||||
|
||||
/** Iterator */
|
||||
public function next() : mixed;
|
||||
public function key() : string|int;
|
||||
public function current() : mixed;
|
||||
public function valid() : bool;
|
||||
public function rewind() : void;
|
||||
|
||||
/** countable */
|
||||
public function count() : int;
|
||||
|
||||
/** get rows as array */
|
||||
public function toArray() : array;
|
||||
}
|
||||
```
|
||||
|
||||
## Zend\\Db\\ResultSet\\HydratingResultSet
|
||||
|
||||
`Zend\Db\ResultSet\HydratingResultSet` is a more flexible `ResultSet` object
|
||||
that allows the developer to choose an appropriate "hydration strategy" for
|
||||
getting row data into a target object. While iterating over results,
|
||||
`HydratingResultSet` will take a prototype of a target object and clone it once
|
||||
for each row. The `HydratingResultSet` will then hydrate that clone with the
|
||||
row data.
|
||||
|
||||
The `HydratingResultSet` depends on
|
||||
[zend-hydrator](https://docs.zendframework.com/zend-hydrator), which you will
|
||||
need to install:
|
||||
|
||||
```bash
|
||||
$ composer require zendframework/zend-hydrator
|
||||
```
|
||||
|
||||
In the example below, rows from the database will be iterated, and during
|
||||
iteration, `HydratingResultSet` will use the `Reflection` based hydrator to
|
||||
inject the row data directly into the protected members of the cloned
|
||||
`UserEntity` object:
|
||||
|
||||
```php
|
||||
use Zend\Db\Adapter\Driver\ResultInterface;
|
||||
use Zend\Db\ResultSet\HydratingResultSet;
|
||||
use Zend\Hydrator\Reflection as ReflectionHydrator;
|
||||
|
||||
class UserEntity
|
||||
{
|
||||
protected $first_name;
|
||||
protected $last_name;
|
||||
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->first_name;
|
||||
}
|
||||
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->last_name;
|
||||
}
|
||||
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$this->first_name = $firstName;
|
||||
}
|
||||
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$this->last_name = $lastName;
|
||||
}
|
||||
}
|
||||
|
||||
$statement = $driver->createStatement($sql);
|
||||
$statement->prepare($parameters);
|
||||
$result = $statement->execute();
|
||||
|
||||
if ($result instanceof ResultInterface && $result->isQueryResult()) {
|
||||
$resultSet = new HydratingResultSet(new ReflectionHydrator, new UserEntity);
|
||||
$resultSet->initialize($result);
|
||||
|
||||
foreach ($resultSet as $user) {
|
||||
echo $user->getFirstName() . ' ' . $user->getLastName() . PHP_EOL;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information, see the [zend-hydrator](https://docs.zendframework.com/zend-hydrator/)
|
||||
documentation to get a better sense of the different strategies that can be
|
||||
employed in order to populate a target object.
|
98
bundled-libs/zendframework/zend-db/docs/book/row-gateway.md
Normal file
98
bundled-libs/zendframework/zend-db/docs/book/row-gateway.md
Normal file
@ -0,0 +1,98 @@
|
||||
# Row Gateways
|
||||
|
||||
`Zend\Db\RowGateway` is a sub-component of zend-db that implements the Row Data
|
||||
Gateway pattern described in the book [Patterns of Enterprise Application
|
||||
Architecture](http://www.martinfowler.com/books/eaa.html). Row Data Gateways
|
||||
model individual rows of a database table, and provide methods such as `save()`
|
||||
and `delete()` that persist the row to the database. Likewise, after a row from
|
||||
the database is retrieved, it can then be manipulated and `save()`'d back to
|
||||
the database in the same position (row), or it can be `delete()`'d from the
|
||||
table.
|
||||
|
||||
`RowGatewayInterface` defines the methods `save()` and `delete()`:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\RowGateway;
|
||||
|
||||
interface RowGatewayInterface
|
||||
{
|
||||
public function save();
|
||||
public function delete();
|
||||
}
|
||||
```
|
||||
|
||||
## Quick start
|
||||
|
||||
`RowGateway` is generally used in conjunction with objects that produce
|
||||
`Zend\Db\ResultSet`s, though it may also be used standalone. To use it
|
||||
standalone, you need an `Adapter` instance and a set of data to work with.
|
||||
|
||||
The following demonstrates a basic use case.
|
||||
|
||||
```php
|
||||
use Zend\Db\RowGateway\RowGateway;
|
||||
|
||||
// Query the database:
|
||||
$resultSet = $adapter->query('SELECT * FROM `user` WHERE `id` = ?', [2]);
|
||||
|
||||
// Get array of data:
|
||||
$rowData = $resultSet->current()->getArrayCopy();
|
||||
|
||||
// Create a row gateway:
|
||||
$rowGateway = new RowGateway('id', 'my_table', $adapter);
|
||||
$rowGateway->populate($rowData, true);
|
||||
|
||||
// Manipulate the row and persist it:
|
||||
$rowGateway->first_name = 'New Name';
|
||||
$rowGateway->save();
|
||||
|
||||
// Or delete this row:
|
||||
$rowGateway->delete();
|
||||
```
|
||||
|
||||
The workflow described above is greatly simplified when `RowGateway` is used in
|
||||
conjunction with the [TableGateway RowGatewayFeature](table-gateway.md#tablegateway-features).
|
||||
In that paradigm, `select()` operations will produce a `ResultSet` that iterates
|
||||
`RowGateway` instances.
|
||||
|
||||
As an example:
|
||||
|
||||
```php
|
||||
use Zend\Db\TableGateway\Feature\RowGatewayFeature;
|
||||
use Zend\Db\TableGateway\TableGateway;
|
||||
|
||||
$table = new TableGateway('artist', $adapter, new RowGatewayFeature('id'));
|
||||
$results = $table->select(['id' => 2]);
|
||||
|
||||
$artistRow = $results->current();
|
||||
$artistRow->name = 'New Name';
|
||||
$artistRow->save();
|
||||
```
|
||||
|
||||
## ActiveRecord Style Objects
|
||||
|
||||
If you wish to have custom behaviour in your `RowGateway` objects —
|
||||
essentially making them behave similarly to the
|
||||
[ActiveRecord](http://www.martinfowler.com/eaaCatalog/activeRecord.html)
|
||||
pattern), pass a prototype object implementing the `RowGatewayInterface` to the
|
||||
`RowGatewayFeature` constructor instead of a primary key:
|
||||
|
||||
```php
|
||||
use Zend\Db\TableGateway\Feature\RowGatewayFeature;
|
||||
use Zend\Db\TableGateway\TableGateway;
|
||||
use Zend\Db\RowGateway\RowGatewayInterface;
|
||||
|
||||
class Artist implements RowGatewayInterface
|
||||
{
|
||||
protected $adapter;
|
||||
|
||||
public function __construct($adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
}
|
||||
|
||||
// ... save() and delete() implementations
|
||||
}
|
||||
|
||||
$table = new TableGateway('artist', $adapter, new RowGatewayFeature(new Artist($adapter)));
|
||||
```
|
201
bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md
Normal file
201
bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md
Normal file
@ -0,0 +1,201 @@
|
||||
# DDL Abstraction
|
||||
|
||||
`Zend\Db\Sql\Ddl` is a sub-component of `Zend\Db\Sql` allowing creation of DDL
|
||||
(Data Definition Language) SQL statements. When combined with a platform
|
||||
specific `Zend\Db\Sql\Sql` object, DDL objects are capable of producing
|
||||
platform-specific `CREATE TABLE` statements, with specialized data types,
|
||||
constraints, and indexes for a database/schema.
|
||||
|
||||
The following platforms have platform specializations for DDL:
|
||||
|
||||
- MySQL
|
||||
- All databases compatible with ANSI SQL92
|
||||
|
||||
## Creating Tables
|
||||
|
||||
Like `Zend\Db\Sql` objects, each statement type is represented by a class. For
|
||||
example, `CREATE TABLE` is modeled by the `CreateTable` class; this is likewise
|
||||
the same for `ALTER TABLE` (as `AlterTable`), and `DROP TABLE` (as
|
||||
`DropTable`). You can create instances using a number of approaches:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl;
|
||||
use Zend\Db\Sql\TableIdentifier;
|
||||
|
||||
$table = new Ddl\CreateTable();
|
||||
|
||||
// With a table name:
|
||||
$table = new Ddl\CreateTable('bar');
|
||||
|
||||
// With a schema name "foo":
|
||||
$table = new Ddl\CreateTable(new TableIdentifier('bar', 'foo'));
|
||||
|
||||
// Optionally, as a temporary table:
|
||||
$table = new Ddl\CreateTable('bar', true);
|
||||
```
|
||||
|
||||
You can also set the table after instantiation:
|
||||
|
||||
```php
|
||||
$table->setTable('bar');
|
||||
```
|
||||
|
||||
Currently, columns are added by creating a column object (described in the
|
||||
[data type table below](#currently-supported-data-types)):
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
$table->addColumn(new Column\Integer('id'));
|
||||
$table->addColumn(new Column\Varchar('name', 255));
|
||||
```
|
||||
|
||||
Beyond adding columns to a table, you may also add constraints:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl\Constraint;
|
||||
|
||||
$table->addConstraint(new Constraint\PrimaryKey('id'));
|
||||
$table->addConstraint(
|
||||
new Constraint\UniqueKey(['name', 'foo'], 'my_unique_key')
|
||||
);
|
||||
```
|
||||
You can also use the `AUTO_INCREMENT` attribute for MySQL:
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
$column = new Column\Integer('id');
|
||||
$column->setOption('AUTO_INCREMENT', true);
|
||||
```
|
||||
|
||||
## Altering Tables
|
||||
|
||||
Similar to `CreateTable`, you may also use `AlterTable` instances:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl;
|
||||
use Zend\Db\Sql\TableIdentifier;
|
||||
|
||||
$table = new Ddl\AlterTable();
|
||||
|
||||
// With a table name:
|
||||
$table = new Ddl\AlterTable('bar');
|
||||
|
||||
// With a schema name "foo":
|
||||
$table = new Ddl\AlterTable(new TableIdentifier('bar', 'foo'));
|
||||
|
||||
// Optionally, as a temporary table:
|
||||
$table = new Ddl\AlterTable('bar', true);
|
||||
```
|
||||
|
||||
The primary difference between a `CreateTable` and `AlterTable` is that the
|
||||
`AlterTable` takes into account that the table and its assets already exist.
|
||||
Therefore, while you still have `addColumn()` and `addConstraint()`, you will
|
||||
also have the ability to *alter* existing columns:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl\Column;
|
||||
|
||||
$table->changeColumn('name', Column\Varchar('new_name', 50));
|
||||
```
|
||||
|
||||
You may also *drop* existing columns or constraints:
|
||||
|
||||
```php
|
||||
$table->dropColumn('foo');
|
||||
$table->dropConstraint('my_index');
|
||||
```
|
||||
|
||||
## Dropping Tables
|
||||
|
||||
To drop a table, create a `DropTable` instance:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Ddl;
|
||||
use Zend\Db\Sql\TableIdentifier;
|
||||
|
||||
// With a table name:
|
||||
$drop = new Ddl\DropTable('bar');
|
||||
|
||||
// With a schema name "foo":
|
||||
$drop = new Ddl\DropTable(new TableIdentifier('bar', 'foo'));
|
||||
```
|
||||
|
||||
## Executing DDL Statements
|
||||
|
||||
After a DDL statement object has been created and configured, at some point you
|
||||
will need to execute the statement. This requires an `Adapter` instance and a
|
||||
properly seeded `Sql` instance.
|
||||
|
||||
The workflow looks something like this, with `$ddl` being a `CreateTable`,
|
||||
`AlterTable`, or `DropTable` instance:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Sql;
|
||||
|
||||
// Existence of $adapter is assumed.
|
||||
$sql = new Sql($adapter);
|
||||
|
||||
$adapter->query(
|
||||
$sql->getSqlStringForSqlObject($ddl),
|
||||
$adapter::QUERY_MODE_EXECUTE
|
||||
);
|
||||
```
|
||||
|
||||
By passing the `$ddl` object through the `$sql` instance's
|
||||
`getSqlStringForSqlObject()` method, we ensure that any platform specific
|
||||
specializations/modifications are utilized to create a platform specific SQL
|
||||
statement.
|
||||
|
||||
Next, using the constant `Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE` ensures
|
||||
that the SQL statement is not prepared, as most DDL statements on most
|
||||
platforms cannot be prepared, only executed.
|
||||
|
||||
## Currently Supported Data Types
|
||||
|
||||
These types exist in the `Zend\Db\Sql\Ddl\Column` namespace. Data types must
|
||||
implement `Zend\Db\Sql\Ddl\Column\ColumnInterface`.
|
||||
|
||||
In alphabetical order:
|
||||
|
||||
Type | Arguments For Construction
|
||||
-----------------|---------------------------
|
||||
BigInteger | `$name`, `$nullable = false`, `$default = null`, `array $options = array()`
|
||||
Binary | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()`
|
||||
Blob | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()`
|
||||
Boolean | `$name`
|
||||
Char | `$name`, `length`
|
||||
Column (generic) | `$name = null`
|
||||
Date | `$name`
|
||||
DateTime | `$name`
|
||||
Decimal | `$name`, `$precision`, `$scale = null`
|
||||
Float | `$name`, `$digits`, `$decimal` (Note: this class is deprecated as of 2.4.0; use Floating instead)
|
||||
Floating | `$name`, `$digits`, `$decimal`
|
||||
Integer | `$name`, `$nullable = false`, `default = null`, `array $options = array()`
|
||||
Text | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()`
|
||||
Time | `$name`
|
||||
Timestamp | `$name`
|
||||
Varbinary | `$name`, `$length`
|
||||
Varchar | `$name`, `$length`
|
||||
|
||||
Each of the above types can be utilized in any place that accepts a `Column\ColumnInterface`
|
||||
instance. Currently, this is primarily in `CreateTable::addColumn()` and `AlterTable`'s
|
||||
`addColumn()` and `changeColumn()` methods.
|
||||
|
||||
## Currently Supported Constraint Types
|
||||
|
||||
These types exist in the `Zend\Db\Sql\Ddl\Constraint` namespace. Data types
|
||||
must implement `Zend\Db\Sql\Ddl\Constraint\ConstraintInterface`.
|
||||
|
||||
In alphabetical order:
|
||||
|
||||
Type | Arguments For Construction
|
||||
-----------|---------------------------
|
||||
Check | `$expression`, `$name`
|
||||
ForeignKey | `$name`, `$column`, `$referenceTable`, `$referenceColumn`, `$onDeleteRule = null`, `$onUpdateRule = null`
|
||||
PrimaryKey | `$columns`
|
||||
UniqueKey | `$column`, `$name = null`
|
||||
|
||||
Each of the above types can be utilized in any place that accepts a
|
||||
`Column\ConstraintInterface` instance. Currently, this is primarily in
|
||||
`CreateTable::addConstraint()` and `AlterTable::addConstraint()`.
|
741
bundled-libs/zendframework/zend-db/docs/book/sql.md
Normal file
741
bundled-libs/zendframework/zend-db/docs/book/sql.md
Normal file
@ -0,0 +1,741 @@
|
||||
# SQL Abstraction
|
||||
|
||||
`Zend\Db\Sql` is a SQL abstraction layer for building platform-specific SQL
|
||||
queries via an object-oriented API. The end result of a `Zend\Db\Sql` object
|
||||
will be to either produce a `Statement` and `ParameterContainer` that
|
||||
represents the target query, or a full string that can be directly executed
|
||||
against the database platform. To achieve this, `Zend\Db\Sql` objects require a
|
||||
`Zend\Db\Adapter\Adapter` object in order to produce the desired results.
|
||||
|
||||
## Quick start
|
||||
|
||||
There are four primary tasks associated with interacting with a database
|
||||
defined by Data Manipulation Language (DML): selecting, inserting, updating,
|
||||
and deleting. As such, there are four primary classes that developers can
|
||||
interact with in order to build queries in the `Zend\Db\Sql` namespace:
|
||||
`Select`, `Insert`, `Update`, and `Delete`.
|
||||
|
||||
Since these four tasks are so closely related and generally used together
|
||||
within the same application, the `Zend\Db\Sql\Sql` class helps you create them
|
||||
and produce the result you are attempting to achieve.
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Sql;
|
||||
|
||||
$sql = new Sql($adapter);
|
||||
$select = $sql->select(); // returns a Zend\Db\Sql\Select instance
|
||||
$insert = $sql->insert(); // returns a Zend\Db\Sql\Insert instance
|
||||
$update = $sql->update(); // returns a Zend\Db\Sql\Update instance
|
||||
$delete = $sql->delete(); // returns a Zend\Db\Sql\Delete instance
|
||||
```
|
||||
|
||||
As a developer, you can now interact with these objects, as described in the
|
||||
sections below, to customize each query. Once they have been populated with
|
||||
values, they are ready to either be prepared or executed.
|
||||
|
||||
To prepare (using a Select object):
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Sql;
|
||||
|
||||
$sql = new Sql($adapter);
|
||||
$select = $sql->select();
|
||||
$select->from('foo');
|
||||
$select->where(['id' => 2]);
|
||||
|
||||
$statement = $sql->prepareStatementForSqlObject($select);
|
||||
$results = $statement->execute();
|
||||
```
|
||||
|
||||
To execute (using a Select object)
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Sql;
|
||||
|
||||
$sql = new Sql($adapter);
|
||||
$select = $sql->select();
|
||||
$select->from('foo');
|
||||
$select->where(['id' => 2]);
|
||||
|
||||
$selectString = $sql->buildSqlString($select);
|
||||
$results = $adapter->query($selectString, $adapter::QUERY_MODE_EXECUTE);
|
||||
```
|
||||
|
||||
`Zend\\Db\\Sql\\Sql` objects can also be bound to a particular table so that in
|
||||
obtaining a `Select`, `Insert`, `Update`, or `Delete` instance, the object will be
|
||||
seeded with the table:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Sql;
|
||||
|
||||
$sql = new Sql($adapter, 'foo');
|
||||
$select = $sql->select();
|
||||
$select->where(['id' => 2]); // $select already has from('foo') applied
|
||||
```
|
||||
|
||||
## Common interfaces for SQL implementations
|
||||
|
||||
Each of these objects implements the following two interfaces:
|
||||
|
||||
```php
|
||||
interface PreparableSqlInterface
|
||||
{
|
||||
public function prepareStatement(Adapter $adapter, StatementInterface $statement) : void;
|
||||
}
|
||||
|
||||
interface SqlInterface
|
||||
{
|
||||
public function getSqlString(PlatformInterface $adapterPlatform = null) : string;
|
||||
}
|
||||
```
|
||||
|
||||
Use these functions to produce either (a) a prepared statement, or (b) a string
|
||||
to execute.
|
||||
|
||||
## Select
|
||||
|
||||
`Zend\Db\Sql\Select` presents a unified API for building platform-specific SQL
|
||||
SELECT queries. Instances may be created and consumed without
|
||||
`Zend\Db\Sql\Sql`:
|
||||
|
||||
```php
|
||||
use Zend\Db\Sql\Select;
|
||||
|
||||
$select = new Select();
|
||||
// or, to produce a $select bound to a specific table
|
||||
$select = new Select('foo');
|
||||
```
|
||||
|
||||
If a table is provided to the `Select` object, then `from()` cannot be called
|
||||
later to change the name of the table.
|
||||
|
||||
Once you have a valid `Select` object, the following API can be used to further
|
||||
specify various select statement parts:
|
||||
|
||||
```php
|
||||
class Select extends AbstractSql implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
const JOIN_INNER = 'inner';
|
||||
const JOIN_OUTER = 'outer';
|
||||
const JOIN_LEFT = 'left';
|
||||
const JOIN_RIGHT = 'right';
|
||||
const SQL_STAR = '*';
|
||||
const ORDER_ASCENDING = 'ASC';
|
||||
const ORDER_DESCENDING = 'DESC';
|
||||
|
||||
public $where; // @param Where $where
|
||||
|
||||
public function __construct(string|array|TableIdentifier $table = null);
|
||||
public function from(string|array|TableIdentifier $table) : self;
|
||||
public function columns(array $columns, bool $prefixColumnsWithTable = true) : self;
|
||||
public function join(string|array $name, string $on, string|array $columns = self::SQL_STAR, string $type = self::JOIN_INNER) : self;
|
||||
public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self;
|
||||
public function group(string|array $group);
|
||||
public function having(Having|callable|string|array $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self;
|
||||
public function order(string|array $order) : self;
|
||||
public function limit(int $limit) : self;
|
||||
public function offset(int $offset) : self;
|
||||
}
|
||||
```
|
||||
|
||||
### from()
|
||||
|
||||
```php
|
||||
// As a string:
|
||||
$select->from('foo');
|
||||
|
||||
// As an array to specify an alias
|
||||
// (produces SELECT "t".* FROM "table" AS "t")
|
||||
$select->from(['t' => 'table']);
|
||||
|
||||
// Using a Sql\TableIdentifier:
|
||||
// (same output as above)
|
||||
$select->from(['t' => new TableIdentifier('table')]);
|
||||
```
|
||||
|
||||
### columns()
|
||||
|
||||
```php
|
||||
// As an array of names
|
||||
$select->columns(['foo', 'bar']);
|
||||
|
||||
// As an associative array with aliases as the keys
|
||||
// (produces 'bar' AS 'foo', 'bax' AS 'baz')
|
||||
$select->columns([
|
||||
'foo' => 'bar',
|
||||
'baz' => 'bax'
|
||||
]);
|
||||
|
||||
// Sql function call on the column
|
||||
// (produces CONCAT_WS('/', 'bar', 'bax') AS 'foo')
|
||||
$select->columns([
|
||||
'foo' => new \Zend\Db\Sql\Expression("CONCAT_WS('/', 'bar', 'bax')")
|
||||
]);
|
||||
```
|
||||
|
||||
### join()
|
||||
|
||||
```php
|
||||
$select->join(
|
||||
'foo', // table name
|
||||
'id = bar.id', // expression to join on (will be quoted by platform object before insertion),
|
||||
['bar', 'baz'], // (optional) list of columns, same requirements as columns() above
|
||||
$select::JOIN_OUTER // (optional), one of inner, outer, left, right also represented by constants in the API
|
||||
);
|
||||
|
||||
$select
|
||||
->from(['f' => 'foo']) // base table
|
||||
->join(
|
||||
['b' => 'bar'], // join table with alias
|
||||
'f.foo_id = b.foo_id' // join expression
|
||||
);
|
||||
```
|
||||
|
||||
### where(), having()
|
||||
|
||||
`Zend\Db\Sql\Select` provides bit of flexibility as it regards to what kind of
|
||||
parameters are acceptable when calling `where()` or `having()`. The method
|
||||
signature is listed as:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Create where clause
|
||||
*
|
||||
* @param Where|callable|string|array $predicate
|
||||
* @param string $combination One of the OP_* constants from Predicate\PredicateSet
|
||||
* @return Select
|
||||
*/
|
||||
public function where($predicate, $combination = Predicate\PredicateSet::OP_AND);
|
||||
```
|
||||
|
||||
If you provide a `Zend\Db\Sql\Where` instance to `where()` or a
|
||||
`Zend\Db\Sql\Having` instance to `having()`, any previous internal instances
|
||||
will be replaced completely. When either instance is processed, this object will
|
||||
be iterated to produce the WHERE or HAVING section of the SELECT statement.
|
||||
|
||||
If you provide a PHP callable to `where()` or `having()`, this function will be
|
||||
called with the `Select`'s `Where`/`Having` instance as the only parameter.
|
||||
This enables code like the following:
|
||||
|
||||
```php
|
||||
$select->where(function (Where $where) {
|
||||
$where->like('username', 'ralph%');
|
||||
});
|
||||
```
|
||||
|
||||
If you provide a *string*, this string will be used to create a
|
||||
`Zend\Db\Sql\Predicate\Expression` instance, and its contents will be applied
|
||||
as-is, with no quoting:
|
||||
|
||||
```php
|
||||
// SELECT "foo".* FROM "foo" WHERE x = 5
|
||||
$select->from('foo')->where('x = 5');
|
||||
```
|
||||
|
||||
If you provide an array with integer indices, the value can be one of:
|
||||
|
||||
- a string; this will be used to build a `Predicate\Expression`.
|
||||
- any object implementing `Predicate\PredicateInterface`.
|
||||
|
||||
In either case, the instances are pushed onto the `Where` stack with the
|
||||
`$combination` provided (defaulting to `AND`).
|
||||
|
||||
As an example:
|
||||
|
||||
```php
|
||||
// SELECT "foo".* FROM "foo" WHERE x = 5 AND y = z
|
||||
$select->from('foo')->where(['x = 5', 'y = z']);
|
||||
```
|
||||
|
||||
If you provide an associative array with string keys, any value with a string
|
||||
key will be cast as follows:
|
||||
|
||||
PHP value | Predicate type
|
||||
--------- | --------------
|
||||
`null` | `Predicate\IsNull`
|
||||
`array` | `Predicate\In`
|
||||
`string` | `Predicate\Operator`, where the key is the identifier.
|
||||
|
||||
As an example:
|
||||
|
||||
```php
|
||||
// SELECT "foo".* FROM "foo" WHERE "c1" IS NULL AND "c2" IN (?, ?, ?) AND "c3" IS NOT NULL
|
||||
$select->from('foo')->where([
|
||||
'c1' => null,
|
||||
'c2' => [1, 2, 3],
|
||||
new \Zend\Db\Sql\Predicate\IsNotNull('c3'),
|
||||
]);
|
||||
```
|
||||
|
||||
As another example of complex queries with nested conditions e.g.
|
||||
|
||||
```sql
|
||||
SELECT * WHERE (column1 is null or column1 = 2) AND (column2 = 3)
|
||||
```
|
||||
|
||||
you need to use the `nest()` and `unnest()` methods, as follows:
|
||||
|
||||
```php
|
||||
$select->where->nest() // bracket opened
|
||||
->isNull('column1')
|
||||
->or
|
||||
->equalTo('column1', '2')
|
||||
->unnest(); // bracket closed
|
||||
->equalTo('column2', '3');
|
||||
```
|
||||
|
||||
### order()
|
||||
|
||||
```php
|
||||
$select = new Select;
|
||||
$select->order('id DESC'); // produces 'id' DESC
|
||||
|
||||
$select = new Select;
|
||||
$select
|
||||
->order('id DESC')
|
||||
->order('name ASC, age DESC'); // produces 'id' DESC, 'name' ASC, 'age' DESC
|
||||
|
||||
$select = new Select;
|
||||
$select->order(['name ASC', 'age DESC']); // produces 'name' ASC, 'age' DESC
|
||||
```
|
||||
|
||||
### limit() and offset()
|
||||
|
||||
```php
|
||||
$select = new Select;
|
||||
$select->limit(5); // always takes an integer/numeric
|
||||
$select->offset(10); // similarly takes an integer/numeric
|
||||
```
|
||||
|
||||
## Insert
|
||||
|
||||
The Insert API:
|
||||
|
||||
```php
|
||||
class Insert implements SqlInterface, PreparableSqlInterface
|
||||
{
|
||||
const VALUES_MERGE = 'merge';
|
||||
const VALUES_SET = 'set';
|
||||
|
||||
public function __construct(string|TableIdentifier $table = null);
|
||||
public function into(string|TableIdentifier $table) : self;
|
||||
public function columns(array $columns) : self;
|
||||
public function values(array $values, string $flag = self::VALUES_SET) : self;
|
||||
}
|
||||
```
|
||||
|
||||
As with `Select`, the table may be provided during instantiation or via the
|
||||
`into()` method.
|
||||
|
||||
### columns()
|
||||
|
||||
```php
|
||||
$insert->columns(['foo', 'bar']); // set the valid columns
|
||||
```
|
||||
|
||||
### values()
|
||||
|
||||
```php
|
||||
// The default behavior of values is to set the values;
|
||||
// successive calls will not preserve values from previous calls.
|
||||
$insert->values([
|
||||
'col_1' => 'value1',
|
||||
'col_2' => 'value2',
|
||||
]);
|
||||
```
|
||||
|
||||
```php
|
||||
// To merge values with previous calls, provide the appropriate flag:
|
||||
$insert->values(['col_2' => 'value2'], $insert::VALUES_MERGE);
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
```php
|
||||
class Update
|
||||
{
|
||||
const VALUES_MERGE = 'merge';
|
||||
const VALUES_SET = 'set';
|
||||
|
||||
public $where; // @param Where $where
|
||||
public function __construct(string|TableIdentifier $table = null);
|
||||
public function table(string|TableIdentifier $table) : self;
|
||||
public function set(array $values, string $flag = self::VALUES_SET) : self;
|
||||
public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self;
|
||||
}
|
||||
```
|
||||
|
||||
### set()
|
||||
|
||||
```php
|
||||
$update->set(['foo' => 'bar', 'baz' => 'bax']);
|
||||
```
|
||||
|
||||
### where()
|
||||
|
||||
See the [section on Where and Having](#where-and-having).
|
||||
|
||||
## Delete
|
||||
|
||||
```php
|
||||
class Delete
|
||||
{
|
||||
public $where; // @param Where $where
|
||||
|
||||
public function __construct(string|TableIdentifier $table = null);
|
||||
public function from(string|TableIdentifier $table);
|
||||
public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self;
|
||||
}
|
||||
```
|
||||
|
||||
### where()
|
||||
|
||||
See the [section on Where and Having](#where-and-having).
|
||||
|
||||
## Where and Having
|
||||
|
||||
In the following, we will talk about `Where`; note, however, that `Having`
|
||||
utilizes the same API.
|
||||
|
||||
Effectively, `Where` and `Having` extend from the same base object, a
|
||||
`Predicate` (and `PredicateSet`). All of the parts that make up a WHERE or
|
||||
HAVING clause that are AND'ed or OR'd together are called *predicates*. The
|
||||
full set of predicates is called a `PredicateSet`. A `Predicate` generally
|
||||
contains the values (and identifiers) separate from the fragment they belong to
|
||||
until the last possible moment when the statement is either prepared
|
||||
(parameteritized) or executed. In parameterization, the parameters will be
|
||||
replaced with their proper placeholder (a named or positional parameter), and
|
||||
the values stored inside an `Adapter\ParameterContainer`. When executed, the
|
||||
values will be interpolated into the fragments they belong to and properly
|
||||
quoted.
|
||||
|
||||
In the `Where`/`Having` API, a distinction is made between what elements are
|
||||
considered identifiers (`TYPE_IDENTIFIER`) and which are values (`TYPE_VALUE`).
|
||||
There is also a special use case type for literal values (`TYPE_LITERAL`). All
|
||||
element types are expressed via the `Zend\Db\Sql\ExpressionInterface`
|
||||
interface.
|
||||
|
||||
> ### Literals
|
||||
>
|
||||
> In ZF 2.1, an actual `Literal` type was added. `Zend\Db\Sql` now makes the
|
||||
> distinction that literals will not have any parameters that need
|
||||
> interpolating, while `Expression` objects *might* have parameters that need
|
||||
> interpolating. In cases where there are parameters in an `Expression`,
|
||||
> `Zend\Db\Sql\AbstractSql` will do its best to identify placeholders when the
|
||||
> `Expression` is processed during statement creation. In short, if you don't
|
||||
> have parameters, use `Literal` objects.
|
||||
|
||||
The `Where` and `Having` API is that of `Predicate` and `PredicateSet`:
|
||||
|
||||
```php
|
||||
// Where & Having extend Predicate:
|
||||
class Predicate extends PredicateSet
|
||||
{
|
||||
public $and;
|
||||
public $or;
|
||||
public $AND;
|
||||
public $OR;
|
||||
public $NEST;
|
||||
public $UNNEST;
|
||||
|
||||
public function nest() : Predicate;
|
||||
public function setUnnest(Predicate $predicate) : void;
|
||||
public function unnest() : Predicate;
|
||||
public function equalTo(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function notEqualTo(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function lessThan(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function greaterThan(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function lessThanOrEqualTo(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function greaterThanOrEqualTo(
|
||||
int|float|bool|string $left,
|
||||
int|float|bool|string $right,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
) : self;
|
||||
public function like(string $identifier, string $like) : self;
|
||||
public function notLike(string $identifier, string $notLike) : self;
|
||||
public function literal(string $literal) : self;
|
||||
public function expression(string $expression, array $parameters = null) : self;
|
||||
public function isNull(string $identifier) : self;
|
||||
public function isNotNull(string $identifier) : self;
|
||||
public function in(string $identifier, array $valueSet = []) : self;
|
||||
public function notIn(string $identifier, array $valueSet = []) : self;
|
||||
public function between(
|
||||
string $identifier,
|
||||
int|float|string $minValue,
|
||||
int|float|string $maxValue
|
||||
) : self;
|
||||
public function notBetween(
|
||||
string $identifier,
|
||||
int|float|string $minValue,
|
||||
int|float|string $maxValue
|
||||
) : self;
|
||||
public function predicate(PredicateInterface $predicate) : self;
|
||||
|
||||
// Inherited From PredicateSet
|
||||
|
||||
public function addPredicate(PredicateInterface $predicate, $combination = null) : self;
|
||||
public function getPredicates() PredicateInterface[];
|
||||
public function orPredicate(PredicateInterface $predicate) : self;
|
||||
public function andPredicate(PredicateInterface $predicate) : self;
|
||||
public function getExpressionData() : array;
|
||||
public function count() : int;
|
||||
}
|
||||
```
|
||||
|
||||
Each method in the API will produce a corresponding `Predicate` object of a similarly named
|
||||
type, as described below.
|
||||
|
||||
### equalTo(), lessThan(), greaterThan(), lessThanOrEqualTo(), greaterThanOrEqualTo()
|
||||
|
||||
```php
|
||||
$where->equalTo('id', 5);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\Operator($left, Operator::OPERATOR_EQUAL_TO, $right, $leftType, $rightType)
|
||||
);
|
||||
```
|
||||
|
||||
Operators use the following API:
|
||||
|
||||
```php
|
||||
class Operator implements PredicateInterface
|
||||
{
|
||||
const OPERATOR_EQUAL_TO = '=';
|
||||
const OP_EQ = '=';
|
||||
const OPERATOR_NOT_EQUAL_TO = '!=';
|
||||
const OP_NE = '!=';
|
||||
const OPERATOR_LESS_THAN = '<';
|
||||
const OP_LT = '<';
|
||||
const OPERATOR_LESS_THAN_OR_EQUAL_TO = '<=';
|
||||
const OP_LTE = '<=';
|
||||
const OPERATOR_GREATER_THAN = '>';
|
||||
const OP_GT = '>';
|
||||
const OPERATOR_GREATER_THAN_OR_EQUAL_TO = '>=';
|
||||
const OP_GTE = '>=';
|
||||
|
||||
public function __construct(
|
||||
int|float|bool|string $left = null,
|
||||
string $operator = self::OPERATOR_EQUAL_TO,
|
||||
int|float|bool|string $right = null,
|
||||
string $leftType = self::TYPE_IDENTIFIER,
|
||||
string $rightType = self::TYPE_VALUE
|
||||
);
|
||||
public function setLeft(int|float|bool|string $left);
|
||||
public function getLeft() : int|float|bool|string;
|
||||
public function setLeftType(string $type) : self;
|
||||
public function getLeftType() : string;
|
||||
public function setOperator(string $operator);
|
||||
public function getOperator() : string;
|
||||
public function setRight(int|float|bool|string $value) : self;
|
||||
public function getRight() : int|float|bool|string;
|
||||
public function setRightType(string $type) : self;
|
||||
public function getRightType() : string;
|
||||
public function getExpressionData() : array;
|
||||
}
|
||||
```
|
||||
|
||||
### like($identifier, $like), notLike($identifier, $notLike)
|
||||
|
||||
```php
|
||||
$where->like($identifier, $like):
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\Like($identifier, $like)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `Like` API:
|
||||
|
||||
```php
|
||||
class Like implements PredicateInterface
|
||||
{
|
||||
public function __construct(string $identifier = null, string $like = null);
|
||||
public function setIdentifier(string $identifier) : self;
|
||||
public function getIdentifier() : string;
|
||||
public function setLike(string $like) : self;
|
||||
public function getLike() : string;
|
||||
}
|
||||
```
|
||||
|
||||
### literal($literal)
|
||||
|
||||
```php
|
||||
$where->literal($literal);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\Literal($literal)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `Literal` API:
|
||||
|
||||
```php
|
||||
class Literal implements ExpressionInterface, PredicateInterface
|
||||
{
|
||||
const PLACEHOLDER = '?';
|
||||
public function __construct(string $literal = '');
|
||||
public function setLiteral(string $literal) : self;
|
||||
public function getLiteral() : string;
|
||||
}
|
||||
```
|
||||
|
||||
### expression($expression, $parameter)
|
||||
|
||||
```php
|
||||
$where->expression($expression, $parameter);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\Expression($expression, $parameter)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `Expression` API:
|
||||
|
||||
```php
|
||||
class Expression implements ExpressionInterface, PredicateInterface
|
||||
{
|
||||
const PLACEHOLDER = '?';
|
||||
|
||||
public function __construct(
|
||||
string $expression = null,
|
||||
int|float|bool|string|array $valueParameter = null
|
||||
/* [, $valueParameter, ... ] */
|
||||
);
|
||||
public function setExpression(string $expression) : self;
|
||||
public function getExpression() : string;
|
||||
public function setParameters(int|float|bool|string|array $parameters) : self;
|
||||
public function getParameters() : array;
|
||||
}
|
||||
```
|
||||
|
||||
### isNull($identifier)
|
||||
|
||||
```php
|
||||
$where->isNull($identifier);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\IsNull($identifier)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `IsNull` API:
|
||||
|
||||
```php
|
||||
class IsNull implements PredicateInterface
|
||||
{
|
||||
public function __construct(string $identifier = null);
|
||||
public function setIdentifier(string $identifier) : self;
|
||||
public function getIdentifier() : string;
|
||||
}
|
||||
```
|
||||
|
||||
### isNotNull($identifier)
|
||||
|
||||
```php
|
||||
$where->isNotNull($identifier);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\IsNotNull($identifier)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `IsNotNull` API:
|
||||
|
||||
```php
|
||||
class IsNotNull implements PredicateInterface
|
||||
{
|
||||
public function __construct(string $identifier = null);
|
||||
public function setIdentifier(string $identifier) : self;
|
||||
public function getIdentifier() : string;
|
||||
}
|
||||
```
|
||||
|
||||
### in($identifier, $valueSet), notIn($identifier, $valueSet)
|
||||
|
||||
```php
|
||||
$where->in($identifier, $valueSet);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\In($identifier, $valueSet)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `In` API:
|
||||
|
||||
```php
|
||||
class In implements PredicateInterface
|
||||
{
|
||||
public function __construct(
|
||||
string|array $identifier = null,
|
||||
array|Select $valueSet = null
|
||||
);
|
||||
public function setIdentifier(string|array $identifier) : self;
|
||||
public function getIdentifier() : string|array;
|
||||
public function setValueSet(array|Select $valueSet) : self;
|
||||
public function getValueSet() : array|Select;
|
||||
}
|
||||
```
|
||||
|
||||
### between($identifier, $minValue, $maxValue), notBetween($identifier, $minValue, $maxValue)
|
||||
|
||||
```php
|
||||
$where->between($identifier, $minValue, $maxValue);
|
||||
|
||||
// The above is equivalent to:
|
||||
$where->addPredicate(
|
||||
new Predicate\Between($identifier, $minValue, $maxValue)
|
||||
);
|
||||
```
|
||||
|
||||
The following is the `Between` API:
|
||||
|
||||
```php
|
||||
class Between implements PredicateInterface
|
||||
{
|
||||
public function __construct(
|
||||
string $identifier = null,
|
||||
int|float|string $minValue = null,
|
||||
int|float|string $maxValue = null
|
||||
);
|
||||
public function setIdentifier(string $identifier) : self;
|
||||
public function getIdentifier() : string;
|
||||
public function setMinValue(int|float|string $minValue) : self;
|
||||
public function getMinValue() : int|float|string;
|
||||
public function setMaxValue(int|float|string $maxValue) : self;
|
||||
public function getMaxValue() : int|float|string;
|
||||
public function setSpecification(string $specification);
|
||||
}
|
||||
```
|
217
bundled-libs/zendframework/zend-db/docs/book/table-gateway.md
Normal file
217
bundled-libs/zendframework/zend-db/docs/book/table-gateway.md
Normal file
@ -0,0 +1,217 @@
|
||||
# Table Gateways
|
||||
|
||||
The Table Gateway subcomponent provides an object-oriented representation of a
|
||||
database table; its methods mirror the most common table operations. In code,
|
||||
the interface resembles:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\TableGateway;
|
||||
|
||||
use Zend\Db\ResultSet\ResultSetInterface;
|
||||
use Zend\Db\Sql\Where;
|
||||
|
||||
interface TableGatewayInterface
|
||||
{
|
||||
public function getTable() : string;
|
||||
public function select(Where|callable|string|array $where = null) : ResultSetInterface;
|
||||
public function insert(array $set) : int;
|
||||
public function update(
|
||||
array $set,
|
||||
Where|callable|string|array $where = null,
|
||||
array $joins = null
|
||||
) : int;
|
||||
public function delete(Where|callable|string|array $where) : int;
|
||||
}
|
||||
```
|
||||
|
||||
There are two primary implementations of the `TableGatewayInterface`,
|
||||
`AbstractTableGateway` and `TableGateway`. The `AbstractTableGateway` is an
|
||||
abstract basic implementation that provides functionality for `select()`,
|
||||
`insert()`, `update()`, `delete()`, as well as an additional API for doing
|
||||
these same kinds of tasks with explicit `Zend\Db\Sql` objects: `selectWith()`,
|
||||
`insertWith()`, `updateWith()`, and `deleteWith()`. In addition,
|
||||
AbstractTableGateway also implements a "Feature" API, that allows for expanding
|
||||
the behaviors of the base `TableGateway` implementation without having to
|
||||
extend the class with this new functionality. The `TableGateway` concrete
|
||||
implementation simply adds a sensible constructor to the `AbstractTableGateway`
|
||||
class so that out-of-the-box, `TableGateway` does not need to be extended in
|
||||
order to be consumed and utilized to its fullest.
|
||||
|
||||
## Quick start
|
||||
|
||||
The following example uses `Zend\Db\TableGateway\TableGateway`, which defines
|
||||
the following API:
|
||||
|
||||
```php
|
||||
namespace Zend\Db\TableGateway;
|
||||
|
||||
use Zend\Db\Adapter\AdapterInterface;
|
||||
use Zend\Db\ResultSet\ResultSet;
|
||||
use Zend\Db\ResultSet\ResultSetInterface;
|
||||
use Zend\Db\Sql;
|
||||
use Zend\Db\Sql\TableIdentifier;
|
||||
|
||||
class TableGateway extends AbstractTableGateway
|
||||
{
|
||||
public $lastInsertValue;
|
||||
public $table;
|
||||
public $adapter;
|
||||
|
||||
public function __construct(
|
||||
string|TableIdentifier $table,
|
||||
AdapterInterface $adapter,
|
||||
Feature\AbstractFeature|Feature\FeatureSet|Feature\AbstractFeature[] $features = null,
|
||||
ResultSetInterface $resultSetPrototype = null,
|
||||
Sql\Sql $sql = null
|
||||
);
|
||||
|
||||
/** Inherited from AbstractTableGateway */
|
||||
|
||||
public function isInitialized() : bool;
|
||||
public function initialize() : void;
|
||||
public function getTable() : string;
|
||||
public function getAdapter() : AdapterInterface;
|
||||
public function getColumns() : array;
|
||||
public function getFeatureSet() Feature\FeatureSet;
|
||||
public function getResultSetPrototype() : ResultSetInterface;
|
||||
public function getSql() | Sql\Sql;
|
||||
public function select(Sql\Where|callable|string|array $where = null) : ResultSetInterface;
|
||||
public function selectWith(Sql\Select $select) : ResultSetInterface;
|
||||
public function insert(array $set) : int;
|
||||
public function insertWith(Sql\Insert $insert) | int;
|
||||
public function update(
|
||||
array $set,
|
||||
Sql\Where|callable|string|array $where = null,
|
||||
array $joins = null
|
||||
) : int;
|
||||
public function updateWith(Sql\Update $update) : int;
|
||||
public function delete(Sql\Where|callable|string|array $where) : int;
|
||||
public function deleteWith(Sql\Delete $delete) : int;
|
||||
public function getLastInsertValue() : int;
|
||||
}
|
||||
```
|
||||
|
||||
The concrete `TableGateway` object uses constructor injection for getting
|
||||
dependencies and options into the instance. The table name and an instance of
|
||||
an `Adapter` are all that is required to create an instance.
|
||||
|
||||
Out of the box, this implementation makes no assumptions about table structure
|
||||
or metadata, and when `select()` is executed, a simple `ResultSet` object with
|
||||
the populated `Adapter`'s `Result` (the datasource) will be returned and ready
|
||||
for iteration.
|
||||
|
||||
```php
|
||||
use Zend\Db\TableGateway\TableGateway;
|
||||
|
||||
$projectTable = new TableGateway('project', $adapter);
|
||||
$rowset = $projectTable->select(['type' => 'PHP']);
|
||||
|
||||
echo 'Projects of type PHP: ' . PHP_EOL;
|
||||
foreach ($rowset as $projectRow) {
|
||||
echo $projectRow['name'] . PHP_EOL;
|
||||
}
|
||||
|
||||
// Or, when expecting a single row:
|
||||
$artistTable = new TableGateway('artist', $adapter);
|
||||
$rowset = $artistTable->select(['id' => 2]);
|
||||
$artistRow = $rowset->current();
|
||||
|
||||
var_dump($artistRow);
|
||||
```
|
||||
|
||||
The `select()` method takes the same arguments as
|
||||
`Zend\Db\Sql\Select::where()`; arguments will be passed to the `Select`
|
||||
instance used to build the SELECT query. This means the following is possible:
|
||||
|
||||
```php
|
||||
use Zend\Db\TableGateway\TableGateway;
|
||||
use Zend\Db\Sql\Select;
|
||||
|
||||
$artistTable = new TableGateway('artist', $adapter);
|
||||
|
||||
// Search for at most 2 artists who's name starts with Brit, ascending:
|
||||
$rowset = $artistTable->select(function (Select $select) {
|
||||
$select->where->like('name', 'Brit%');
|
||||
$select->order('name ASC')->limit(2);
|
||||
});
|
||||
```
|
||||
|
||||
## TableGateway Features
|
||||
|
||||
The Features API allows for extending the functionality of the base
|
||||
`TableGateway` object without having to polymorphically extend the base class.
|
||||
This allows for a wider array of possible mixing and matching of features to
|
||||
achieve a particular behavior that needs to be attained to make the base
|
||||
implementation of `TableGateway` useful for a particular problem.
|
||||
|
||||
With the `TableGateway` object, features should be injected through the
|
||||
constructor. The constructor can take features in 3 different forms:
|
||||
|
||||
- as a single `Feature` instance
|
||||
- as a `FeatureSet` instance
|
||||
- as an array of `Feature` instances
|
||||
|
||||
There are a number of features built-in and shipped with zend-db:
|
||||
|
||||
- `GlobalAdapterFeature`: the ability to use a global/static adapter without
|
||||
needing to inject it into a `TableGateway` instance. This is only useful when
|
||||
you are extending the `AbstractTableGateway` implementation:
|
||||
|
||||
```php
|
||||
use Zend\Db\TableGateway\AbstractTableGateway;
|
||||
use Zend\Db\TableGateway\Feature;
|
||||
|
||||
class MyTableGateway extends AbstractTableGateway
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'my_table';
|
||||
$this->featureSet = new Feature\FeatureSet();
|
||||
$this->featureSet->addFeature(new Feature\GlobalAdapterFeature());
|
||||
$this->initialize();
|
||||
}
|
||||
}
|
||||
|
||||
// elsewhere in code, in a bootstrap
|
||||
Zend\Db\TableGateway\Feature\GlobalAdapterFeature::setStaticAdapter($adapter);
|
||||
|
||||
// in a controller, or model somewhere
|
||||
$table = new MyTableGateway(); // adapter is statically loaded
|
||||
```
|
||||
|
||||
- `MasterSlaveFeature`: the ability to use a master adapter for `insert()`,
|
||||
`update()`, and `delete()`, but switch to a slave adapter for all `select()`
|
||||
operations.
|
||||
|
||||
```php
|
||||
$table = new TableGateway('artist', $adapter, new Feature\MasterSlaveFeature($slaveAdapter));
|
||||
```
|
||||
|
||||
- `MetadataFeature`: the ability populate `TableGateway` with column
|
||||
information from a `Metadata` object. It will also store the primary key
|
||||
information in case the `RowGatewayFeature` needs to consume this information.
|
||||
|
||||
```php
|
||||
$table = new TableGateway('artist', $adapter, new Feature\MetadataFeature());
|
||||
```
|
||||
|
||||
- `EventFeature`: the ability to compose a
|
||||
[zend-eventmanager](https://github.com/zendframework/zend-eventmanager)
|
||||
`EventManager` instance within your `TableGateway` instance, and attach
|
||||
listeners to the various events of its lifecycle.
|
||||
|
||||
```php
|
||||
$table = new TableGateway('artist', $adapter, new Feature\EventFeature($eventManagerInstance));
|
||||
```
|
||||
|
||||
- `RowGatewayFeature`: the ability for `select()` to return a `ResultSet` object that upon iteration
|
||||
will return a `RowGateway` instance for each row.
|
||||
|
||||
```php
|
||||
$table = new TableGateway('artist', $adapter, new Feature\RowGatewayFeature('id'));
|
||||
$results = $table->select(['id' => 2]);
|
||||
|
||||
$artistRow = $results->current();
|
||||
$artistRow->name = 'New Name';
|
||||
$artistRow->save();
|
||||
```
|
11
bundled-libs/zendframework/zend-db/phpcs.xml
Normal file
11
bundled-libs/zendframework/zend-db/phpcs.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Zend Framework coding standard">
|
||||
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml" />
|
||||
<rule ref="PSR1.Files.SideEffects">
|
||||
<exclude-pattern>*/test/unit/Adapter/Driver/IbmDb2/StatementTest.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<!-- Paths to check -->
|
||||
<file>src</file>
|
||||
<file>test</file>
|
||||
</ruleset>
|
@ -3,7 +3,7 @@
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -67,10 +67,14 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
* @param Profiler\ProfilerInterface $profiler
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
public function __construct($driver, Platform\PlatformInterface $platform = null, ResultSet\ResultSetInterface $queryResultPrototype = null, Profiler\ProfilerInterface $profiler = null)
|
||||
{
|
||||
public function __construct(
|
||||
$driver,
|
||||
Platform\PlatformInterface $platform = null,
|
||||
ResultSet\ResultSetInterface $queryResultPrototype = null,
|
||||
Profiler\ProfilerInterface $profiler = null
|
||||
) {
|
||||
// first argument can be an array of parameters
|
||||
$parameters = array();
|
||||
$parameters = [];
|
||||
|
||||
if (is_array($driver)) {
|
||||
$parameters = $driver;
|
||||
@ -78,7 +82,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
$profiler = $this->createProfiler($parameters);
|
||||
}
|
||||
$driver = $this->createDriver($parameters);
|
||||
} elseif (!$driver instanceof Driver\DriverInterface) {
|
||||
} elseif (! $driver instanceof Driver\DriverInterface) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'The supplied or instantiated driver object does not implement Zend\Db\Adapter\Driver\DriverInterface'
|
||||
);
|
||||
@ -87,7 +91,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
$driver->checkEnvironment();
|
||||
$this->driver = $driver;
|
||||
|
||||
if ($platform == null) {
|
||||
if ($platform === null) {
|
||||
$platform = $this->createPlatform($parameters);
|
||||
}
|
||||
|
||||
@ -101,7 +105,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
|
||||
/**
|
||||
* @param Profiler\ProfilerInterface $profiler
|
||||
* @return Adapter
|
||||
* @return self Provides a fluent interface
|
||||
*/
|
||||
public function setProfiler(Profiler\ProfilerInterface $profiler)
|
||||
{
|
||||
@ -128,7 +132,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
*/
|
||||
public function getDriver()
|
||||
{
|
||||
if ($this->driver == null) {
|
||||
if ($this->driver === null) {
|
||||
throw new Exception\RuntimeException('Driver has not been set or configured for this adapter.');
|
||||
}
|
||||
return $this->driver;
|
||||
@ -160,19 +164,27 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
*
|
||||
* @param string $sql
|
||||
* @param string|array|ParameterContainer $parametersOrQueryMode
|
||||
* @param \Zend\Db\ResultSet\ResultSetInterface $resultPrototype
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return Driver\StatementInterface|ResultSet\ResultSet
|
||||
*/
|
||||
public function query($sql, $parametersOrQueryMode = self::QUERY_MODE_PREPARE)
|
||||
{
|
||||
if (is_string($parametersOrQueryMode) && in_array($parametersOrQueryMode, array(self::QUERY_MODE_PREPARE, self::QUERY_MODE_EXECUTE))) {
|
||||
public function query(
|
||||
$sql,
|
||||
$parametersOrQueryMode = self::QUERY_MODE_PREPARE,
|
||||
ResultSet\ResultSetInterface $resultPrototype = null
|
||||
) {
|
||||
if (is_string($parametersOrQueryMode)
|
||||
&& in_array($parametersOrQueryMode, [self::QUERY_MODE_PREPARE, self::QUERY_MODE_EXECUTE])
|
||||
) {
|
||||
$mode = $parametersOrQueryMode;
|
||||
$parameters = null;
|
||||
} elseif (is_array($parametersOrQueryMode) || $parametersOrQueryMode instanceof ParameterContainer) {
|
||||
$mode = self::QUERY_MODE_PREPARE;
|
||||
$parameters = $parametersOrQueryMode;
|
||||
} else {
|
||||
throw new Exception\InvalidArgumentException('Parameter 2 to this method must be a flag, an array, or ParameterContainer');
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Parameter 2 to this method must be a flag, an array, or ParameterContainer'
|
||||
);
|
||||
}
|
||||
|
||||
if ($mode == self::QUERY_MODE_PREPARE) {
|
||||
@ -180,7 +192,11 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
$this->lastPreparedStatement = $this->driver->createStatement($sql);
|
||||
$this->lastPreparedStatement->prepare();
|
||||
if (is_array($parameters) || $parameters instanceof ParameterContainer) {
|
||||
$this->lastPreparedStatement->setParameterContainer((is_array($parameters)) ? new ParameterContainer($parameters) : $parameters);
|
||||
if (is_array($parameters)) {
|
||||
$this->lastPreparedStatement->setParameterContainer(new ParameterContainer($parameters));
|
||||
} else {
|
||||
$this->lastPreparedStatement->setParameterContainer($parameters);
|
||||
}
|
||||
$result = $this->lastPreparedStatement->execute();
|
||||
} else {
|
||||
return $this->lastPreparedStatement;
|
||||
@ -190,7 +206,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
}
|
||||
|
||||
if ($result instanceof Driver\ResultInterface && $result->isQueryResult()) {
|
||||
$resultSet = clone $this->queryResultSetPrototype;
|
||||
$resultSet = clone ($resultPrototype ?: $this->queryResultSetPrototype);
|
||||
$resultSet->initialize($result);
|
||||
return $resultSet;
|
||||
}
|
||||
@ -208,26 +224,32 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
public function createStatement($initialSql = null, $initialParameters = null)
|
||||
{
|
||||
$statement = $this->driver->createStatement($initialSql);
|
||||
if ($initialParameters == null || !$initialParameters instanceof ParameterContainer && is_array($initialParameters)) {
|
||||
$initialParameters = new ParameterContainer((is_array($initialParameters) ? $initialParameters : array()));
|
||||
if ($initialParameters === null
|
||||
|| ! $initialParameters instanceof ParameterContainer
|
||||
&& is_array($initialParameters)
|
||||
) {
|
||||
$initialParameters = new ParameterContainer((is_array($initialParameters) ? $initialParameters : []));
|
||||
}
|
||||
$statement->setParameterContainer($initialParameters);
|
||||
return $statement;
|
||||
}
|
||||
|
||||
public function getHelpers(/* $functions */)
|
||||
public function getHelpers()
|
||||
{
|
||||
$functions = array();
|
||||
$functions = [];
|
||||
$platform = $this->platform;
|
||||
foreach (func_get_args() as $arg) {
|
||||
switch ($arg) {
|
||||
case self::FUNCTION_QUOTE_IDENTIFIER:
|
||||
$functions[] = function ($value) use ($platform) { return $platform->quoteIdentifier($value); };
|
||||
$functions[] = function ($value) use ($platform) {
|
||||
return $platform->quoteIdentifier($value);
|
||||
};
|
||||
break;
|
||||
case self::FUNCTION_QUOTE_VALUE:
|
||||
$functions[] = function ($value) use ($platform) { return $platform->quoteValue($value); };
|
||||
$functions[] = function ($value) use ($platform) {
|
||||
return $platform->quoteValue($value);
|
||||
};
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,7 +269,6 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
default:
|
||||
throw new Exception\InvalidArgumentException('Invalid magic property on adapter');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,19 +279,23 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
*/
|
||||
protected function createDriver($parameters)
|
||||
{
|
||||
if (!isset($parameters['driver'])) {
|
||||
throw new Exception\InvalidArgumentException(__FUNCTION__ . ' expects a "driver" key to be present inside the parameters');
|
||||
if (! isset($parameters['driver'])) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
__FUNCTION__ . ' expects a "driver" key to be present inside the parameters'
|
||||
);
|
||||
}
|
||||
|
||||
if ($parameters['driver'] instanceof Driver\DriverInterface) {
|
||||
return $parameters['driver'];
|
||||
}
|
||||
|
||||
if (!is_string($parameters['driver'])) {
|
||||
throw new Exception\InvalidArgumentException(__FUNCTION__ . ' expects a "driver" to be a string or instance of DriverInterface');
|
||||
if (! is_string($parameters['driver'])) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
__FUNCTION__ . ' expects a "driver" to be a string or instance of DriverInterface'
|
||||
);
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$options = [];
|
||||
if (isset($parameters['options'])) {
|
||||
$options = (array) $parameters['options'];
|
||||
unset($parameters['options']);
|
||||
@ -300,7 +325,7 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($driver) || !$driver instanceof Driver\DriverInterface) {
|
||||
if (! isset($driver) || ! $driver instanceof Driver\DriverInterface) {
|
||||
throw new Exception\InvalidArgumentException('DriverInterface expected', null, null);
|
||||
}
|
||||
|
||||
@ -308,39 +333,56 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Driver\DriverInterface $driver
|
||||
* @param array $parameters
|
||||
* @return Platform\PlatformInterface
|
||||
*/
|
||||
protected function createPlatform($parameters)
|
||||
protected function createPlatform(array $parameters)
|
||||
{
|
||||
if (isset($parameters['platform'])) {
|
||||
$platformName = $parameters['platform'];
|
||||
} elseif ($this->driver instanceof Driver\DriverInterface) {
|
||||
$platformName = $this->driver->getDatabasePlatformName(Driver\DriverInterface::NAME_FORMAT_CAMELCASE);
|
||||
} else {
|
||||
throw new Exception\InvalidArgumentException('A platform could not be determined from the provided configuration');
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'A platform could not be determined from the provided configuration'
|
||||
);
|
||||
}
|
||||
|
||||
// currently only supported by the IbmDb2 & Oracle concrete implementations
|
||||
$options = (isset($parameters['platform_options'])) ? $parameters['platform_options'] : array();
|
||||
$options = (isset($parameters['platform_options'])) ? $parameters['platform_options'] : [];
|
||||
|
||||
switch ($platformName) {
|
||||
case 'Mysql':
|
||||
// mysqli or pdo_mysql driver
|
||||
$driver = ($this->driver instanceof Driver\Mysqli\Mysqli || $this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null;
|
||||
if ($this->driver instanceof Driver\Mysqli\Mysqli || $this->driver instanceof Driver\Pdo\Pdo) {
|
||||
$driver = $this->driver;
|
||||
} else {
|
||||
$driver = null;
|
||||
}
|
||||
return new Platform\Mysql($driver);
|
||||
case 'SqlServer':
|
||||
// PDO is only supported driver for quoting values in this platform
|
||||
return new Platform\SqlServer(($this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null);
|
||||
case 'Oracle':
|
||||
// oracle does not accept a driver as an option, no driver specific quoting available
|
||||
return new Platform\Oracle($options);
|
||||
if ($this->driver instanceof Driver\Oci8\Oci8 || $this->driver instanceof Driver\Pdo\Pdo) {
|
||||
$driver = $this->driver;
|
||||
} else {
|
||||
$driver = null;
|
||||
}
|
||||
return new Platform\Oracle($options, $driver);
|
||||
case 'Sqlite':
|
||||
// PDO is only supported driver for quoting values in this platform
|
||||
return new Platform\Sqlite(($this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null);
|
||||
if ($this->driver instanceof Driver\Pdo\Pdo) {
|
||||
return new Platform\Sqlite($this->driver);
|
||||
}
|
||||
return new Platform\Sqlite(null);
|
||||
case 'Postgresql':
|
||||
// pgsql or pdo postgres driver
|
||||
$driver = ($this->driver instanceof Driver\Pgsql\Pgsql || $this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null;
|
||||
if ($this->driver instanceof Driver\Pgsql\Pgsql || $this->driver instanceof Driver\Pdo\Pdo) {
|
||||
$driver = $this->driver;
|
||||
} else {
|
||||
$driver = null;
|
||||
}
|
||||
return new Platform\Postgresql($driver);
|
||||
case 'IbmDb2':
|
||||
// ibm_db2 driver escaping does not need an action connection
|
||||
@ -350,6 +392,12 @@ class Adapter implements AdapterInterface, Profiler\ProfilerAwareInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $parameters
|
||||
* @return Profiler\ProfilerInterface
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
protected function createProfiler($parameters)
|
||||
{
|
||||
if ($parameters['profiler'] instanceof Profiler\ProfilerInterface) {
|
@ -3,12 +3,13 @@
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter;
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Zend\ServiceManager\AbstractFactoryInterface;
|
||||
use Zend\ServiceManager\ServiceLocatorInterface;
|
||||
|
||||
@ -27,14 +28,13 @@ class AdapterAbstractServiceFactory implements AbstractFactoryInterface
|
||||
/**
|
||||
* Can we create an adapter by the requested name?
|
||||
*
|
||||
* @param ServiceLocatorInterface $services
|
||||
* @param string $name
|
||||
* @param ContainerInterface $container
|
||||
* @param string $requestedName
|
||||
* @return bool
|
||||
*/
|
||||
public function canCreateServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
|
||||
public function canCreate(ContainerInterface $container, $requestedName)
|
||||
{
|
||||
$config = $this->getConfig($services);
|
||||
$config = $this->getConfig($container);
|
||||
if (empty($config)) {
|
||||
return false;
|
||||
}
|
||||
@ -42,54 +42,80 @@ class AdapterAbstractServiceFactory implements AbstractFactoryInterface
|
||||
return (
|
||||
isset($config[$requestedName])
|
||||
&& is_array($config[$requestedName])
|
||||
&& !empty($config[$requestedName])
|
||||
&& ! empty($config[$requestedName])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if we can create a service with name (SM v2 compatibility)
|
||||
*
|
||||
* @param ServiceLocatorInterface $serviceLocator
|
||||
* @param string $name
|
||||
* @param string $requestedName
|
||||
* @return bool
|
||||
*/
|
||||
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
|
||||
{
|
||||
return $this->canCreate($serviceLocator, $requestedName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a DB adapter
|
||||
*
|
||||
* @param ServiceLocatorInterface $services
|
||||
* @param string $name
|
||||
* @param ContainerInterface $container
|
||||
* @param string $requestedName
|
||||
* @param array $options
|
||||
* @return Adapter
|
||||
*/
|
||||
public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
|
||||
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
|
||||
{
|
||||
$config = $this->getConfig($services);
|
||||
$config = $this->getConfig($container);
|
||||
return new Adapter($config[$requestedName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create service with name
|
||||
*
|
||||
* @param ServiceLocatorInterface $serviceLocator
|
||||
* @param string $name
|
||||
* @param string $requestedName
|
||||
* @return Adapter
|
||||
*/
|
||||
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
|
||||
{
|
||||
return $this($serviceLocator, $requestedName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get db configuration, if any
|
||||
*
|
||||
* @param ServiceLocatorInterface $services
|
||||
* @param ContainerInterface $container
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfig(ServiceLocatorInterface $services)
|
||||
protected function getConfig(ContainerInterface $container)
|
||||
{
|
||||
if ($this->config !== null) {
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
if (!$services->has('Config')) {
|
||||
$this->config = array();
|
||||
if (! $container->has('config')) {
|
||||
$this->config = [];
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
$config = $services->get('Config');
|
||||
if (!isset($config['db'])
|
||||
|| !is_array($config['db'])
|
||||
$config = $container->get('config');
|
||||
if (! isset($config['db'])
|
||||
|| ! is_array($config['db'])
|
||||
) {
|
||||
$this->config = array();
|
||||
$this->config = [];
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
$config = $config['db'];
|
||||
if (!isset($config['adapters'])
|
||||
|| !is_array($config['adapters'])
|
||||
if (! isset($config['adapters'])
|
||||
|| ! is_array($config['adapters'])
|
||||
) {
|
||||
$this->config = array();
|
||||
$this->config = [];
|
||||
return $this->config;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -3,14 +3,12 @@
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter;
|
||||
|
||||
use Zend\Db\Adapter\Adapter;
|
||||
|
||||
trait AdapterAwareTrait
|
||||
{
|
||||
/**
|
||||
@ -22,7 +20,7 @@ trait AdapterAwareTrait
|
||||
* Set db adapter
|
||||
*
|
||||
* @param Adapter $adapter
|
||||
* @return mixed
|
||||
* @return self Provides a fluent interface
|
||||
*/
|
||||
public function setDbAdapter(Adapter $adapter)
|
||||
{
|
@ -3,7 +3,7 @@
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -25,5 +25,4 @@ interface AdapterInterface
|
||||
* @return Platform\PlatformInterface
|
||||
*/
|
||||
public function getPlatform();
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Db\Adapter;
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Zend\ServiceManager\FactoryInterface;
|
||||
use Zend\ServiceManager\ServiceLocatorInterface;
|
||||
|
||||
class AdapterServiceFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Create db adapter service
|
||||
*
|
||||
* @param ContainerInterface $container
|
||||
* @param string $requestedName
|
||||
* @param array $options
|
||||
* @return Adapter
|
||||
*/
|
||||
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
|
||||
{
|
||||
$config = $container->get('config');
|
||||
return new Adapter($config['db']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create db adapter service (v2)
|
||||
*
|
||||
* @param ServiceLocatorInterface $container
|
||||
* @return Adapter
|
||||
*/
|
||||
public function createService(ServiceLocatorInterface $container)
|
||||
{
|
||||
return $this($container, Adapter::class);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user