Example #1
0
        private void GenSelectClauseForField(InternalBookmarkItem bmItem, ref GenOsqlParamInfo paramInfo)
        {
            string     itemName = BaseMarkupUtilities.GetOriginalBizName(bmItem.Key, bmItem.BizName);
            DSTreeView item     = paramInfo.DomainInfo.GetField(itemName);
            DSIconType type     = (DSIconType)Enum.Parse(typeof(DSIconType), bmItem.ItemType);

            double     i         = Math.Log((double)bmItem.TableIndex, (double)2);
            DSOnClause table     = paramInfo.DomainInfo.DSDomainData.OnClauses.Items[bmItem.TableIndex];
            string     tableName = table.Alias;

            paramInfo.PutSelectedTable(tableName, false);
            paramInfo.SelectedTableIndexes.Add(item.TableIndex);

            UpdateSelectedColumns(ref paramInfo, tableName, itemName);
            InternalBookmarkItem existedItem = paramInfo.DataTagFields.FirstOrDefault(a => a.TableIndex == item.TableIndex && a.DSIconType == DSIconType.Field);
            bool isImageTrunc = bmItem.IsTruncImage();

            if (isImageTrunc && existedItem != null && existedItem.BizName == bmItem.BizName && !paramInfo.TablesHasField.Contains(item.TableIndex))
            { // this table has only image that is chunked then we need to add one default column
                GenSelectClauseItem(DSIconType.Field, item.TechName,
                                    string.Empty, Guid.NewGuid().ToString(), false, true, ref paramInfo);
                paramInfo.TablesHasField.Add(item.TableIndex);
                paramInfo.HasImage = true;
            }
            GenSelectClauseItem(type, bmItem.TechName, item.JavaClause, itemName, bmItem.IsTruncImage(), true, ref paramInfo);

            if (!string.IsNullOrEmpty(item.RenderXYOrder))
            {
                List <string> renderParam = item.RenderXYOrder.Split(';').ToList <string>();
                for (int j = 0; j < renderParam.Count; j++)
                {
                    AddItemToListJParameters((renderParam[j] == "1") ? FrameworkConstants.RenderArgumentX : FrameworkConstants.RenderArgumentY,
                                             ref paramInfo, OracleQueryConstants.DicSelectClauseParamName);
                }
            }

            #region Build Extra field
            if (existedItem == null && !string.IsNullOrEmpty(item.OrginalField) && !paramInfo.TablesHasField.Contains(item.TableIndex))
            {
                GenSelectClauseItem(DSIconType.Field, item.OrginalField, string.Empty, Guid.NewGuid().ToString(), false, true, ref paramInfo);
                paramInfo.TablesHasField.Add(item.TableIndex);
                return;
            }
            #endregion
        }
Example #2
0
        private void GenSelectClauseForFields(ref GenOsqlParamInfo paramInfo)
        {
            paramInfo.HasImage = false;
            paramInfo.HasField = false;
            if (paramInfo.DataTagFields != null && paramInfo.DataTagFields.Count > 0)
            {
                paramInfo.OrderDataTagFieldsByTableIndex();
                List <List <InternalBookmarkItem> > paths = GetPaths(ref paramInfo, paramInfo.DataTagFields, paramInfo.DomainInfo.DSDomainData);
                foreach (List <InternalBookmarkItem> path in paths)
                {
                    if (path.Count <= 0)
                    {
                        continue;
                    }

                    paramInfo.OsqlStringBuilder = new OsqlStringBuilder();
                    paramInfo.OsqlStringBuilder.AppendLine(OracleQueryConstants.SelectClause);
                    paramInfo.DSRelationRow = null;
                    // add paramater for watermark at start of query for osql & jsql
                    paramInfo.OsqlStringBuilder.Osql.AppendLine(string.Format(OracleQueryConstants.SQLSystemInfo,
                                                                              ProntoDoc.Framework.CoreObject.FrameworkConstants.PdwWatermark,
                                                                              ProntoDoc.Framework.CoreObject.FrameworkConstants.PdwWatermark) + OracleQueryConstants.SQLComma);
                    paramInfo.OsqlStringBuilder.JOsql.AppendLine(string.Format(OracleQueryConstants.JSQLSystemInfo,
                                                                               ProntoDoc.Framework.CoreObject.FrameworkConstants.PdwWatermark) + OracleQueryConstants.SQLComma);
                    paramInfo.OsqlStringBuilder.SelectedColumns = string.Empty;
                    paramInfo.CurrentTableName = string.Empty;
                    paramInfo.PutSelectedTable(string.Empty, true);
                    paramInfo.SelectedTableIndexes = new List <int>();
                    foreach (InternalBookmarkItem item in path)
                    {
                        DSIconType type = item.DSIconType;
                        if (type == DSIconType.Field)
                        {
                            paramInfo.HasField = true;
                        }

                        if (type == DSIconType.USC)
                        {
                            string sqlUSC      = GenSelectClauseForUSC(item, ref paramInfo);
                            string itemBizName = BaseMarkupUtilities.GetOriginalBizName(item.Key, item.BizName);
                            GenSelectClauseItem(type, sqlUSC, string.Empty, itemBizName, false, true, ref paramInfo);

                            string tableName = paramInfo.SelectedTables[0][0];
                            UpdateSelectedColumns(ref paramInfo, tableName, itemBizName);
                        }
                        else
                        {
                            if (item.Relation != null)
                            {
                                if (paramInfo.DSRelationRow == null)
                                {
                                    paramInfo.DSRelationRow = item.Relation.Clone();
                                }
                                else
                                {
                                    paramInfo.DSRelationRow.OrRow(item.Relation);
                                }
                            }

                            GenSelectClauseForField(item, ref paramInfo);
                        }

                        if (item != null && item.DataType != null &&
                            (item.DataType.Name == SQLTypeName.BINARY || item.DataType.Name == SQLTypeName.VARBINARY))
                        {
                            paramInfo.HasImage = true;
                        }
                    }
                    UpdateOsqlXmlItem(ref paramInfo);
                }
            }
        }