/** * 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(); }
/** * 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(); }
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; }
/** * 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(); }
/** * 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; }
/** * 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); }
/** * 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(); }