Processor.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Illuminate\Database\Query\Processors;
  3. use Illuminate\Database\Query\Builder;
  4. class Processor
  5. {
  6. /**
  7. * Process the results of a "select" query.
  8. *
  9. * @param \Illuminate\Database\Query\Builder $query
  10. * @param array $results
  11. * @return array
  12. */
  13. public function processSelect(Builder $query, $results)
  14. {
  15. return $results;
  16. }
  17. /**
  18. * Process an "insert get ID" query.
  19. *
  20. * @param \Illuminate\Database\Query\Builder $query
  21. * @param string $sql
  22. * @param array $values
  23. * @param string $sequence
  24. * @return int
  25. */
  26. public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
  27. {
  28. $query->getConnection()->insert($sql, $values);
  29. $id = $query->getConnection()->getPdo()->lastInsertId($sequence);
  30. return is_numeric($id) ? (int) $id : $id;
  31. }
  32. /**
  33. * Process the results of a column listing query.
  34. *
  35. * @param array $results
  36. * @return array
  37. */
  38. public function processColumnListing($results)
  39. {
  40. return $results;
  41. }
  42. }