コード例 #1
0
        /**
         * Create a new database connection instance.
         *
         * @param  \PDO     $pdo
         * @param  string   $database
         * @param  string   $tablePrefix
         * @param  array    $config
         * @return void
         */

        public Connection(object pdo, string database = "", string tablePrefix = "", ApplicationDatabaseConnectionConfig config = default(ApplicationDatabaseConnectionConfig))
        {
            this._pdo = pdo;
            // First we will setup the default properties. We keep track of the DB
            // name we are connected to since it is needed when some reflective
            // type commands are run such as checking whether a table exists.
            this._database    = database;
            this._tablePrefix = tablePrefix;
            this._config      = config;
            // We need to initialize a query grammar and the query post processors
            // which are both very important parts of the database abstractions
            // so we initialize these to their default values while starting.
            this.useDefaultQueryGrammar();
            this.useDefaultPostProcessor();
        }
コード例 #2
0
ファイル: DatabaseManager.cs プロジェクト: mattiamanzati/Icy
        /**
         * Make the database connection instance.
         *
         * @param  string  $name
         * @return \Illuminate\Database\Connection
         */
        protected virtual Connection makeConnection(string name)
        {
            ApplicationDatabaseConnectionConfig config = this.getConfig(name);

            // First we will check by the connection name to see if an extension has been
            // registered specifically for that connection. If it has we will call the
            // Closure and pass it the config allowing it to resolve the connection.
            if (this._extensions.ContainsKey(name))
            {
                return(this._extensions[name](config, name));
            }
            string driver = config.driver;

            // Next we will check to see if an extension has been registered for a driver
            // and will call the Closure if so, which allows us to have a more generic
            // resolver for the drivers themselves which applies to all connections.
            if (this._extensions.ContainsKey(name))
            {
                return(this._extensions[driver](config, name));
            }
            return(this._factory.make(config, name));
        }
コード例 #3
0
 public SqlServerConnection(object pdo, string database = "", string tablePrefix = "", ApplicationDatabaseConnectionConfig config = default(ApplicationDatabaseConnectionConfig)) : base(pdo, database, tablePrefix, config)
 {
 }