Array ( )
Illuminate\Database\QueryException {#27 +errorInfo: array:3 [ 0 => "42P01" 1 => 7 2 => """ ERROR: relation "masjid" does not exist\n LINE 1: select count(*) as aggregate from "masjid"\n ^ """ ] +connectionName: "pgsql" #sql: "select count(*) as aggregate from "masjid"" #bindings: [] }
throw new UniqueConstraintViolationException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } throw new QueryException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } } // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param bool $useReadPdo * @return array */ public function select($query, $bindings = [], $useReadPdo = true) { return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { if ($this->pretending()) { return []; } // For select statements, we'll simply execute the query and return an array * * @return array */ protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), ! $this->useWritePdo ); } /** * @return \Illuminate\Support\Collection */ public function get($columns = ['*']) { return collect($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); } /** * Run the query as a "select" statement against the connection. if (is_null($original)) { $this->columns = $columns; } $result = $callback(); $this->columns = $original; return $result; } * @param array|string $columns * @return \Illuminate\Support\Collection */ public function get($columns = ['*']) { return collect($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); } /** public function aggregate($function, $columns = ['*']) { $results = $this->cloneWithout($this->unions || $this->havings ? [] : ['columns']) ->cloneWithoutBindings($this->unions || $this->havings ? [] : ['select']) ->setAggregate($function, $columns) ->get($columns); if (! $results->isEmpty()) { return array_change_key_case((array) $results[0])['aggregate']; } } * @param \Illuminate\Contracts\Database\Query\Expression|string $columns * @return int */ public function count($columns = '*') { return (int) $this->aggregate(__FUNCTION__, Arr::wrap($columns)); } /** * Retrieve the minimum value of a given column. *<?phprequire 'vendor/autoload.php';$app = require 'bootstrap/app.php';print_r(Illuminate\Support\Facades\Schema::getColumnListing('masjid'));$count = Illuminate\Support\Facades\DB::table('masjid')->count();echo "Total masjids: $count\n"; $this->getPdoForSelect($useReadPdo)->prepare($query) ); $this->bindValues($statement, $this->prepareBindings($bindings)); $statement->execute(); return $statement->fetchAll(); }); } $this->getPdoForSelect($useReadPdo)->prepare($query) ); $this->bindValues($statement, $this->prepareBindings($bindings)); $statement->execute(); return $statement->fetchAll(); }); } { // To execute the statement, we'll simply call the callback, which will actually // run the SQL against the PDO connection. Then we can calculate the time it // took to execute and log the query SQL, bindings and time in our memory. try { return $callback($query, $bindings); } // If an exception occurs when attempting to run a query, we'll format the error // message to include the bindings with SQL, which will make this exception a // lot more helpful to the developer instead of just the database's errors. // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param bool $useReadPdo * @return array */ public function select($query, $bindings = [], $useReadPdo = true) { return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { if ($this->pretending()) { return []; } // For select statements, we'll simply execute the query and return an array * * @return array */ protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), ! $this->useWritePdo ); } /** * @return \Illuminate\Support\Collection */ public function get($columns = ['*']) { return collect($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); } /** * Run the query as a "select" statement against the connection. if (is_null($original)) { $this->columns = $columns; } $result = $callback(); $this->columns = $original; return $result; } * @param array|string $columns * @return \Illuminate\Support\Collection */ public function get($columns = ['*']) { return collect($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); } /** public function aggregate($function, $columns = ['*']) { $results = $this->cloneWithout($this->unions || $this->havings ? [] : ['columns']) ->cloneWithoutBindings($this->unions || $this->havings ? [] : ['select']) ->setAggregate($function, $columns) ->get($columns); if (! $results->isEmpty()) { return array_change_key_case((array) $results[0])['aggregate']; } } * @param \Illuminate\Contracts\Database\Query\Expression|string $columns * @return int */ public function count($columns = '*') { return (int) $this->aggregate(__FUNCTION__, Arr::wrap($columns)); } /** * Retrieve the minimum value of a given column. *<?phprequire 'vendor/autoload.php';$app = require 'bootstrap/app.php';print_r(Illuminate\Support\Facades\Schema::getColumnListing('masjid'));$count = Illuminate\Support\Facades\DB::table('masjid')->count();echo "Total masjids: $count\n";|
[2/2]
QueryException
|
|---|
Illuminate\Database\QueryException:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "masjid" does not exist
LINE 1: select count(*) as aggregate from "masjid"
^ (Connection: pgsql, SQL: select count(*) as aggregate from "masjid")
at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:829
at Illuminate\Database\Connection->runQueryCallback('select count(*) as aggregate from "masjid"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
at Illuminate\Database\Connection->run('select count(*) as aggregate from "masjid"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:414)
at Illuminate\Database\Connection->select('select count(*) as aggregate from "masjid"', array(), true)
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2913)
at Illuminate\Database\Query\Builder->runSelect()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2902)
at Illuminate\Database\Query\Builder->{closure:Illuminate\Database\Query\Builder::get():2901}()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3456)
at Illuminate\Database\Query\Builder->onceWithColumns(array('*'), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2901)
at Illuminate\Database\Query\Builder->get(array('*'))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3383)
at Illuminate\Database\Query\Builder->aggregate('count', array('*'))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3311)
at Illuminate\Database\Query\Builder->count()
(/home/vzizxmil/public_html/banyal-connect-api/check_masjid_table.php:5)
|
|
[1/2]
PDOException
|
|---|
PDOException:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "masjid" does not exist
LINE 1: select count(*) as aggregate from "masjid"
^
at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:428
at PDOStatement->execute()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:428)
at Illuminate\Database\Connection->{closure:Illuminate\Database\Connection::select():414}('select count(*) as aggregate from "masjid"', array())
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:816)
at Illuminate\Database\Connection->runQueryCallback('select count(*) as aggregate from "masjid"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
at Illuminate\Database\Connection->run('select count(*) as aggregate from "masjid"', array(), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:414)
at Illuminate\Database\Connection->select('select count(*) as aggregate from "masjid"', array(), true)
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2913)
at Illuminate\Database\Query\Builder->runSelect()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2902)
at Illuminate\Database\Query\Builder->{closure:Illuminate\Database\Query\Builder::get():2901}()
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3456)
at Illuminate\Database\Query\Builder->onceWithColumns(array('*'), object(Closure))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:2901)
at Illuminate\Database\Query\Builder->get(array('*'))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3383)
at Illuminate\Database\Query\Builder->aggregate('count', array('*'))
(/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Query/Builder.php:3311)
at Illuminate\Database\Query\Builder->count()
(/home/vzizxmil/public_html/banyal-connect-api/check_masjid_table.php:5)
|