/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for this metadata source.</param> public BColumnsMetadataSource(ILogger log, BProperties properties) { LogUtilities.LogFunctionEntrance(log, log); Log = log; m_Properties = properties; //InitializeData(); //List<ColumnInfo> column_infos = new List<ColumnInfo>(); //column_infos.AddRange(m_Columns); //m_Columns.Clear(); try { //get the client connection using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { //get the columns ColumnMetadataResult[] columns = client.GetMetadataColumns(); //copy results columns.ToList().Where(c => c.Visible).ToList().ForEach(c => { //if(c.Table == "Mentions" && // ( // c.Column == "Id" || // c.Column == "Name" || // c.Column == "Description" || // c.Column == "Type" || // c.Column == "Sentiment" || // c.Column == "Influence" || // c.Column == "IsDisabled" || // c.Column == "OccurredOn" || // c.Column == "CreatedOn" || // c.Column == "UpdatedOn" || // c.Column == "Guid" || // c.Column == "Author" || // c.Column == "Followers" || // c.Column == "Klout" || // c.Column == "Comments" // )) { m_Columns.Add( GetColumnInfo( c.Catalog, c.Table, c.Column, c.DataType, c.ColumnLength, c.Nullable, c.OrdinalPosition, c.ColumnPrecision)); } }); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for this metadata source.</param> public BCatalogOnlyMetadataSource(ILogger log, BProperties properties) { LogUtilities.LogFunctionEntrance(log, log); Log = log; m_Properties = properties; try { //get the client connection using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { //get the catalogs string[] catalogs = client.GetMetadataCatalogs(); //copy results m_Catalogs.AddRange(catalogs); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } //m_Catalogs.Add(Driver.B_CATALOG); }
private void MakeClientAndGetData() { try { using (var client = ExternalServiceClient.GetClient(Endpoint)) { GetData(client); } } catch (Exception ex) { textBox2.Invoke(new Action(() => textBox2.Text = ex.ToString())); } }
private void GetStatus() { PrepareForQuery(); try { var client = ExternalServiceClient.GetClient(Endpoint); client.Open(); var result = client.Ping("status"); client.Close(); textBox4.Invoke(new Action(() => textBox4.Text = result)); } catch (Exception ex) { textBox4.Invoke(new Action(() => textBox4.Text = ex.ToString())); } }
/// <summary> /// refresh the list of catalogs /// </summary> private void RefreshCatalogList() { if (string.IsNullOrWhiteSpace(m_CatalogServer) || m_CatalogServer.ToLower() != textBoxServer.Text.ToLower()) { try { this.Cursor = Cursors.WaitCursor; comboBoxCatalog.Items.Clear(); using (var client = ExternalServiceClient.GetClient(textBoxServer.Text)) { //get the catalogs string[] catalogs = client.GetMetadataCatalogs(); //copy results foreach (var catalog in catalogs) { comboBoxCatalog.Items.Add(catalog); } if (m_ConnectionSettings.ContainsKey(Driver.B_CATALOG_KEY)) { object cat = m_ConnectionSettings[Driver.B_CATALOG_KEY]; if (cat != null) { comboBoxCatalog.SelectedItem = cat.ToString(); } } } } catch (Exception) { comboBoxCatalog.Items.Clear(); comboBoxCatalog.Items.Add(m_ServerConnectionError); comboBoxCatalog.SelectedItem = m_ServerConnectionError; } finally { this.Cursor = Cursors.Default; } m_CatalogServer = textBoxServer.Text; } }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for logging.</param> public BFakeResultTable(ILogger log, string sql, BProperties properties) : base(log, sql, properties) { //set parameters LogUtilities.LogFunctionEntrance(Log, log); m_Properties = properties; Sql = sql; //init the columns try { using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { m_TableColumns = client.GetMetadataColumns(); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } //make the fake data InitializeFakeData(Sql); }
/// <summary> /// execute the proper fetch /// </summary> /// <param name="page"></param> /// <returns></returns> public bool ExecuteFetch(long page) { bool ret = false; try { //open the client connection using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { //temp parameters until we get SQL TO BQL //var mapreduce = "SELECT Count() GROUP BY Date INTERVAL Day"; var mapreduce = Sql; //var mapreduce = "Get Mentions"; var minDate = DateTime.UtcNow.AddDays(-100); var maxDate = DateTime.UtcNow; string query = ""; //string command = "-nocount"; string command = ""; //create the paging string //??how do I specify the page?? string paging = "";// string.Format("__paging__ORDERED BY Date LIMIT {0}", m_Properties.RowsToFetch); //init the data m_Data.Clear(); //make the query //var cursor = client.GetCursor(m_Properties.Catalog, "__ql__" + query, "__ql__" + mapreduce, "__default__", null, command); var datapoints = client.GetData(m_Properties.Catalog, "__ql__" + query, "__ql__" + mapreduce, "__default__", null, command); //var datapoints = client.GetData(m_Properties.Catalog, "__ql__" + query, null, null, paging, minDate, maxDate, command); //this is the call to pass the sql through to bermuda //var datapoints = client.GetData(Sql); //check results if (datapoints != null && !string.IsNullOrWhiteSpace(datapoints.Data) && !string.IsNullOrWhiteSpace(datapoints.DataType)) { //build the returned data object obj = LinqRuntimeTypeBuilder.DeserializeJson(datapoints.Data, datapoints.DataType, true); Type type = obj.GetType(); Array array = obj as Array; //check for results returned if (array.Length > 0) { //parse the results foreach (var item in array) { //check if we need to init the columns if (m_Columns.Count == 0) { //init the columns InitializeColumns(item); } //add this row AddRow(item); } } //set the actual row size //RowCount = TotalItemsToFetch; } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } return(ret); }
/// <summary> /// Constructor. /// </summary> /// <param name="log">The logger to use for this metadata source.</param> public BTablesMetadataSource(ILogger log, BProperties properties) { LogUtilities.LogFunctionEntrance(log, log); Log = log; m_Properties = properties; try { //get the client connection using (var client = ExternalServiceClient.GetClient(m_Properties.Server)) { //get the tables TableMetadataResult[] tables = client.GetMetadataTables(); //copy results tables.ToList().ForEach(t => { m_Tables.Add(new TableMetadata() { Catalog = t.Catalog, Table = t.Table, Remarks = t.Table }); }); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } ////Mentions //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "Mentions", // Remarks = "Mentions" //}); ////Tags //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "Tags", // Remarks = "Tags" //}); ////Datasources //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "Datasources", // Remarks = "Datasources" //}); ////Themes //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "Themes", // Remarks = "Themes" //}); ////TagMentions //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "TagMentions", // Remarks = "TagMentions" //}); ////DatasourceMentions //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "DatasourceMentions", // Remarks = "DatasourceMentions" //}); ////ThemeMentions //m_Tables.Add(new TableMetadata() //{ // Catalog = Driver.B_CATALOG, // Table = "ThemeMentions", // Remarks = "ThemeMentions" //}); }