AbstractSqlExecutor.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the LGPL. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\ORM\Query\Exec;
  20. use Doctrine\DBAL\Connection;
  21. use Doctrine\DBAL\Cache\QueryCacheProfile;
  22. /**
  23. * Base class for SQL statement executors.
  24. *
  25. * @author Roman Borschel <roman@code-factory.org>
  26. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  27. * @link http://www.doctrine-project.org
  28. * @since 2.0
  29. * @todo Rename: AbstractSQLExecutor
  30. */
  31. abstract class AbstractSqlExecutor
  32. {
  33. /**
  34. * @var array
  35. */
  36. protected $_sqlStatements;
  37. /**
  38. * @var QueryCacheProfile
  39. */
  40. protected $queryCacheProfile;
  41. /**
  42. * Gets the SQL statements that are executed by the executor.
  43. *
  44. * @return array All the SQL update statements.
  45. */
  46. public function getSqlStatements()
  47. {
  48. return $this->_sqlStatements;
  49. }
  50. public function setQueryCacheProfile(QueryCacheProfile $qcp)
  51. {
  52. $this->queryCacheProfile = $qcp;
  53. }
  54. /**
  55. * Executes all sql statements.
  56. *
  57. * @param \Doctrine\DBAL\Connection $conn The database connection that is used to execute the queries.
  58. * @param array $params The parameters.
  59. * @param array $types The parameter types.
  60. * @return \Doctrine\DBAL\Driver\Statement
  61. */
  62. abstract public function execute(Connection $conn, array $params, array $types);
  63. }