1
0

IFunctionBuilder.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
  4. *
  5. * @author Robin Appelman <robin@icewind.nl>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCP\DB\QueryBuilder;
  24. /**
  25. * This class provides a builder for sql some functions
  26. *
  27. * @since 12.0.0
  28. */
  29. interface IFunctionBuilder {
  30. /**
  31. * Calculates the MD5 hash of a given input
  32. *
  33. * @param mixed $input The input to be hashed
  34. *
  35. * @return IQueryFunction
  36. * @since 12.0.0
  37. */
  38. public function md5($input);
  39. /**
  40. * Combines two input strings
  41. *
  42. * @param mixed $x The first input string
  43. * @param mixed $y The seccond input string
  44. *
  45. * @return IQueryFunction
  46. * @since 12.0.0
  47. */
  48. public function concat($x, $y);
  49. /**
  50. * Takes a substring from the input string
  51. *
  52. * @param mixed $input The input string
  53. * @param mixed $start The start of the substring, note that counting starts at 1
  54. * @param mixed $length The length of the substring
  55. *
  56. * @return IQueryFunction
  57. * @since 12.0.0
  58. */
  59. public function substring($input, $start, $length = null);
  60. /**
  61. * Takes the sum of all rows in a column
  62. *
  63. * @param mixed $field the column to sum
  64. *
  65. * @return IQueryFunction
  66. * @since 12.0.0
  67. */
  68. public function sum($field);
  69. /**
  70. * Transforms a string field or value to lower case
  71. *
  72. * @param mixed $field
  73. * @return IQueryFunction
  74. * @since 14.0.0
  75. */
  76. public function lower($field);
  77. /**
  78. * @param mixed $x The first input field or number
  79. * @param mixed $y The second input field or number
  80. * @return IQueryFunction
  81. * @since 14.0.0
  82. */
  83. public function add($x, $y);
  84. /**
  85. * @param mixed $x The first input field or number
  86. * @param mixed $y The second input field or number
  87. * @return IQueryFunction
  88. * @since 14.0.0
  89. */
  90. public function subtract($x, $y);
  91. /**
  92. * @param mixed $count The input to be counted
  93. * @param string $alias Alias for the counter
  94. *
  95. * @return IQueryFunction
  96. * @since 14.0.0
  97. */
  98. public function count($count, $alias = '');
  99. }