function execute() { $qb = $this->container->get('QB'); var_dump($qb); $query = QB::query('select version()'); var_dump($query->get()); }
/** * /u/@user/key.json */ public function key($f3, $params) { $key = \QB::table('user_key')->select(['user_key.fingerprint', 'user_key.key'])->join('user', 'user.id', '=', 'user_key.user_id')->where('user.username', $params['username'])->where('user_key.type', 'public')->first(); if (!$key) { \App::error(404); } $this->_json($key); }
/** * Initialize the app */ static function init() { // Load configuration if (is_file('config.php')) { self::$_config = (require 'config.php'); } else { throw new Exception('No config.php file found.'); } // Initialize Composer autoloader require_once 'vendor/autoload.php'; // Initialize framework self::$_router = Base::instance(); self::$_router->mset(['AUTOLOAD' => 'app/', 'ESCAPE' => false, 'PACKAGE' => 'svlt/back', 'CORS.origin' => '*']); // Initialize database connection and query builder self::$_qb = new Pixie\Connection('mysql', ['driver' => 'mysql'] + self::$_config['db'], 'QB'); self::$_db = new SQL(QB::pdo(), 'mysql:host=' . self::$_config['db']['host'] . ';port=3306;dbname=' . self::$_config['db']['database']); // Initialize routes require_once 'routes.php'; }
public function replace($data, $table) { $keys = array_keys($data); $sql = QB::replaceQuery($table, $keys); $q = $this->conn->prepare($sql); $sth = $q->execute($data); if ($sth) { return true; } else { return false; } }