The clean & modern RSS server that doesn't give you any crap. https://thearsse.com/
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.

TestStatement.php 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /** @license MIT
  3. * Copyright 2017 J. King, Dustin Wilson et al.
  4. * See LICENSE and AUTHORS files for details */
  5. declare(strict_types=1);
  6. namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
  7. /**
  8. * @covers \JKingWeb\Arsse\Db\PostgreSQL\PDOStatement<extended>
  9. * @covers \JKingWeb\Arsse\Db\PDOError */
  10. class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
  11. protected static $implementation = "PDO PostgreSQL";
  12. protected function makeStatement(string $q, array $types = []): array {
  13. return [static::$interface, $q, $types];
  14. }
  15. protected function decorateTypeSyntax(string $value, string $type): string {
  16. switch ($type) {
  17. case "float":
  18. return (substr($value, -2)==".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
  19. case "string":
  20. if (preg_match("<^char\((\d+)\)$>", $value, $match)) {
  21. return "U&'\\+".str_pad(dechex((int) $match[1]), 6, "0", \STR_PAD_LEFT)."'";
  22. }
  23. return $value;
  24. default:
  25. return $value;
  26. }
  27. }
  28. }