similar with "relations" but merge single-data in source
@param string $table
@param string $bindKey
@param string $srcKey
@param Closure $userExe
@return Builder
427328
public function relation(
        string $table,
        string $bindKey,
        string $srcKey = 'id',
        Closure $userExe = null
    ) : Builder {
        $this->rsRender($table, $bindKey, $srcKey, null, $userExe);

        return $this;
    }
1175202
public function bindQueue($queue, $exchange, $binding_key = '')
    {
        if (!isset($this->_queues[$queue])) {
            throw new InvalidKeyException(['bind `:queue` queue to `:exchange` exchange with `:binding_key` binding key failed: queue is NOT exists',
                'queue' => $queue,
                'exchange' => $exchange,
                'binding_key' => $binding_key]);
        }

        if (!isset($this->_exchanges[$exchange])) {
            throw new AmqpException(['bind `:queue` queue to `:exchange` exchange with `:binding_key` binding key failed: exchange is NOT exists',
                'queue' => $queue,
                'exchange' => $exchange,
                'binding_key' => $binding_key]);
        }

        try {
            $this->_queues[$queue]->bind($exchange, $binding_key);
        } catch (\Exception $e) {
            throw new AmqpException(['bind `:queue` queue to `:exchange` exchange with `:binding_key` binding key failed: :error',
                'queue' => $queue,
                'exchange' => $exchange,
                'binding_key' => $binding_key,
                'error' => $e->getMessage()]);
        }

        return $this;
    }
1020892
protected function foreignRelationship(
        string $column,
        string $referredClass,
        bool $cascadeDelete = false
    ): Closure {
        return function (
            Table $table,
            MigrationContextInterface $context
        ) use (
            $column,
            $referredClass,
            $cascadeDelete
        ) {
            $tableName    = $this->getTableNameForClass($referredClass);
            $pkName       = $this->getModelSchemas()->getPrimaryKey($referredClass);
            $columnType   = $this->getModelSchemas()->getAttributeType($context->getModelClass(), $column);
            $columnLength = $columnType === Type::STRING ?
                $this->getModelSchemas()->getAttributeLength($context->getModelClass(), $column) : null;

            $closure = $this->foreignColumn($column, $tableName, $pkName, $columnType, $columnLength, $cascadeDelete);

            return $closure($table, $context);
        };
    }
38930
public function sRem($key, $member, ...$members) {
        return $this->send(array_merge(['srem', $key], (array) $member, $members));
    }
313790
public function execute($sqlStatement, $bindParams=null, $bindTypes=null) {
		try {
			return $this->callParentExecute($sqlStatement, $bindParams, $bindTypes);
		} catch(\PDOException $e) {
			if($e->getCode() === self::MYSQL_WENT_AWAY_CODE || $e->getMessage() === 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away') {
				$this->connect($this->_descriptor);
				return $this->callParentExecute($sqlStatement, $bindParams, $bindTypes);
			} else {
				throw $e;
			}
		}
	}
201145
public function bind($key, $binder)
    {
        $this->binders[str_replace('-', '_', $key)] = RouteBinding::forCallback(
            $this->container, $binder
        );
    }
757952
public function joinClosure(string $table, \Closure $callback): BaseQueryRelateContract
    {
        $this->query->join($table, $callback);

        return $this;
    }
20212
public function cursor($query, $bindings = [], $useReadPdo = true)
    {
        $statement = $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
            if ($this->pretending()) {
                return [];
            }

            // First we will create a statement for the query. Then, we will set the fetch
            // mode and prepare the bindings for the query. Once that's done we will be
            // ready to execute the query against the database and return the cursor.
            $statement = $this->prepared($this->getPdoForSelect($useReadPdo)
                              ->prepare($query));

            $this->bindValues(
                $statement, $this->prepareBindings($bindings)
            );

            // Next, we'll execute the query against the database and return the statement
            // so we can return the cursor. The cursor will use a PHP generator to give
            // back one row at a time without using a bunch of memory to render them.
            $statement->execute();

            return $statement;
        });

        while ($record = $statement->fetch()) {
            yield $record;
        }
    }
819137
public function lookup($key, $closure=null)
	{
		// if a closure was provided and we missed, store it
		if(!is_null($closure) && !isset($this->_registry[$key]) && !isset($this->_triggers[$key]))
		{
			$this->_registry[$key] = $this->_memoize($closure($key));
		}

		// the registry stores closures
		if(isset($this->_registry[$key]))
		{
			$result = call_user_func($this->_registry[$key], $this);
			$this->_registry[$key] = $this->_memoize($result);
			return $result;
		}
		// try any registered triggers
		else if(isset($this->_triggers[$key]))
		{
			call_user_func($this->_triggers[$key], $this);
			unset($this->_triggers[$key]);
			return $this->lookup($key);
		}
		else
		{
			throw new RegistryException("No entry for key '$key'");
		}
	}
543445
private function join(string $type, $source, $table, $on = null, array $params = [])
    {
        if ($source) {
            $source = $this->getSourceName($source);
        }

        [$tableAlias, $tableName] = $this->dialect()->parseTable($table);

        if ($tableName instanceof SelectQuery) {
            if (!$tableAlias) {
                throw new SqlException('JOIN table should have an alias name.');
            }

            $tableKey = $tableAlias;
        } else {
            $tableKey = $tableAlias ?: $tableName;

            $tableName = $this->dialect()->quoteTable($tableName);
        }

        if ($tableAlias) {
            $tableAlias = $this->dialect()->quoteName($tableAlias);
        }

        if (is_callable($on)) {
            $conditions = new Conditions($this->dialect());

            call_user_func_array($on, [$conditions]);

            $on = $conditions;
        }

        if (is_scalar($on)) {
            $on = $this->dialect()->quote($on);
        }

        $this->addJoin($tableKey, $type, $source, $tableName, $tableAlias, $on, $params);

        return $this;
    }
339840
public function table($table, \Closure $callback)
	{
		try
		{
			parent::create($table, $callback);
		}
		catch(\Exception $e)
		{
			try
			{
				parent::table($table, $callback);
			}
			catch(\Exception $e)
			{
				echo $e->getMessage();
			}
		}
	}
558679
public function castUsersTable(TableNode $user_table) {
    $aliases = array(
      'country' => 'field_post_address:country',
      'city' => 'field_post_address:locality',
      'street' => 'field_post_address:thoroughfare',
      'postcode' => 'field_post_address:postal_code',
    );

    // The first row of the table contains the field names.
    $table = $user_table->getTable();
    reset($table);
    $first_row = key($table);

    // Replace the aliased field names with the actual ones.
    foreach ($table[$first_row] as $key => $alias) {
      if (array_key_exists($alias, $aliases)) {
        $table[$first_row][$key] = $aliases[$alias];
      }
    }

    return new TableNode($table);
  }
905161
public static function update($table,$where=[],$data)
    {
        if(empty($data)) throw new Exception("DB update data is null");
        
        $column='';
        $bind=[];
        $ends=count($data)-1;
        $n=0;
        foreach ($data as $key=>$value) {
            $column.="`{$key}`=:{$key}";
            $bind[$key]=$value;
            if($n!=$ends){
                $column.=',';
            }
            $n++;
        }
        if(empty($where)){
            $where='';
        }else{
            $w=new Where($where);
            $where=' WHERE '.$w->parseWhere();
            $bind=array_merge($bind,$w->parseBind());
        }
        $sql=sprintf('UPDATE `:%s` SET %s %s',$table,$column,$where);
        $bind=array_merge($bind,$bind);
        return self::execute($sql,$bind);
    }
957310
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false ) {
           
            $sql = "BEGIN SP_GET_CONSUMER(:P_CONSUMER_KEY, :P_ROWS, :P_RESULT); END;";

            // parse sql
            $stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

            // Bind In and Out Variables
            oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
            oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

            //Bind the ref cursor
            $p_row = oci_new_cursor($this->conn);
            oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

            //Execute the statement
            oci_execute($stmt);

            // treat the ref cursor as a statement resource
            oci_execute($p_row, OCI_DEFAULT);
            oci_fetch_all($p_row, $getConsumerList, null, null, OCI_FETCHSTATEMENT_BY_ROW);

            $consumer = $getConsumerList;
           
		    if (!is_array($consumer)) {
                throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
            }

            $c = array();
            foreach ($consumer as $key => $value) {
                $c[substr($key, 4)] = $value;
            }
            $c['user_id'] = $c['usa_id_ref'];

            if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id) {
                throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
            }
            return $c;
        }
13119
public function query(string $sql, $bind = []): Result
    {
        $result = parent::query($sql, $bind);
        return new Result($this->tableName, $result);
    }
1088277
public function insert($table, array $bind)
    {
        $this->_connect();
        $newbind = array();
        if (is_array($bind)) {
            foreach ($bind as $name => $value) {
                if($value !== null) {
                    $newbind[$name] = $value;
                }
            }
        }

        return parent::insert($table, $newbind);
    }
626196
private function formJoin($query, $parentTable, $relatedTable, $parentPrimaryKey, $relatedPrimaryKey)
    {
        $joinType = config('columnsortable.join_type', 'leftJoin');

        return $query->select($parentTable.'.*')->{$joinType}($relatedTable, $parentPrimaryKey, '=', $relatedPrimaryKey);
    }