Answers for "error database connection"

SQL
0

error database connection

* @throws \Illuminate\Database\QueryException

     */

    protected function runQueryCallback($query, $bindings, Closure $callback)

    {

        // 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.

        catch (Exception $e) {

            throw new QueryException(

                $query, $this->prepareBindings($bindings), $e

            );

        }

    }

 

    /**

     * Log a query in the connection's query log.

     *

     * @param  string  $query

     * @param  array  $bindings

     * @param  float|null  $time

     * @return void

     */

    public function logQuery($query, $bindings, $time = null)

    {
Posted by: Guest on April-08-2022

Code answers related to "SQL"

Browse Popular Code Answers by Language