/** * Turn a VirtualQuery into a SQL statement * @param \Thru\ActiveRecord\DatabaseLayer\VirtualQuery $thing * @return array|boolean * @throws Exception */ public function process(DatabaseLayer\VirtualQuery $thing) { switch ($thing->getOperation()) { case 'Insert': //Create return $this->processInsert($thing); case 'Select': //Read return $this->processSelect($thing); case 'Update': //Update return $this->processUpdate($thing); case 'Delete': //Delete return $this->processDelete($thing); case 'Passthru': //Delete return $this->processPassthru($thing); default: throw new Exception("Operation {$thing->getOperation()} not supported"); } }
/** * @expectedExceptionMessageRegExp /Unknown table '(test_models|active_record_test.test_models)'/ * @expectedException \Thru\ActiveRecord\DatabaseLayer\TableDoesntExistException */ public function testDestroyTableThatDoesntExist() { $model = new TestModel(); $model->deleteTable(); $vq = new VirtualQuery(); $interpreter = $vq->getInterpreter(); $interpreter->destroyTable($model); }