Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function createTable($table, $properties = array(), $check_exist = false, $return_schema = false)
 {
     if (empty($table)) {
         throw new BadRequestException("No 'name' field in data.");
     }
     try {
         $result = $this->parent->getConnection()->createCollection($table);
         $out = array('name' => $result->getName());
         $out['indexes'] = $result->getIndexInfo();
         $this->refreshCachedTables();
         return $out;
     } catch (\Exception $ex) {
         throw new InternalServerErrorException("Failed to create table '{$table}'.\n{$ex->getMessage()}");
     }
 }
 public function testDropTable()
 {
     $request = new TestServiceRequest(Verbs::DELETE);
     $rs = $this->service->handleRequest($request, Schema::RESOURCE_NAME . '/' . static::TABLE_NAME);
     $request->setMethod(Verbs::GET);
     $rs = $this->service->handleRequest($request, Schema::RESOURCE_NAME . '/' . static::TABLE_NAME);
 }
Esempio n. 3
0
 /**
  * @param $name
  *
  * @return \MongoCollection|null
  */
 public function selectTable($name)
 {
     $coll = $this->parent->getConnection()->selectCollection($name);
     return $coll;
 }