Raw.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace think\db;
  13. /**
  14. * SQL Raw
  15. */
  16. class Raw
  17. {
  18. /**
  19. * 查询表达式
  20. *
  21. * @var string
  22. */
  23. protected $value;
  24. /**
  25. * 参数绑定
  26. *
  27. * @var array
  28. */
  29. protected $bind = [];
  30. /**
  31. * 创建一个查询表达式
  32. *
  33. * @param string $value
  34. * @param array $bind
  35. * @return void
  36. */
  37. public function __construct(string $value, array $bind = [])
  38. {
  39. $this->value = $value;
  40. $this->bind = $bind;
  41. }
  42. /**
  43. * 获取表达式
  44. *
  45. * @return string
  46. */
  47. public function getValue(): string
  48. {
  49. return $this->value;
  50. }
  51. /**
  52. * 获取参数绑定
  53. *
  54. * @return string
  55. */
  56. public function getBind(): array
  57. {
  58. return $this->bind;
  59. }
  60. }