Beispiel #1
0
 public ServerConnection(string url)
 {
     using(Log.Scope("ServerConnection constructor"))
     {
         Log.Debug("connecting to {0}", url);
         try
         {
             if(_instance != null)
             {
                 _instance.Dispose();
                 _instance = null;
             }
         }
         catch { }
         if(url == null)
             throw new ArgumentNullException("url");
         _url = url;
         this.Server = new LPSClientShared.LPSServer.Server(url);
         this.Server.CookieContainer = CookieContainer;
         this.cached_datasets = new Dictionary<string, DataSet>();
         _instance = this;
         resource_manager = new ResourceManager(this);
         configuration_store = new ConfigurationStore();
     }
 }
Beispiel #2
0
 public override object Execute(IExecutionContext context, TextWriter Out, TextWriter Info, TextWriter Err, object[] Params)
 {
     string url = Get<string>(Params, 0);
     ServerConnection conn = new ServerConnection(url);
     Info.WriteLine("Připojeno k {0}", url);
     conn.Login(Get<string>(Params, 1), Get<string>(Params, 2));
     Info.WriteLine("Uživatel {0} přihlášen", Get<string>(Params, 1));
     return conn;
 }
Beispiel #3
0
 public string[] GetSqlTableNames(ServerConnection conn)
 {
     List<string> tables = new List<string>();
     using(DataSet ds = conn.GetDataSetBySql(@"
         select distinct table_name from information_schema.columns where table_schema = 'public'"))
     {
         foreach(DataRow r in ds.Tables[0].Rows)
             tables.Add((string)r[0]);
     }
     tables.Sort();
     return tables.ToArray();
 }
Beispiel #4
0
 public ServerConnection TryConnect()
 {
     try
     {
         ServerConnection srv = new ServerConnection(edtServer.Text);
         if(!srv.Ping())
             return null;
         return srv;
     }
     catch(Exception)
     {
         return null;
     }
 }