Wraps PDO and gives a bunch of nice and easy one-liners that in most cases use Prepared Statements to ensure we aren't committing a huge security foot-cannon.
Inheritance: implements Airship\Engine\Contract\DBInterface
示例#1
0
 /**
  * We're storing metadata about a package in the database.
  *
  * @param TreeUpdate $update
  * @param int $treeUpdateID
  */
 protected function updatePackageQueue(TreeUpdate $update, int $treeUpdateID)
 {
     $packageId = $this->db->cell('SELECT
               packageid 
          FROM
               airship_package_cache
          WHERE 
              packagetype = ?
              AND supplier = ?
              AND name = ? 
         ', $update->getPackageType(), $update->getSupplierName(), $update->getPackageName());
     if (empty($packageId)) {
         $packageId = $this->db->insertGet('airship_package_cache', ['packagetype' => $update->getPackageType(), 'supplier' => $update->getSupplierName(), 'name' => $update->getPackageName()], 'packageid');
     }
     $data = $update->getNodeData();
     $this->db->insert('airship_package_versions', ['package' => $packageId, 'version' => $data['version'], 'checksum' => $data['checksum'], 'commithash' => $data['commit'] ?? null, 'date_released' => $data['date_released'], 'treeupdateid' => $treeUpdateID]);
 }
示例#2
0
 public function testZCleanup()
 {
     try {
         $db = Database::factory($this->getConfig());
     } catch (DBException $ex) {
         $this->markTestSkipped('Database not configured');
         return;
     }
     $db->safeQuery('DELETE FROM test_values');
 }
示例#3
0
 /**
  * Dependency-Injectable constructor
  *
  * @param \PDO $pdo
  * @param string $dbengine
  */
 public function __construct(\PDO $pdo = null, $dbengine = '')
 {
     if (IDE_HACKS) {
         parent::__construct($pdo, $dbengine);
     }
 }