//--- Constructors --- public MySqlDekiDataSession(IInstanceSettings settings, DataCatalog catalog) { _settings = settings; _catalog = catalog; _head = this; Interlocked.Increment(ref _concurrentSessions); _catalog.OnQueryFinished += OnQueryFinished; }
public void ChangeDatabase(string server, int port, string dbname, string dbuser, string dbpassword, uint timeout) { var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword, timeout); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
//--- Constructors --- public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version) { _effectiveVersion = new VersionInfo(version); if(!_effectiveVersion.IsValid) { throw new VersionInfoException(_effectiveVersion); } // initialize the data catalog var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); _factory = new DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?"); _catalog = new DataCatalog(_factory, config); _prefix = config["db-tableprefix"].AsText ?? "jos_"; try { _catalog.TestConnection(); } catch(Exception) { throw new Exception(string.Format("Unable to connect to joomla instance with connectionString: {0}", _catalog.ConnectionString)); } result.Return(); }
//--- Methods --- protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); // read configuration settings _factory = new DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?"); _catalog = new DataCatalog(_factory, config); _domain = (config["openid-suffix"].AsText ?? string.Empty).ToLowerInvariant(); // test database connection try { _catalog.TestConnection(); } catch(Exception) { throw new Exception(string.Format("Unable to connect to Deki Social instance with connectionString: {0}", _catalog.ConnectionString)); } result.Return(); }
//--- Constructors --- public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version, uint timeout) { if(string.IsNullOrEmpty(version)) { _targetVersion = null; } else { _targetVersion = new VersionInfo(version); if(!_targetVersion.IsValid) { throw new VersionInfoException(_targetVersion); } } // initialize the data catalog var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword, timeout); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
//--- Methods --- protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); // read configuration settings _factory = new DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?"); _catalog = new DataCatalog(_factory, config); _tablePrefix = config["db-tableprefix"].AsText ?? string.Empty; // test database connection try { _catalog.TestConnection(); } catch(Exception) { throw new Exception(string.Format("Unable to connect to vBulletin instance with connection string: {0}", _catalog.ConnectionString)); } result.Return(); }
//--- Constructors --- public MysqlDataUpdater(string server, int port, string dbname, string dbuser, string dbpassword, string version, uint timeout) { if (string.IsNullOrEmpty(version)) { _targetVersion = null; } else { _targetVersion = new VersionInfo(version); if (!_targetVersion.IsValid) { throw new VersionInfoException(_targetVersion); } } // initialize the data catalog var dataFactory = new DataFactory("MySql.Data", "?"); var connectionString = BuildConnectionString(server, port, dbname, dbuser, dbpassword, timeout); _dataCatalog = new DataCatalog(dataFactory, connectionString); _dataCatalog.TestConnection(); }
//--- Constructors --- internal DataCommand(DataFactory factory, DataCatalog catalog, string connection, IDbCommand command) { if (factory == null) { throw new ArgumentNullException("factory"); } if (catalog == null) { throw new ArgumentNullException("catalog"); } if (connection == null) { throw new ArgumentNullException("connection"); } if (command == null) { throw new ArgumentNullException("command"); } _factory = factory; _connection = connection; _command = command; _catalog = catalog; }
protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); _factory = new DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?"); _catalog = new DataCatalog(_factory, config); _prefix = config["db-tableprefix"].AsText ?? "jos_"; _version = config["joomla-version"].AsText; if (_version == null) _version = "1.6"; else if (_version != "1.0" && _version != "1.5" && _version != "1.6") { _log.Warn("joomla-version is set incorrectly: " + _version + ". Should be one of the following: 1.0, 1.5, 1.6"); _version = "1.6"; } try { _catalog.TestConnection(); } catch(Exception) { throw new Exception(string.Format("Unable to connect to joomla instance with connectionString: {0}", _catalog.ConnectionString)); } result.Return(); }
protected override Yield Stop(Result result) { _catalog = null; yield return Coroutine.Invoke(base.Stop, new Result()); result.Return(); }
//--- Methods --- protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); StringBuilder connectionString = new StringBuilder(); string server = config["db-server"].AsText ?? "localhost"; connectionString.AppendFormat("Server={0};", server); int? port = config["db-port"].AsInt; if( port.HasValue) { connectionString.AppendFormat("Port={0};", port.Value); } string catalog = config["db-catalog"].AsText; if(string.IsNullOrEmpty(catalog)) { throw new ArgumentNullException("config/catalog"); } connectionString.AppendFormat("Database={0};", catalog); string user = config["db-user"].AsText; if(!string.IsNullOrEmpty(user)) { connectionString.AppendFormat("User Id={0};", user); } string password = config["db-password"].AsText; if(!string.IsNullOrEmpty(password)) { connectionString.AppendFormat("Password={0};", password); } string options = config["db-options"].AsText; if(!string.IsNullOrEmpty(options)) { connectionString.Append(options); } _catalog = new DataCatalog(_factory, connectionString.ToString()); result.Return(); }
private void LoadDbConfig() { _dbConfig = XDocFactory.LoadFrom(_dbConfigFile, MimeType.XML); _factory = new MindTouch.Data.DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?"); _catalog = new DataCatalog(_factory, _dbConfig); }
//--- Methods --- protected override Yield Start(XDoc config, Result result) { yield return Coroutine.Invoke(base.Start, config, new Result()); _catalog = new DataCatalog(_factory, config); result.Return(); }
//--- Constructors --- public MySqlPageSubscriptionSession(DataCatalog catalog) { _catalog = catalog; }
public uint? SelectCount(DataCatalog dbCatalog, string methodName) { ResourceQuery countRQ = IncludeResourceCountOnly(true); string q = countRQ.ToString(methodName + "(count only)"); return dbCatalog.NewQuery(q).ReadAsUInt(); }
public ResourceBE Select(DataCatalog dbCatalog, string methodName) { List<ResourceBE> ret = SelectList(dbCatalog, methodName); return ArrayUtil.IsNullOrEmpty(ret) ? null : ret[0]; }
public List<ResourceBE> SelectList(DataCatalog dbCatalog, string methodName) { List<ResourceBE> ret = new List<ResourceBE>(); string q = ToString(methodName); dbCatalog.NewQuery(q) .Execute(delegate(IDataReader dr) { while(dr.Read()) { ret.Add(Resources_Populate(dr)); } }); return ret; }