public WorkerFactoryProxy(Session session) { this.target = session.getDatabase().getRepository().getWorkerFactory(); }
public Session(Database database, User user, int id) { this.id = id; this.user = user; this.database = database; this.queryTimeout = database.getSettings().defaultQueryTimeout; this.queryCacheSize = database.getSettings().queryCacheSize; this.currentSchemaName = Constants.SCHEMA_MAIN; this.transaction = database.getRepository().newTransaction(this); this.workerHolder = new WorkerFactoryProxy(this); }
public ConnectionHolder(Session session) { Database database = session.getDatabase(); JdbcRepository repository = (JdbcRepository) database.getRepository(); this.session = session; this.trace = database.getTrace(Trace.TRANSACTION); this.target = repository.getConnectionProvider(); String mode = database.getSettings().transactionMode; this.holderStrategy = transactionMode(mode); connectionMap = New.concurrentHashMap(); }
public void configure(Properties params) { JdbcRepository repo = (JdbcRepository) database.getRepository(); String shardName = params.getProperty("shard", repo.getPublicDB()); String catalog = params.getProperty("catalog"); String schema = params.getProperty("schema"); String tableName = params.getProperty("tableName", DEF_TABLE); tableName = database.identifier(tableName); if (catalog != null) { catalog = database.identifier(catalog); } if (schema != null) { schema = database.identifier(schema); } tableNode = new ObjectNode(shardName, catalog, schema, tableName, null); nameValue = StringUtils.toLowerEnglish(getName()); nameColumnName = params.getProperty("nameColumnName", DEF_NAME_COLUMN); valueColumnName = params.getProperty("valueColumnName", DEF_VALUE_COLUMN); nameColumnLength = getIntProperty(params, "nameColumnLength", DEF_NAMECOLUMNLENGTH_LENGTH); incrementSize = getIntProperty(params, "cacheSize", (int) getCacheSize()); initialValue = getIntProperty(params, "initialValue", DEFAULT_INITIAL_VALUE); this.selectQuery = buildSelectQuery(); this.updateQuery = buildUpdateQuery(); this.insertQuery = buildInsertQuery(); this.dataSource = repo.getDataSourceByShardName(shardName); this.optimizer = new HiloOptimizer(incrementSize); this.createTableIfNotExits(); }
String schema = matadataNode.getSchema(); try { JdbcRepository dsRepository = (JdbcRepository) database.getRepository(); DataSource dataSource = dsRepository.getDataSourceByShardName(shardName); conn = dataSource.getConnection();