예제 #1
0
        public static DataParams SerializableParamDataToDataParams(Alphora.Dataphor.DAE.IServerProcess process, SerializableParamData paramsValue)
        {
            if ((paramsValue.Params != null) && (paramsValue.Params.Length > 0))
            {
                DataParams     localParamsValue = new DataParams();
                Schema.RowType rowType          = new Schema.RowType();
                for (int index = 0; index < paramsValue.Params.Length; index++)
                {
                    rowType.Columns.Add(new Schema.Column(paramsValue.Params[index].Name, (Schema.ScalarType)process.Session.Server.Catalog[paramsValue.Params[index].TypeName]));
                }

                Data.Row row = new Data.Row(process.ValueManager, rowType);
                try
                {
                    row.ValuesOwned = false;
                    row.AsPhysical  = paramsValue.Data.Data;

                    for (int index = 0; index < paramsValue.Params.Length; index++)
                    {
                        if (row.HasValue(index))
                        {
                            localParamsValue.Add(new DataParam(row.DataType.Columns[index].Name, row.DataType.Columns[index].DataType, SerializableModifierToModifier(paramsValue.Params[index].Modifier), Data.DataValue.CopyValue(process.ValueManager, row[index])));
                        }
                        else
                        {
                            localParamsValue.Add(new DataParam(row.DataType.Columns[index].Name, row.DataType.Columns[index].DataType, SerializableModifierToModifier(paramsValue.Params[index].Modifier), null));
                        }
                    }

                    return(localParamsValue);
                }
                finally
                {
                    row.Dispose();
                }
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public static SerializableParamData DataParamsToSerializableParamData(Alphora.Dataphor.DAE.IServerProcess process, DataParams paramsValue)
        {
            int paramCount = paramsValue != null ? paramsValue.Count : 0;

            if (paramCount > 0)
            {
                Schema.RowType rowType = new Schema.RowType();
                if (paramsValue != null)
                {
                    foreach (DataParam param in paramsValue)
                    {
                        rowType.Columns.Add(new Schema.Column(param.Name, param.DataType));
                    }
                }
                using (Data.Row row = new Data.Row(process.ValueManager, rowType))
                {
                    row.ValuesOwned = false;
                    SerializableParamData localParamsValue = new SerializableParamData();
                    localParamsValue.Params = new SerializableParam[paramCount];
                    for (int index = 0; index < paramCount; index++)
                    {
                        localParamsValue.Params[index].Name     = paramsValue[index].Name;
                        localParamsValue.Params[index].TypeName = paramsValue[index].DataType.Name;
                        localParamsValue.Params[index].Modifier = ModifierToSerializableModifier(paramsValue[index].Modifier);
                        if (paramsValue[index].Value != null)
                        {
                            row[index] = paramsValue[index].Value;
                        }
                    }
                    // TODO: Not able to adapt this without adding a common StreamManager public property
                    //EnsureOverflowReleased(AProcess, LRow);
                    localParamsValue.Data.Data = row.AsPhysical;
                    return(localParamsValue);
                }
            }
            else                // optimization
            {
                return(new SerializableParamData());
            }
        }