Overview

Namespaces

  • None
  • Yajra
    • Oci8
      • Auth
      • Connectors
      • Eloquent
      • Query
        • Grammars
        • Processors
      • Schema
        • Grammars

Classes

  • Yajra\Oci8\Auth\OracleUserProvider
  • Yajra\Oci8\Connectors\OracleConnector
  • Yajra\Oci8\Eloquent\OracleEloquent
  • Yajra\Oci8\Oci8Connection
  • Yajra\Oci8\Oci8ServiceProvider
  • Yajra\Oci8\Query\Grammars\OracleGrammar
  • Yajra\Oci8\Query\OracleBuilder
  • Yajra\Oci8\Query\Processors\OracleProcessor
  • Yajra\Oci8\Schema\Comment
  • Yajra\Oci8\Schema\Grammars\OracleGrammar
  • Yajra\Oci8\Schema\OracleAutoIncrementHelper
  • Yajra\Oci8\Schema\OracleBlueprint
  • Yajra\Oci8\Schema\OracleBuilder
  • Yajra\Oci8\Schema\Sequence
  • Yajra\Oci8\Schema\Trigger

Traits

  • Yajra\Oci8\OracleReservedWords

Functions

  • config_path
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace Yajra\Oci8\Schema;
  4: 
  5: use Closure;
  6: use Illuminate\Database\Connection;
  7: use Illuminate\Database\Schema\Builder;
  8: 
  9: class OracleBuilder extends Builder
 10: {
 11:     /**
 12:      * @var \Yajra\Oci8\Schema\OracleAutoIncrementHelper
 13:      */
 14:     public $helper;
 15: 
 16:     /**
 17:      * @var \Yajra\Oci8\Schema\Comment
 18:      */
 19:     public $comment;
 20: 
 21:     /**
 22:      * @param Connection $connection
 23:      */
 24:     public function __construct(Connection $connection)
 25:     {
 26:         parent::__construct($connection);
 27:         $this->helper  = new OracleAutoIncrementHelper($connection);
 28:         $this->comment = new Comment($connection);
 29:     }
 30: 
 31:     /**
 32:      * Create a new table on the schema.
 33:      *
 34:      * @param  string $table
 35:      * @param  Closure $callback
 36:      * @return \Illuminate\Database\Schema\Blueprint
 37:      */
 38:     public function create($table, Closure $callback)
 39:     {
 40:         $blueprint = $this->createBlueprint($table);
 41: 
 42:         $blueprint->create();
 43: 
 44:         $callback($blueprint);
 45: 
 46:         $this->build($blueprint);
 47: 
 48:         $this->comment->setComments($blueprint);
 49: 
 50:         $this->helper->createAutoIncrementObjects($blueprint, $table);
 51:     }
 52: 
 53:     /**
 54:      * Create a new command set with a Closure.
 55:      *
 56:      * @param  string $table
 57:      * @param  Closure $callback
 58:      * @return \Illuminate\Database\Schema\Blueprint
 59:      */
 60:     protected function createBlueprint($table, Closure $callback = null)
 61:     {
 62:         $blueprint = new OracleBlueprint($table, $callback);
 63:         $blueprint->setTablePrefix($this->connection->getTablePrefix());
 64: 
 65:         return $blueprint;
 66:     }
 67: 
 68:     /**
 69:      * Changes an existing table on the schema.
 70:      *
 71:      * @param  string $table
 72:      * @param  Closure $callback
 73:      * @return \Illuminate\Database\Schema\Blueprint
 74:      */
 75:     public function table($table, Closure $callback)
 76:     {
 77:         $blueprint = $this->createBlueprint($table);
 78: 
 79:         $callback($blueprint);
 80: 
 81:         foreach ($blueprint->getCommands() as $command) {
 82:             if ($command->get('name') == 'drop') {
 83:                 $this->helper->dropAutoIncrementObjects($table);
 84:             }
 85:         }
 86: 
 87:         $this->build($blueprint);
 88: 
 89:         $this->comment->setComments($blueprint);
 90:     }
 91: 
 92:     /**
 93:      * Drop a table from the schema.
 94:      *
 95:      * @param  string $table
 96:      * @return \Illuminate\Database\Schema\Blueprint
 97:      */
 98:     public function drop($table)
 99:     {
100:         $this->helper->dropAutoIncrementObjects($table);
101:         parent::drop($table);
102:     }
103: 
104:     /**
105:      * Indicate that the table should be dropped if it exists.
106:      *
107:      * @param string $table
108:      * @return \Illuminate\Support\Fluent
109:      */
110:     public function dropIfExists($table)
111:     {
112:         $this->helper->dropAutoIncrementObjects($table);
113:         parent::dropIfExists($table);
114:     }
115: 
116:     /**
117:      * Determine if the given table exists.
118:      *
119:      * @param  string $table
120:      * @return bool
121:      */
122:     public function hasTable($table)
123:     {
124:         /** @var \Yajra\Oci8\Schema\Grammars\OracleGrammar $grammar */
125:         $grammar = $this->grammar;
126:         $sql     = $grammar->compileTableExists();
127: 
128:         $database = $this->connection->getConfig('username');
129:         $table    = $this->connection->getTablePrefix() . $table;
130: 
131:         return count($this->connection->select($sql, [$database, $table])) > 0;
132:     }
133: 
134:     /**
135:      * Get the column listing for a given table.
136:      *
137:      * @param  string $table
138:      * @return array
139:      */
140:     public function getColumnListing($table)
141:     {
142:         $database = $this->connection->getConfig('username');
143:         $table    = $this->connection->getTablePrefix() . $table;
144:         /** @var \Yajra\Oci8\Schema\Grammars\OracleGrammar $grammar */
145:         $grammar = $this->grammar;
146:         $results = $this->connection->select($grammar->compileColumnExists($database, $table));
147: 
148:         return $this->connection->getPostProcessor()->processColumnListing($results);
149:     }
150: }
151: 
API documentation generated by ApiGen