コード例 #1
0
        public TemplateRow GetTemplate(long templateId)
        {
            ITableRow row = GetRowByIdentity(templateId);

            if (row != null)
            {
                return(RowConverter.Convert <TemplateRow>(row));
            }

            return(null);
        }
コード例 #2
0
        public LastConnectionProtocolRow GetRow(long lastConnectionId)
        {
            ITableRow row = GetRowByIdentity(lastConnectionId);

            if (row == null)
            {
                return(null);
            }

            return(RowConverter.Convert <LastConnectionProtocolRow>(row));
        }
コード例 #3
0
        public ConnectionGroupRow GetGroupById(long id)
        {
            ITableRow row = this._storage.ConnectionGroupDirectory.GetRowByIdentity(id);

            if (row == null)
            {
                return(null);
            }

            return(RowConverter.Convert <ConnectionGroupRow>(row));
        }
コード例 #4
0
        private List <TemplateRow> GetTemplates()
        {
            List <TemplateRow> templateRows = new List <TemplateRow>();
            List <ITableRow>   rows         = GetRows(null);

            foreach (ITableRow row in rows)
            {
                TemplateRow templateRow = RowConverter.Convert <TemplateRow>(row);

                templateRows.Add(templateRow);
            }

            return(templateRows);
        }
コード例 #5
0
        public List <TemplateRow> GetTemplates(
            string groupName,
            string instanceName,
            string connectionType
            )
        {
            string sqlQuery = string.Format(
                @"SELECT DISTINCT
					 {0}.[{20}]
					,{0}.{6}
					,{0}.{7}
					,{0}.{8}
				FROM
					{2}
					INNER JOIN {1} ON
						{2}.[{21}] = {1}.{9}
					INNER JOIN {3} ON
						{1}.[{22}] = {3}.{10}
					INNER JOIN {4} ON
						{4}.[{23}] = {3}.{11}
					INNER JOIN {5} ON
						{5}.[{24}] = {4}.{12}
					INNER JOIN {0} ON
						{0}.[{20}] = {5}.{13}
				WHERE
					{2}.{14} = '{17}'
					AND {1}.{15} = '{18}'
					AND {1}.{16} = '{19}'"                    ,
                TemplateDirectory.TableName,
                ServerInstanceDirectory.TableName,
                ConnectionGroupDirectory.TableName,
                QueryDirectory.TableName,
                TemplateNodeQueryDirectory.TableName,
                TemplateNodeDirectory.TableName,
                TemplateDirectory.NameFieldName,
                TemplateDirectory.IdFieldName,
                TemplateDirectory.DirFieldName,
                ConnectionGroupDirectory.TableName.AsFk(),
                ServerInstanceDirectory.TableName.AsFk(),
                TemplateNodeQueryDirectory.TableName.AsFk(),
                TemplateNodeDirectory.TableName.AsFk(),
                TemplateDirectory.TableName.AsFk(),
                ConnectionGroupDirectory.NameFn,
                ServerInstanceDirectory.ConnectionNameFn,
                ServerInstanceDirectory.DbTypeFn,
                groupName,
                instanceName,
                connectionType,

                TemplateDirectory.TableIdentityField,
                ConnectionGroupDirectory.TableIdentityField,
                ServerInstanceDirectory.TableIdentityField,
                TemplateNodeQueryDirectory.TableIdentityField,
                TemplateNodeDirectory.TableIdentityField
                );

            List <TemplateRow> result = new List <TemplateRow>();

            TableDefinition definition = TemplateDirectory.CreateTableDefinition();

            new SqlSelectCommand(
                this._storage.Connection,
                sqlQuery,
                reader =>
            {
                ITableRow row = TableRow.Read(definition, reader);
                result.Add(RowConverter.Convert <TemplateRow>(row));
            }
                ).Execute(100);

            return(result);
        }
コード例 #6
0
        public List <NodeInstanceRow> GetScheduledInstances()
        {
            List <NodeInstanceRow> scheduledInstances = new List <NodeInstanceRow>();

            using (this.Connection.OpenWrapper())
            {
                String query = string.Format(
                    "SELECT"
                    + "     node.{0}"
                    + "    ,node.{1}"
                    + "    ,tmnode.{6}"
                    + "    ,tm.{8}"
                    + "    ,node.[date_updated]"
                    + "    ,node.[{11}]"
                    + " FROM"
                    + "    [{2}] node"
                    + "    INNER JOIN {7} tmnode ON"
                    + "       tmnode.[{12}] = node.{1}"
                    + "    INNER JOIN {9} tm ON"
                    + "       tm.[{13}] = tmnode.{10}"
                    + "    INNER JOIN {4} tS ON"
                    + "       tS.[{3}] = node.[{11}]"
                    + " WHERE"
                    + "    node.{5} = 1;",
                    ConnectionIdFn,
                    TemplateNodeIdFn,
                    TableName,
                    ScheduleSettingsTable.TemplateNodeFk,
                    ScheduleSettingsTable.TableName,
                    NodeEnabledFn,
                    TemplateNodeDirectory.NameFn,
                    TemplateNodeDirectory.TableName,
                    TemplateDirectory.IdFieldName,
                    TemplateDirectory.TableName,
                    TemplateNodeDirectory.TemplateIdFn,
                    IdentityField,
                    TemplateNodeDirectory.TableIdentityField,
                    TemplateDirectory.TableIdentityField
                    );

                _Log.InfoFormat(@"query:'{0}'",
                                query
                                );

                TableDefinition definition = CreateTableDefinition();

                using (this.Connection.OpenWrapper())
                {
                    using (SQLiteCommand cmd = new SQLiteCommand(query, this.Connection))
                    {
                        using (SQLiteDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                ITableRow row = TableRow.Read(definition, reader);

                                row.Values.Add(TemplateNodeDirectory.NameFn, reader[2]);
                                row.Values.Add(TemplateDirectory.IdFieldName, reader[3]);

                                scheduledInstances.Add(RowConverter.Convert <NodeInstanceRow>(row));
                            }
                        }
                    }
                }

                return(scheduledInstances);
            }
        }