Exemplo n.º 1
0
 /**
  * Create a new query builder instance.
  *
  * @param Sgpatil\Orientdb\Connection $connection
  * @return void
  */
 public function __construct(Connection $connection, Grammar $grammar)
 {
     $this->grammar = $grammar;
     $this->grammar->setQuery($this);
     $this->connection = $connection;
     $this->client = $connection->getClient();
 }
Exemplo n.º 2
0
 /**
  * Create a new delegate instance.
  *
  * @param \Sgpatil\Orientdb\Eloquent\Builder $query
  * @param \Sgpatil\Orientdb\Eloquent\Model   $parent
  */
 public function __construct(Builder $query)
 {
     $this->query = $query;
     $model = $query->getModel();
     // Setup the database connection and client.
     $this->connection = $model->getConnection();
     $this->client = $this->connection->getClient();
 }
Exemplo n.º 3
0
 protected function getConnection($config = null)
 {
     $connection = is_null($config) ? $this->dbConfig['connections']['default'] : $this->dbConfig['connections'][$config];
     $client = new Connection($connection);
     // Create Connection object
     $client->getClient()->getServerInfo();
     // Check If Server is connected or not
     return $client;
 }
 /**
  * Append the character set specifications to a command.
  *
  * @param  string  $sql
  * @param  \Illuminate\Database\Connection  $connection
  * @return string
  */
 protected function compileCreateEncoding($sql, Connection $connection)
 {
     if (!is_null($charset = $connection->getConfig('charset'))) {
         $sql .= ' default character set ' . $charset;
     }
     if (!is_null($collation = $connection->getConfig('collation'))) {
         $sql .= ' collate ' . $collation;
     }
     return $sql;
 }
Exemplo n.º 5
0
 /**
  * Create a new database Schema manager.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return void
  */
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     $this->grammar = $connection->getSchemaGrammar();
 }
Exemplo n.º 6
0
 /**
  * Run the query as a "select" statement against the connection.
  *
  * @return array
  */
 protected function runSelect()
 {
     return $this->connection->select($this->toCypher(), $this->getBindings());
 }
 /**
  * Prepare the read write mode for database connection instance.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @param  string  $type
  * @return \Illuminate\Database\Connection
  */
 protected function setPdoForType(Connection $connection, $type = null)
 {
     if ($type == 'read') {
         $connection->setPdo($connection->getReadPdo());
     } elseif ($type == 'write') {
         $connection->setReadPdo($connection->getPdo());
     }
     return $connection;
 }
Exemplo n.º 8
0
 /**
  * Insert a new record into the database.
  *
  * @param  array  $values
  * @return bool
  */
 public function insertRelationship($parent, $related, $relationship, $bindings = [])
 {
     $cypher = $this->grammar->compileEdge($this, $parent, $related, $relationship, $bindings);
     return $this->connection->insert($cypher, $bindings);
 }
Exemplo n.º 9
0
 /**
  * Execute the blueprint against the database.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @param  \Illuminate\Database\Schema\Grammars\Grammar $grammar
  * @return void
  */
 public function build(Connection $connection, Grammar $grammar)
 {
     $class = $connection->getClient()->makeClass($this->table);
     $class->setProperty($this->columns);
     $class->save();
 }