コード例 #1
0
ファイル: Blueprint.cs プロジェクト: mattiamanzati/Icy
 /**
  * Execute the blueprint against the database.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @param  \Illuminate\Database\Schema\Grammars\Grammar $grammar
  * @return void
  */
 public virtual void build(Connection connection, SchemaGrammar grammar)
 {
     foreach (var statement in this.toSql(connection, grammar))
     {
         connection.statement(statement);
     }
 }
コード例 #2
0
ファイル: Blueprint.cs プロジェクト: mattiamanzati/Icy
        /**
         * Get the raw SQL statements for the blueprint.
         *
         * @param  \Illuminate\Database\Connection  $connection
         * @param  \Illuminate\Database\Schema\Grammars\Grammar  $grammar
         * @return array
         */
        public virtual string[] toSql(Connection connection, SchemaGrammar grammar)
        {
            this.addImpliedCommands();
            var statements = new string[0];

            // Each type of command has a corresponding compiler BlueprintColumn on the schema
            // grammar which is used to build the necessary SQL statements to build
            // the blueprint element, so we'll just call that compilers function.
            foreach (var command in this._commands)
            {
                var method = "compile" + StrUtil.ucfirst(command.name);
                if (ReflectionUtil.existsMethod(this.GetType(), method))
                {
                    string[] sql = (string[])ReflectionUtil.callMethod(grammar, method, this, command, connection);
                    statements = ArrayUtil.push(statements, sql);
                }
            }
            return(statements);
        }
コード例 #3
0
 /**
  * Create a new database Schema manager.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return void
  */
 public Builder(Connection connection)
 {
     this._connection = connection;
     this._grammar    = connection.getSchemaGrammar();
 }
コード例 #4
0
 /**
  * Set the schema grammar used by the connection.
  *
  * @param  \Illuminate\Database\Schema\Grammars\Grammar  $grammar
  * @return void
  */
 public virtual void setSchemaGrammar(SchemaGrammar grammar)
 {
     this._schemaGrammar = grammar;
 }
コード例 #5
0
 /**
  * Set the schema grammar to the default implementation.
  *
  * @return void
  */
 public virtual void useDefaultSchemaGrammar()
 {
     this._schemaGrammar = this.getDefaultSchemaGrammar();
 }