Utilità per cassandra
@param {Apollo~Connection} connection configurazione di Apollo
@param {Apollo~CassandraOptions} options - Cassandra options
@class
768086
function(connection, options){
    if(!connection) throw "Data connection configuration undefined";
    options = options || {};
    this._options = lodash.defaults(options, {
        replication_strategy : {'class' : 'SimpleStrategy', 'replication_factor' : DEFAULT_REPLICATION_FACTOR }
    });
    this._models = {};
    this._keyspace = connection.keyspace;
    this._connection = connection;
    //Compatibility with old parameters name
    if(this._connection.hosts && !this._connection.contactPoints)
        this._connection.contactPoints = this._connection.hosts;
    this._client = null;
}
1186238
def get_cassandra_connections():
    

    from django.db import connections
    for alias in connections:
        engine = connections[alias].settings_dict.get('ENGINE', '')
        if engine == 'django_cassandra_engine':
            yield alias, connections[alias]
1362289
public void addConnection(RedisURI redisURI, StatefulRedisConnection<String, String> connection) {

        if (this.closed) { // fastpath
            connection.closeAsync();
            return;
        }

        synchronized (this.connections) {

            if (this.closed) {
                connection.closeAsync();
                return;
            }

            this.connections.put(redisURI, connection);
        }
    }
216550
public function createConnection(?string $connection = null, array $options = []): AbstractDatabaseDriver
    {
        $config = $this->config->extract('database');

        // Check is new or legacy
        if ($config->get('connections')) {
            $connection = $connection ?: $config->get('default', 'local');
            $config     = $config->extract('connections.' . $connection);
        }

        $options = array_merge(
            [
                'driver' => $config->get('driver', 'mysql'),
                'host' => $config->get('host', 'localhost'),
                'user' => $config->get('user', 'root'),
                'password' => $config->get('password', ''),
                'database' => $config->get('name'),
                'prefix' => $config->get('prefix', 'wind_'),
            ],
            $options
        );

        $db = DatabaseFactory::getDbo($options['driver'], $options, true);

        $db->setDebug($this->config->get('system.debug', false));

        if ($db instanceof MysqlDriver && $config->get('strict', true)) {
            $this->strictMode($db);
        }

        return $db;
    }
209461
function createConnectionPromise(key, options) {
  
  debug('createConnectionPromise','start');

  //create promise that resolves to a connection
  var promise = new Promise((resolve,reject)=>{
    //create a new mssql connection
    let connection = new mssql.Connection(options,(err)=>handleConnectionCallback(err, resolve, reject, key, connection));
    connection.close = ()=>promise.then((conn)=>conn.close()).catch(()=>{ delete promises[key]; delete connections[key] });
    connection.query = (templateParts, ...params)=>promise.then((conn)=>query(conn,{},templateParts,params));
    connection.queryStream = (templateParts, ...params)=>promise.then((conn)=>query(conn,{stream:true},templateParts,params));
    connection.output = require('../parameters/output');
    connection.input = require('../parameters/input');

    debug('createConnectionPromise','success');
  });

  //add mssql types to promise - convenience access
  assign(promise, mssql.TYPES); //add mssql types to promise being returned
  promise.MAX = mssql.MAX;
  
  //back reference to cache
  promise._mssqlngKey = key;

  //extended methods
  promise.close = ()=>promise.then((conn)=>conn.close()).catch(()=>{ delete promises[key]; delete connections[key] });
  promise.query = (templateParts, ...params)=>promise.then((conn)=>query(conn,{},templateParts,params));
  promise.queryStream = (templateParts, ...params)=>promise.then((conn)=>query(conn,{stream:true},templateParts,params));
  promise.output = require('../parameters/output');
  promise.input = require('../parameters/input');

  debug('createConnectionPromise','success');
  return promise;
}
382830
function(model_name, model_schema, options) {
        if(!model_name || typeof(model_name) != "string")
            throw("Si deve specificare un nome per il modello");

        options = options || {};
        options.mismatch_behaviour = options.mismatch_behaviour || 'fail';
        if(options.mismatch_behaviour !== 'fail' && options.mismatch_behaviour !== 'drop')
            throw 'Valid option values for "mismatch_behaviour": "fail" , "drop". Got: "'+options.mismatch_behaviour+'"';

        //model_schema = schemer.normalize_model_schema(model_schema);
        schemer.validate_model_schema(model_schema);

        var base_properties = {
            name : model_name,
            schema : model_schema,
            keyspace : this._keyspace,
            mismatch_behaviour : options.mismatch_behaviour,
            define_connection : this._define_connection,
            cql : this._client,
            get_constructor : this.get_model.bind(this,model_name),
            connect: this.connect.bind(this)
        };

        return (this._models[model_name] = this._generate_model(base_properties));
    }
241252
function ChainOptions(options) {
  if (!(this instanceof ChainOptions))
    return new ChainOptions(options);

  this.network = Network.primary;
  this.logger = Logger.global;
  this.workers = null;

  this.prefix = null;
  this.location = null;
  this.db = 'memory';
  this.maxFiles = 64;
  this.cacheSize = 32 << 20;
  this.compression = true;
  this.bufferKeys = ChainDB.layout.binary;

  this.spv = false;
  this.bip91 = false;
  this.bip148 = false;
  this.prune = false;
  this.indexTX = true;
  this.indexAddress = true;
  this.forceFlags = false;

  this.coinCache = 0;
  this.entryCache = 5000;
  this.maxOrphans = 20;
  this.checkpoints = true;

  this.blockNotify = null;
  this.subscribeCmd = null;

  if (options)
    this.fromOptions(options);
}
357148
def connection(options = {})
      conn_options = default_options(options)
      clear_cache unless options.empty?
      puts "OPTIONS:#{conn_options.inspect}" if ENV['DEBUG']

      @connection ||= Faraday.new(conn_options.merge(:builder => stack(options))) do |faraday|
        faraday.response :logger if ENV['DEBUG']
      end
    end
46251
protected static function _Connect ($options) {
		$connection_name = static::AdjustConnectionName($options);

		if (!isset(static::$_dsnList[$connection_name])) {
			throw CoreException::RaiseSystemError('未定義のファイル設定を用いて接続しようとしています。connection_name:%s', [$connection_name]);
		}

		$dsn = static::$_dsnList[$connection_name];
		$driver_class_name = sprintf('%s\drivers\%s%s', __NAMESPACE__, Strings::ToUpperCamelCase($dsn['driver']), static::DRIVER_CLASS_NAME_SAFIX);
		static::$_connectionList[$connection_name] = $driver_class_name::Connect($dsn);
	}
306536
public DatabaseConnectionRequest<T, U> setConnection(String connection) {
        request.addParameter(ParameterBuilder.CONNECTION_KEY, connection);
        return this;
    }
485493
public void connectClient(Connection connection) {
    threadContext.checkThread();

    // Note we do not use method references here because the "state" variable changes over time.
    // We have to use lambdas to ensure the request handler points to the current state.
    connection.handler(RegisterRequest.class, (Function<RegisterRequest, CompletableFuture<RegisterResponse>>) request -> state.register(request));
    connection.handler(ConnectRequest.class, (Function<ConnectRequest, CompletableFuture<ConnectResponse>>) request -> state.connect(request, connection));
    connection.handler(KeepAliveRequest.class, (Function<KeepAliveRequest, CompletableFuture<KeepAliveResponse>>) request -> state.keepAlive(request));
    connection.handler(UnregisterRequest.class, (Function<UnregisterRequest, CompletableFuture<UnregisterResponse>>) request -> state.unregister(request));
    connection.handler(ResetRequest.class, (Consumer<ResetRequest>) request -> state.reset(request));
    connection.handler(CommandRequest.class, (Function<CommandRequest, CompletableFuture<CommandResponse>>) request -> state.command(request));
    connection.handler(QueryRequest.class, (Function<QueryRequest, CompletableFuture<QueryResponse>>) request -> state.query(request));

    connection.onClose(stateMachine.executor().context().sessions()::unregisterConnection);
  }
168156
function findMany(repository, options) {
    const entityColumns = repository.metadata.columns.map((columnMetadata) => columnMetadata.propertyName);
    const entityManyToOneRelationColumns = repository
        .metadata
        .relations
        .filter((relationMetadata) => relationMetadata.relationType === 'many-to-one' || relationMetadata.relationType === 'one-to-one')
        .map((relationMetadata) => relationMetadata.propertyName);
    return function (source, args, context, info) {
        return __awaiter(this, void 0, void 0, function* () {
            const selectedColumns = Object.keys(graphqlFields(info));
            const selectQueryBuilder = repository.createQueryBuilder(repository.metadata.name.toLowerCase());
            /** Select **/
            const selectFactory = new select_factory_1.SelectFactory(selectQueryBuilder);
            selectFactory
                .select(selectedColumns.filter((select) => entityColumns.includes(select)));
            /** Where **/
            const whereFactory = new where_factory_1.WhereFactory(selectQueryBuilder, entityManyToOneRelationColumns);
            whereFactory
                .where(lodash_1.get(args, 'filter', {}));
            /** Joins **/
            const joinsFactory = new joins_factory_1.JoinsFactory(selectQueryBuilder);
            joinsFactory
                .join(selectedColumns
                .filter((select) => entityManyToOneRelationColumns.includes(select))
                .reduce((selectedRelationColumns, selectedRelationColumn) => {
                selectedRelationColumns[selectQueryBuilder.alias] = selectedRelationColumn;
                return selectedRelationColumns;
            }, {}))
                .join(whereFactory.selectedManyToOneOrOneToOneRelationColumns);
            /** Pagination **/
            const paginateFactory = new paginate_factory_1.PaginateFactory(selectQueryBuilder);
            paginateFactory
                .paginate(lodash_1.get(args, 'pagination', {}));
            /** Order by **/
            const orderFactory = new order_factory_1.OrderFactory(selectQueryBuilder);
            orderFactory
                .order(lodash_1.get(args, 'orderBy', []));
            /** Extend **/
            if (lodash_1.get(options, 'extend')) {
                yield options.extend(selectQueryBuilder);
            }
            /** Execute get many method **/
            return yield selectQueryBuilder.getMany();
        });
    };
}
59807
public function tableOptions($table, $value, $key = 'id', \Closure $whereCallback = null, $connection = null)
    {
        return $this->options(
            Options::table($table, $value, $key, $whereCallback, $connection)
        );
    }
59047
function Connection(options) {
	
	if (!(this instanceof Connection)){
		return new Connection(options);
	}
	
	
	this.prefixCounter = 0;
	this.serverMessages = {};
	this._options = {
		username: options.username || options.user || '',
		password: options.password || '',
		host: options.host || 'localhost',
		port: options.port || 143,
		secure: options.secure === true ? { // secure = true means default behavior
			rejectUnauthorized: false // Force pre-node-0.9.2 behavior
		} : (options.secure || false),
		timeout: options.timeout || 10000, // connection timeout in msecs
		xoauth: options.xoauth,
		xoauth2: options.xoauth2
	};
	
	this._messages = {};
	this._messages = {};
	
	if (options.debug===true){
		this.debug = function(msg){
			console.log(msg);
		}
	}
	
		
	if (options.chainDebug===true){
		this.chainDebug = function(msg){
			console.log(msg);
		}
	}
	
	this.socket = null;
	
	this._messages_prefix_key={};
	this._messages_key_prefix={};
	this._messages={};
	
	
	this._msg_buffer = '';
	this._resetChainCommands();
}
281051
@Override
    public AuthenticationRequest setConnection(String connection) {
        if (!hasLegacyPath()) {
            Log.w(TAG, "Not setting the 'connection' parameter as the request is using a OAuth 2.0 API Authorization endpoint that doesn't support it.");
            return this;
        }
        addParameter(CONNECTION_KEY, connection);
        return this;
    }
83961
function configureConnection(connection) {
        // Set the common hub
        abp.signalr.hubs.common = connection;

        // Reconnect if hub disconnects
        connection.onclose(function (e) {
            if (e) {
                abp.log.debug('Connection closed with error: ' + e);
            }
            else {
                abp.log.debug('Disconnected');
            }

            if (!abp.signalr.autoConnect) {
                return;
            }

            setTimeout(function () {
                connection.start();
            }, 5000);
        });

        // Register to get notifications
        connection.on('getNotification', function (notification) {
            abp.event.trigger('abp.notifications.received', notification);
        });
    }
101898
function init(options) {
  options = options || {}
  var port = options.port || 6466
  global.client = global.client || socketIOClient(`http://localhost:${port}`)
  client = global.client
  log.debug(`Started global js socketIO client for ${process.env.ADAPTER} at ${port}`)
  client.emit('join', ioid) // first join for serialization
  client.on('disconnect', client.disconnect)
  client.on('take', hasher.handle) // add listener
  
  // add methods
  client.pass = pass
  client.clientPass = clientPass
  return client
}