Пример #1
0
        void ShowCatalog()
        {
            var api = GatewayFactory.Create(DatabaseName, _settingsdict);

            byte[] result;
            var    ret = api.NativeCall("andl_catalog", new byte[0], out result);
        }
Пример #2
0
        // Open a database, or return empty object if null
        public DatabaseConnector OpenDatabase(string name = null, bool load = true)
        {
            if (IsTest)
            {
                return new DatabaseConnector {
                           Selector = this, Name = TestDatabaseSearchPath
                }
            }
            ;
            if (name == null)
            {
                return new DatabaseConnector {
                           Selector = this, Name = ""
                }
            }
            ;
            try {
                _settings["Load"] = load.ToString();

                var gateway = GatewayFactory.Create(name, _settings);
                gateway.OpenSession();
                return(new DatabaseConnector {
                    Selector = this, Name = name, Gateway = gateway
                });
            } catch (ProgramException e) {
                var msg = string.Format("Error: {0}", e.Message);
                MessageBox.Show(msg, "Database error");
                return(new DatabaseConnector {
                    Selector = this, Name = name
                });
            }
        }
Пример #3
0
 internal void Repl()
 {
     _api = GatewayFactory.Create(DatabaseName, _settingsdict);
     for (; ;)
     {
         Console.Write(">>>");
         var line = Console.ReadLine();
         Run(line);
     }
 }
Пример #4
0
        void CallFunc()
        {
            var api  = GatewayFactory.Create(DatabaseName, _settingsdict);
            var args = ArgWriter.Create().Put("abcdef").Out();

            byte[] result;
            var    ret = api.NativeCall("func", args, out result);
            var    rr  = ResultReader.Create(result);

            Console.WriteLine("Result={0}", rr.ReadText());
        }
Пример #5
0
        bool FindSupplier(string id, out Supplier[] supplier)
        {
            var api = GatewayFactory.Create(DatabaseName, _settingsdict);

            byte[] args = ArgWriter.Create().Put(id).Out();
            byte[] result;
            supplier = null;
            if (!api.NativeCall("find_supplier", args, out result))
            {
                return(false);
            }
            int n;
            var r = ResultReader.Create(result).Get(out n);

            supplier = new Supplier[n];
            for (int i = 0; i < n; ++i)
            {
                supplier[i] = new Supplier();
                r.Get(out supplier[i].SNAME).Get(out supplier[i].STATUS).Get(out supplier[i].CITY).Get(out supplier[i].Sid);
            }
            return(true);
        }
Пример #6
0
 internal void Exec()
 {
     _api = GatewayFactory.Create(DatabaseName, _settingsdict);
     Run("fact:0(n:0) => if(n<=1,1,n*fact(n-1))");
     Run("fact(6)");
 }
Пример #7
0
 static GatewayBase AppStartup(string database, Dictionary <string, string> settings)
 {
     //var appsettings = ConfigurationManager.AppSettings;
     return(GatewayFactory.Create(database, settings));
 }