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()}");
     }
 }
Esempio n. 2
0
 /**
  * @param $name
  *
  * @return \MongoCollection|null
  */
 public function selectTable($name)
 {
     $coll = $this->parent->getConnection()->selectCollection($name);
     return $coll;
 }