https://docs.webfaction.com/xmlrpc-api/apiref.html#method-create_db
@param string $name
@param string $dbType
@param string $password
@param string $dbUser
@return mixed
@throws WebFactionException
169961
public function createDb($name, $dbType, $password, $dbUser = '')
    {
        $password = ($dbUser !== '') ? '' : $password;

        return $this->send('create_db', $name, $dbType, $password, $dbUser);
    }
591131
public function create(User $user = null, $type, \DateTime $expiration = null, $data = null)
    {
        $this->removeExpiredTokens();

        $n = 0;
        do {
            if ($n++ > 1024) {
                throw new \RuntimeException('Unable to create a token.');
            }
            $value = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);
            $found = null !== $this->om->getRepository('Phraseanet:Token')->find($value);
        } while ($found);

        $token = new Token();

        $token->setUser($user)
            ->setType($type)
            ->setValue($value)
            ->setExpiration($expiration)
            ->setData($data);

        $this->om->persist($token);
        $this->om->flush();

        return $token;
    }
1071702
public static function create($name)
    {
        $db = Loader::db();
        $u = new User();
        $v = array($u->getUserID(), 0, $name, 'READY');
        $q = "insert into Piles (uID, isDefault, name, state) values (?, ?, ?, ?)";
        $r = $db->query($q, $v);
        if ($r) {
            $pID = $db->Insert_ID();

            return self::get($pID);
        }
    }
583955
public function createBlankMigrationClassFile($name, $server_type = 'master', $migration_path = null)
    {
        $migrationCreator = new MigrationsCreator($this->userInteractionHandler);

        if (empty($migration_path)) {
            $migration_path = $this->getMigrationPath();
        }

        $success = $migrationCreator
            ->setPathTimeStamp($this->getSeedsDir())
            ->setVerbose($this->getVerbose())
            ->setName($name)
            ->setDescription('')
            ->setServerType($server_type)
            ->setMigrationsPath($migration_path)
            ->createBlankMigrationClassFile();

        $this->logCreatedMigration($migrationCreator->getLogData());
        return $success;
    }
443241
protected function dbCreateTable($SQL, $name = '')
    {
        $result = Eresus_CMS::getLegacyKernel()->db->create($this->__table($name), $SQL);
        return $result;
    }
977146
protected function _connect($dbType, $dbDescription)
    {
        if(is_object($dbDescription)) {
            $dbDescription = get_object_vars($dbDescription);
        }
        return Zend_Db::factory($dbType, $dbDescription);
    }
151579
static function getParameter($db_name, $key) {
		// don't reveal passwords through this interface
		if ('password' === $key) {
			throw new Exception('DB::password is private');
		}

		if (!array_key_exists($db_name, self::$parameters)) {
			throw new Exception("Configuration for database '$db_name' not loaded");
		}

		return @self::$parameters[$db_name][$key];
	}
533785
public static DbColumn.Builder dbColumn(String name, DbColumnType type, boolean autoInc) {
        return new DbColumn.Builder().name(name).type(type).autoInc(autoInc);
    }
1160305
public function create($user, $password, $role = 'member', $sendEmail = false)
    {
        try {
            DB::transaction(function () use ($user, $password, $role, $sendEmail) {
                $this->userMeta->firstOrCreate([
                    'user_id' => $user->id
                ]);

                $this->assignRole($role, $user->id);

                if ($sendEmail) {
                    event(new UserRegisteredEmail($user, $password));
                }
            });

            $this->setAndSendUserActivationToken($user);

            return $user;
        } catch (Exception $e) {
            throw new Exception("We were unable to generate your profile, please try again later.", 1);
        }
    }
1242096
public static function initPdoDatabase($config, $name)
    {
        try {
            $pdo = static::createPdoConnectionByConfig($config);
        } catch (PDOException $e) {
            throw new Exception('Cannon instantiate database connection: ' . $e->getMessage());
        }

        $pdo->uniqueName = $config['host'] . "-" . $config['db'];

        static::checkDebugBar($pdo, $name);

        return new RepositoryPDO($pdo, $name);
    }
352043
public static function db(ConfigInterface $dbConfig)
    {
        $key = md5(json_encode($dbConfig->get()));
        if (!isset(self::$dbInstances[$key])) {
            self::$dbInstances[$key] = new DB($dbConfig);
        }

        return self::$dbInstances[$key];
    }
59340
static public function db($name=null)
	{
	    $id = 'db' . ($name ? '.' . $name : '');
	    if (!static::has($id)) {
	        static::setShared($id, function () use($name) {
	            Config::load('database');
	            $config = (array)Config::get('database');
	            if ($config) {
	                $config = ArrayHelper::getItemArray($config, $name);
	            }
	            
	            return new Db($config);
	        });
	    }
	    
	    return static::get($id);
	}
146095
private function createConfigFile($dbInfos)
    {
        $config = Config::getInstance();

        // make sure DB sessions are used if the filesystem is NFS
        if (count($headers = ProxyHeaders::getProxyClientHeaders()) > 0) {
            $config->General['proxy_client_headers'] = $headers;
        }
        if (count($headers = ProxyHeaders::getProxyHostHeaders()) > 0) {
            $config->General['proxy_host_headers'] = $headers;
        }

        if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') {
            $protocol = 'https';
        } else {
            $protocol = ProxyHeaders::getProtocolInformation();
        }

        if (!empty($protocol)
            && !\Piwik\ProxyHttp::isHttps()) {
            $config->General['assume_secure_protocol'] = '1';
        }

        $config->General['salt'] = Common::generateUniqId();
        $config->General['installation_in_progress'] = 1;

        $config->database = $dbInfos;
        if (!DbHelper::isDatabaseConnectionUTF8()) {
            $config->database['charset'] = 'utf8';
        }

        $config->forceSave();

        // re-save the currently viewed language (since we saved the config file, there is now a salt which makes the
        // existing session cookie invalid)
        $this->resetLanguageCookie();
    }
890442
private function createUserDaoProvider($name, $provider, ContainerBuilder $container)
    {
        $name = $this->getUserProviderId($name);

        // Doctrine Entity and In-memory DAO provider are managed by factories
        foreach ($this->userProviderFactories as $factory) {
            $key = str_replace('-', '_', $factory->getKey());

            if (!empty($provider[$key])) {
                $factory->create($container, $name, $provider[$key]);

                return $name;
            }
        }

        // Existing DAO service provider
        if (isset($provider['id'])) {
            $container->setAlias($name, new Alias($provider['id'], false));

            return $provider['id'];
        }

        // Chain provider
        if (isset($provider['chain'])) {
            $providers = [];
            foreach ($provider['chain']['providers'] as $providerName) {
                $providers[] = new Reference($this->getUserProviderId($providerName));
            }

            $container
                ->setDefinition($name, new ChildDefinition('security.user.provider.chain'))
                ->addArgument(new IteratorArgument($providers));

            return $name;
        }

        throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name));
    }
78540
public function createPhpParam(string $name, string $value = null, 
			PhpTypeDef $phpTypeDef = null, bool $splat = false) {
		$phpParam = new PhpParam($this, $name, $value, $phpTypeDef);
		$phpParam->setSplat($splat);
		$this->phpParams[$name] = $phpParam;
		
		return $phpParam;
	}
313493
public function registerCustomDoctrineType($class, $name, $type)
    {
        if (! $this->connection->isDoctrineAvailable()) {
            throw new RuntimeException(
                'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).'
            );
        }

        if (! Type::hasType($name)) {
            Type::addType($name, $class);

            $this->connection
                ->getDoctrineSchemaManager()
                ->getDatabasePlatform()
                ->registerDoctrineTypeMapping($type, $name);
        }
    }
494760
static function addPassword(\Db\Connection $db, User $user, $password) {
    if (!$user) {
      throw new \InvalidArgumentException("No user provided.");
    }

    // does such a password already exist?
    $q = $db->prepare("SELECT * FROM user_passwords WHERE user_id=? LIMIT 1");
    $q->execute(array($user->getId()));
    if ($q->fetch()) {
      throw new UserAlreadyExistsException("That account already has a password.");
    }

    // does the user have an email? required
    $email = $user->getEmail();
    if (!$email) {
      throw new UserSignupException("That account requires an email address to add a password.");
    } else if (!is_valid_email($email)) {
      throw new UserSignupException("That is not a valid email.");
    }

    // create a new password
    $q = $db->prepare("INSERT INTO user_passwords SET user_id=?, password_hash=?");
    $q->execute(array($user->getId(), UserPassword::hash($password)));

    return true;
  }