You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

idbconnection.php 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Bart Visscher
  6. * @copyright 2013 Bart Visscher bartv@thisnet.nl
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Public interface of ownCloud for apps to use.
  24. * DBConnection interface
  25. *
  26. */
  27. // use OCP namespace for all classes that are considered public.
  28. // This means that they should be used by apps instead of the internal ownCloud classes
  29. namespace OCP;
  30. /**
  31. * TODO: Description
  32. */
  33. interface IDBConnection {
  34. /**
  35. * Used to abstract the owncloud database access away
  36. * @param string $sql the sql query with ? placeholder for params
  37. * @param int $limit the maximum number of rows
  38. * @param int $offset from which row we want to start
  39. * @return \Doctrine\DBAL\Driver\Statement The prepared statement.
  40. */
  41. public function prepare($sql, $limit=null, $offset=null);
  42. /**
  43. * Used to get the id of the just inserted element
  44. * @param string $table the name of the table where we inserted the item
  45. * @return int the id of the inserted element
  46. */
  47. public function lastInsertId($table = null);
  48. /**
  49. * Insert a row if a matching row doesn't exists.
  50. * @param string The table name (will replace *PREFIX*) to perform the replace on.
  51. * @param array
  52. *
  53. * The input array if in the form:
  54. *
  55. * array ( 'id' => array ( 'value' => 6,
  56. * 'key' => true
  57. * ),
  58. * 'name' => array ('value' => 'Stoyan'),
  59. * 'family' => array ('value' => 'Stefanov'),
  60. * 'birth_date' => array ('value' => '1975-06-20')
  61. * );
  62. * @return bool
  63. *
  64. */
  65. public function insertIfNotExist($table, $input);
  66. /**
  67. * Start a transaction
  68. * @return bool TRUE on success or FALSE on failure
  69. */
  70. public function beginTransaction();
  71. /**
  72. * Commit the database changes done during a transaction that is in progress
  73. * @return bool TRUE on success or FALSE on failure
  74. */
  75. public function commit();
  76. /**
  77. * Rollback the database changes done during a transaction that is in progress
  78. * @return bool TRUE on success or FALSE on failure
  79. */
  80. public function rollBack();
  81. /**
  82. * Gets the error code and message as a string for logging
  83. * @return string
  84. */
  85. public function getError();
  86. }