예제 #1
0
        public static ITable <T> DB2iDeclareTempTable <T>(this DataConnection dc, string tableName, bool withReplace, IEnumerable <T> data)
        {
            var footer    = withReplace ? " WITH REPLACE" : "";
            var tempTable = dc.CreateTable <T>(tableName, statementHeader: DB2iTempTableStatementHeaderFormat, statementFooter: footer);

            // Dim rows = (From x In data Select x).insert(tempTable, Function(xx) 1)
            if (data != null)
            {
                foreach (var row in data)
                {
                    DataExtensions.Insert((IDataContext)row, tableName);
                }
            }
            return(tempTable);
        }