Something went wrong.

SQLSTATE[HY000] [1049] Unknown database 'billing.premiumtires.ca'.
SQLSTATE[HY000] [1049] Unknown database 'billing.premiumtires.ca' on line 329 in /var/www/billing.premiumtires.ca/vendors/minphp/db/src/PdoConnection.php
PDO->__construct
Line 329

/var/www/billing.premiumtires.ca/vendors/minphp/db/src/PdoConnection.php

Minphp\Db\PdoConnection->makeConnection
Line 114

/var/www/billing.premiumtires.ca/vendors/minphp/db/src/PdoConnection.php

Minphp\Db\PdoConnection->connect
Line 80

/var/www/billing.premiumtires.ca/core/ServiceProviders/MinphpBridge.php

Blesta\Core\ServiceProviders\MinphpBridge->{closure:Blesta\Core\ServiceProviders\MinphpBridge::register():67}
Line 122

/var/www/billing.premiumtires.ca/vendors/pimple/pimple/src/Pimple/Container.php

Pimple\Container->offsetGet
Line 22

/var/www/billing.premiumtires.ca/vendors/minphp/container/src/Container.php

Minphp\Container\Container->get
Line 26

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Model.php

Model->__construct
Line 25

/var/www/billing.premiumtires.ca/core/Util/Common/Classes/Model.php

Blesta\Core\Util\Common\Classes\Model->__construct
Line 0

/var/www/billing.premiumtires.ca/app/app_model.php

AppModel->__construct
Line 19

/var/www/billing.premiumtires.ca/app/models/currencies.php

Currencies->__construct
Line

ReflectionClass->newInstance
Line 275

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::createInstance
Line 254

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::loadInstances
Line 130

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::loadModels
Line 36

/var/www/billing.premiumtires.ca/helpers/currency_format/currency_format.php

CurrencyFormat->__construct
Line

ReflectionClass->newInstance
Line 275

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::createInstance
Line 254

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::loadInstances
Line 159

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Loader.php

Loader::loadHelpers
Line 155

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Controller.php

Controller->helpers
Line 124

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Controller.php

Controller->__construct
Line 25

/var/www/billing.premiumtires.ca/core/Util/Common/Classes/Controller.php

Blesta\Core\Util\Common\Classes\Controller->__construct
Line 0

/var/www/billing.premiumtires.ca/app/app_controller.php

AppController->__construct
Line 123

/var/www/billing.premiumtires.ca/vendors/minphp/bridge/src/Lib/Dispatcher.php

Dispatcher::dispatch
Line 21

/var/www/billing.premiumtires.ca/index.php

137
     *
138
     * @param int $fetchMode The PDO:FETCH_* constant (int) to fetch records
139
     */
140
    public function setFetchMode($fetchMode)
141
    {
142
        $cur = $this->fetchMode;
143
        $this->fetchMode = $fetchMode;
144
        return $cur;
145
    }
146
 
147
    /**
148
     * Get the last inserted ID
149
     *
150
     * @param string $name The name of the sequence object from which the ID should be returned
151
     * @return string The last ID inserted, if available
152
     */
153
    public function lastInsertId($name = null)
154
    {
155
        return $this->connect()->lastInsertId($name);
156
    }
157
 
158
    /**
159
     * Sets the given value to the given attribute for this connection
160
     *
161
     * @param long $attribute The attribute to set
162
     * @param int $value The value to assign to the attribute
163
     * @return PdoConnection
164
     */
165
    public function setAttribute($attribute, $value)
166
    {
167
        $this->connect()->setAttribute($attribute, $value);
168
        return $this;
169
    }
170
 
171
    /**
172
     * Query the Database using the given prepared statement and argument list
173
     *
174
     * @param string $sql The SQL to execute
175
     * @param string $... Bound parameters [$param1, $param2, ..., $paramN]
176
     * @return PDOStatement The resulting PDOStatement from the execution of this query
177
     */
178
    public function query($sql)
179
    {
180
        $params = func_get_args();
181
        // Shift the SQL parameter off of the list
182
        array_shift($params);
183
 
184
        // If 2nd param is an array, use it as the series of params, rather than
185
        // the rest of the param list
186
        if (isset($params[0]) && is_array($params[0])) {
187
            $params = $params[0];
188
        }
189
 
190
        $this->connect();
191
 
192
        // Store this statement in our PDO object for easy use later
193
        $this->statement = $this->prepare($sql, $this->fetchMode);
194
 
195
        // Execute the query
196
        $this->statement->execute($params);
197
 
198
        // Return the statement
199
        return $this->statement;
200
    }
201
 
202
    /**
203
     * Prepares an SQL statement to be executed by the PDOStatement::execute() method.
204
     * Useful when executing the same query with different bound parameters.
205
     *
206
     * @param string $sql The SQL statement to prepare
207
     * @param int $fetchMode The PDO::FETCH_* constant
208
     * @return PDOStatement The resulting PDOStatement from the preparation of this query
209
     * @see PDOStatement::execute()
210
     */
211
    public function prepare($sql, $fetchMode = null)
212
    {
213
        if ($fetchMode === null) {
214
            $fetchMode = $this->fetchMode;
215
        }
216
 
217
        $this->statement = $this->connect()->prepare($sql);
218
        // Set the default fetch mode for this query
219
        $this->statement->setFetchMode($fetchMode);
220
 
221
        return $this->statement;
222
    }
223
 
224
    /**
225
     * Begin a transaction
226
     *
227
     * @return boolean True if the transaction was successfully opened, false otherwise
228
     */
229
    public function begin()
230
    {
231
        return $this->connect()->beginTransaction();
232
    }
233
 
234
    /**
235
     * Rolls back and closes the transaction
236
     *
237
     * @return boolean True if the transaction was successfully rolled back and closed, false otherwise
238
     */
239
    public function rollBack()
240
    {
241
        return $this->connect()->rollBack();
242
    }
243
 
244
    /**
245
     * Commits a transaction
246
     *
247
     * @return boolean True if the transaction was successfully commited and closed, false otherwise
248
     */
249
    public function commit()
250
    {
251
        return $this->connect()->commit();
252
    }
253
 
254
    /**
255
     * Returns the connection's PDO object if a connection has been established, null otherwise.
256
     *
257
     * @return PDO The PDO connection object, null if no connection exists
258
     */
259
    public function getConnection()
260
    {
261
        return $this->connection;
262
    }
263
 
264
    /**
265
     * Set the PDO connection to use
266
     *
267
     * @param PDO $connection
268
     * @return PdoConnection
269
     */
270
    public function setConnection(PDO $connection)
271
    {
272
        $this->connection = $connection;
273
        return $this;
274
    }
275
 
276
    /**
277
     * Get the number of rows affected by the last query
278
     *
279
     * @param PDOStatement $statement The statement to count affected rows on,
280
     * if null the last query() statement will be used.
281
     * @return int The number of rows affected by the previous query
282
     * @throws RuntimeException Thrown when not PDOStatement available
283
     */
284
    public function affectedRows(PDOStatement $statement = null)
285
    {
286
        if ($statement === null) {
287
            $statement = $this->statement;
288
        }
289
 
290
        if (!($statement instanceof PDOStatement)) {
291
            throw new RuntimeException('Can not get affectedRows without a PDOStatement.');
292
        }
293
 
294
        return $statement->rowCount();
295
    }
296
 
297
    /**
298
     * Build a DSN string using the given array of parameters
299
     *
300
     * @param array $db An array of parameters
301
     * @return string The DSN string
302
     * @throws InvalidArgumentException Thrown when $db contains invalid parameters
303
     */
304
    public function makeDsn(array $db)
305
    {
306
        if (!isset($db['driver']) || !isset($db['database']) || !isset($db['host'])) {
307
            throw new InvalidArgumentException(
308
                sprintf('Required %s', "array('driver'=>,'database'=>,'host'=>)")
309
            );
310
        }
311
 
312
        return isset($db['port'])
313
            ? $db['driver'] . ':host=' . $db['host'] . ';dbname=' . $db['database'] . ';port=' . $db['port']
314
            : $db['driver'] . ':host=' . $db['host'] . ';dbname=' . $db['database'];
315
    }
316
 
317
    /**
318
     * Establish a new PDO connection using the given array of information. If
319
     * a connection already exists, no new connection will be created.
320
     *
321
     * @param string $dsn
322
     * @param string $username
323
     * @param string $password
324
     * @param array $options
325
     * @return \PDO The connection
326
     */
327
    private function makeConnection($dsn, $username, $password, $options)
328
    {
329
        return new PDO($dsn, $username, $password, $options);
330
    }
331
}
332