Adds a new data source.

@param string             $name       The name of the data source
@param AbstractDataSource $dataSource

@throws \RuntimeException If a previous data sources exists with the same name
173956
public function addDataSource($name, AbstractDataSource $dataSource)
    {
        if ($this->hasDataSource($name)) {
            throw new \RuntimeException(sprintf('A previous data source exists with the same name: "%s".', $name));
        }

        $this->dataSources[$name] = $dataSource;
    }
1245454
static protected function create_connection($name)
    {
        # If the connection is already created, return.
        if (isset(self::$_connections[$name]))
            return;
        elseif (self::connectionExists($name))
            self::$_connections[$name] = new Connection(self::$_connection_data[$name], $name);
        else
            throw new Exception\RuntimeException(
                sprintf("Connection '%s' does not exist", $name)
            );
    }
202424
public static DataSource createDataSource(String source, String jndiName){
		DataSource ds = createDataSource(source);
		if (ds != null && jndiName != null){
			InitialContext ic;
			try {
				ic = new InitialContext();
				ic.bind(jndiName, ds);
			} catch (NamingException e) {
				log.error("Failed to bind data source '" + source + "' to JNDI name: " + jndiName, e);
			}
		}
		return ds;
	}
1202035
public static void createSchema(DataSource dataSource, String name) {
        try (Connection connection = dataSource.getConnection();
             Statement statement = connection.createStatement()) {
            statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
        } catch (SQLException e) {
            throw new RuntimeException("Can not connect to database", e);
        }
    }
346865
public void addResourceMetadata(String resourceName,
      ResourceMetadata resourceMetadata) {
    if (resourceMetadataMap.put(resourceName, resourceMetadata) != null) {
      throw new RuntimeException("Resource name " + resourceName +
          " already exists!");
    }
  }
599041
protected void setDataSource(Session session, String dataSourceNew,
                                 boolean isReversedNew, boolean createFile) {

        if (getTableType() == Table.TEMP_TEXT_TABLE) {
            ;
        } else {
            session.getGrantee().checkSchemaUpdateOrGrantRights(
                getSchemaName().name);
        }

        dataSourceNew = dataSourceNew.trim();

        if (createFile
                && FileUtil.getDefaultInstance().exists(dataSourceNew)) {
            throw Error.error(ErrorCode.TEXT_SOURCE_EXISTS, dataSourceNew);
        }

        //-- Open if descending, direction changed, file changed, or not connected currently
        if (isReversedNew || (isReversedNew != isReversed)
                || !dataSource.equals(dataSourceNew) || !isConnected) {
            openCache(session, dataSourceNew, isReversedNew, isReadOnly);
        }

        if (isReversed) {
            isReadOnly = true;
        }
    }
82055
protected function getDataStream($dataSource, $dataSourceOptions = null)
    {
        $dataSourceOptions = array_merge([
            'schema' => $this->schema(),
            'dialect' => isset($this->descriptor()->dialect) ? $this->descriptor()->dialect : null,
        ], (array) $dataSourceOptions);

        return new TabularDataStream($this->normalizeDataSource($dataSource, $this->basePath), $dataSourceOptions);
    }
1220953
public function setDataSource(DataSourceInterface $dataSource)
    {
        $this->dataSource = $dataSource;
        $this->dataSource->initialize($this);
    }
87020
public function addDataSource($record, $source)
    {
        if (arrayable($record)) {
            $record = $record->toArray();
        }

        if (! isset($record[$field = 'data_sources'])) {
            $record['data_sources'] = [];
        }

        $record['data_sources'][] = $source;

        return coollect($record);
    }
1121354
public function add_field($name,$aliase=false){
		if ($aliase===false) $aliase=$name;
		
		//adding to list of data-active fields
		if ($this->id["db_name"]==$name || $this->relation_id["db_name"] == $name){
			LogMaster::log("Field name already used as ID, be sure that it is really necessary.");
		}
		if ($this->is_field($name,$this->text)!=-1)
			throw new Exception('Data field already registered: '.$name);
		array_push($this->text,array("db_name"=>$name,"name"=>$aliase));
		
		//adding to list of all fields as well
		if ($this->is_field($name,$this->data)==-1)
			array_push($this->data,array("db_name"=>$name,"name"=>$aliase));
		
	}
1217668
public static function addName(string $name, int $initValue = 0)
    {
        if(static::$isInited)
        {
            throw new \RuntimeException('addName failed, AtomicManager was inited');
        }
        static::$atomics[$name] = $initValue;
    }
1058276
public function initialize($dataSource)
    {
        $this->position = 0;
        $this->count    = null;

        if (is_array($dataSource)) {
            reset($dataSource);
            $this->dataSource = new ArrayIterator($dataSource);
        } elseif ($dataSource instanceof IteratorAggregate) {
            $this->dataSource = $dataSource->getIterator();
            $this->dataSource->rewind();
        } elseif ($dataSource instanceof Iterator) {
            $this->dataSource = $dataSource;
            $this->dataSource->rewind();
        } else {
            throw new Exception\InvalidArgumentException(
                'DataSource provided is not an array, nor does it implement Iterator or IteratorAggregate'
            );
        }

        return $this;
    }
529220
public function attach($name,$data){
		$name=strtolower($name);
		$this->sqls[$name]=$data;
	}
318126
public function addHeader($name,$required,$data) {

            $this->amfResponse->addHeader(array('name'=>$name,'required'=>$required==true,'data'=>$data));

        }
769105
public ExtendedSwidProcessor setDataSource(final String dataSource) {
        swidTag.setDataSource(new Token(dataSource, idGenerator.nextId()));
        return this;
    }
434675
public function add($name, $source, $dependencies = array(), $attributes = array())
    {
        $this->added($name, $source, $dependencies, $attributes);
    }
362628
public function setDataSources(array $datasources)
    {
        foreach ($datasources as $ds) {
            if (!$ds instanceof HTML_QuickForm2_DataSource) {
                throw new HTML_QuickForm2_InvalidArgumentException(
                    'Array should contain only DataSource instances'
                );
            }
        }
        $this->datasources = $datasources;
        $this->updateValue();
    }