Пример #1
0
        private ResultInfoList GetResultInfoList(
            Dictionary <string, IEnumerable <Tuple <string, bool> > > tableColumnNamesList
            , ResultInfoAST.PrimaryKeyCompletion primaryKeyCompletion = ResultInfoAST.PrimaryKeyCompletion.None)
        {
            var stmt = this.GetStmt();

            // SELECT文以外は処理の対象外である
            if (stmt.Type != StmtType.Select)
            {
                return(new ResultInfoList());
            }

            // ResultInfoASTに渡すためのテーブル列情報を作成する
            var tableColumns = new Dictionary <string, IEnumerable <TableResultInfo> >();

            foreach (var tableColumnNames in tableColumnNamesList)
            {
                var tableName           = tableColumnNames.Key;
                var tableResultInfoList = new List <TableResultInfo>();
                foreach (var tableColumnName in tableColumnNames.Value)
                {
                    var isPrimaryKey    = tableColumnName.Item2;
                    var tableResultInfo = new TableResultInfo(tableName, tableColumnName.Item1, !isPrimaryKey, isPrimaryKey);
                    tableResultInfoList.Add(tableResultInfo);
                }
                tableColumns.Add(tableName, tableResultInfoList);
            }
            // SELECT句の解析を行う
            var resultInfoAST = new ResultInfoAST((SelectStmt)stmt, tableColumns, primaryKeyCompletion);

            return(resultInfoAST.GetResultInfoList());
        }
Пример #2
0
        private ResultInfoList GetResultInfoList(
            string tableName
            , IEnumerable <Tuple <string, bool> > tableColumnNames
            , ResultInfoAST.PrimaryKeyCompletion primaryKeyCompletion = ResultInfoAST.PrimaryKeyCompletion.None)
        {
            var tableColumnNamesList = new Dictionary <string, IEnumerable <Tuple <string, bool> > >()
            {
                { tableName, tableColumnNames }
            };

            return(this.GetResultInfoList(tableColumnNamesList, primaryKeyCompletion));
        }