Example #1
0
        //--- 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();
        }
Example #2
0
        protected override Yield Stop(Result result)
        {
            _catalog = null;
            yield return(Coroutine.Invoke(base.Stop, new Result()));

            result.Return();
        }
Example #3
0
            public uint?SelectCount(DataCatalog dbCatalog, string methodName)
            {
                ResourceQuery countRQ = IncludeResourceCountOnly(true);
                string        q       = countRQ.ToString(methodName + "(count only)");

                return(dbCatalog.NewQuery(q).ReadAsUInt());
            }
Example #4
0
        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();
        }
 //--- Constructors ---
 public MySqlDekiDataSession(IInstanceSettings settings, DataCatalog catalog)
 {
     _settings = settings;
     _catalog  = catalog;
     Interlocked.Increment(ref _concurrentSessions);
     _catalog.OnQueryFinished += OnQueryFinished;
     Head = this;
 }
Example #6
0
        /// <summary>
        /// Get the display name of the specified <see cref="DataCatalog"/>.
        /// </summary>
        public static GUIContent GetCatalogDisplayName(DataCatalog catalog)
        {
            if ((catalog == null) || !HasCatalogs)
            {
                return(GUIContentUtility.NullContent);
            }
            int index = Array.IndexOf(Catalogs, catalog);

            return(CatalogDisplayNames[index]);
        }
Example #7
0
        /// <summary>
        /// Save the specified <see cref="DataCatalog"/>.
        /// </summary>
        public static void SaveCatalog(DataCatalog catalog, DataCatalogIOAsset saver)
        {
            bool ok = EditorUtility.DisplayDialog(
                $"Save \"{ObjectNames.NicifyVariableName(catalog.name)}\" catalog",
                $"Do you want to use \"{saver.name}\" to save the catalog data ?",
                "Save",
                "Cancel"
                );

            if (ok)
            {
                saver.Save(catalog, DataCatalogIOContext.Default);
                Debug.Log("Saved.");
            }
        }
Example #8
0
        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 ?? "wp_";

            try {
                _catalog.TestConnection();
            } catch (Exception) {
                throw new Exception(string.Format("Unable to connect to wordpress instance with connectionString: {0}", _catalog.ConnectionString));
            }
            result.Return();
        }
Example #9
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);
            }
Example #10
0
        //--- 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();
        }
        //--- 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();
        }
        //--- 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();
        }
Example #13
0
        /// <summary>
        /// Focus the specified <see cref="DataCatalog"/> in the DataCatalogWindow.
        /// </summary>
        /// <param name="forceOpenWindow"> Whether to force a window to open if it is not already open. </param>
        public static void FocusInWindow(DataCatalog catalog, bool forceOpenWindow)
        {
            Type windowType = ReflectionUtility.GetAllTypes(type => type.FullName == "MackySoft.UniData.Editor.DataCatalogWindow").FirstOrDefault();

            if (windowType == null)
            {
                return;
            }

            // Get Window
            MethodInfo openMethod = windowType.GetMethod("GetWindow", BindingFlags.Public | BindingFlags.Static);
            object     window     = openMethod.Invoke(null, new object[] { forceOpenWindow });

            if (window != null)
            {
                // Set Catlaog
                PropertyInfo catalogProperty = windowType.GetProperty("Catalog", BindingFlags.Public | BindingFlags.Instance);
                catalogProperty.SetValue(window, catalog);
            }
        }
Example #14
0
 public abstract void Load(DataCatalog catalog, DataCatalogIOContext context);
Example #15
0
 public static ReactiveDataCatalog ToReactiveDataCatalog <T> (this T source) where T : DataCatalog
 {
     return(DataCatalog.Create <ReactiveDataCatalog>(source.Id, source));
 }
Example #16
0
 public static void UnregisterCatalog(DataCatalog catalog)
 {
     m_Catalogs.Remove(catalog);
 }
Example #17
0
 public static void RegisterCatalog(DataCatalog catalog)
 {
     m_Catalogs.Add(catalog);
 }
Example #18
0
 private void LoadDbConfig()
 {
     _dbConfig = XDocFactory.LoadFrom(_dbConfigFile, MimeType.XML);
     _factory  = new MindTouch.Data.DataFactory(MySql.Data.MySqlClient.MySqlClientFactory.Instance, "?");
     _catalog  = new DataCatalog(_factory, _dbConfig);
 }
Example #19
0
 //--- Constructors ---
 public MySqlPageSubscriptionSession(DataCatalog catalog)
 {
     _catalog = catalog;
 }
Example #20
0
 public abstract void Save(DataCatalog catalog, DataCatalogIOContext context);
Example #21
0
            public ResourceBE Select(DataCatalog dbCatalog, string methodName)
            {
                List <ResourceBE> ret = SelectList(dbCatalog, methodName);

                return(ArrayUtil.IsNullOrEmpty(ret) ? null : ret[0]);
            }