コード例 #1
0
ファイル: GatewayDataRecorder.cs プロジェクト: rinavin/RCJS
        protected override void Add(GatewayAdapterCursor gatewayAdapterCursor)
        {
            GatewayRecord record = new GatewayRecord();

            for (int fldIdx = 0; fldIdx < gatewayAdapterCursor.Definition.FieldsDefinition.Count; fldIdx++)
            {
                DBField field = gatewayAdapterCursor.Definition.FieldsDefinition[fldIdx];
                if (field.IsBlob())
                {
                    if (field.IsBinaryBlob())
                    {
                        string blobData = string.Empty;
                        if (!gatewayAdapterCursor.CurrentRecord[fldIdx].IsNull)
                        {
                            string blobDataWithPrefix = BlobType.createFromBytes((byte[])(((GatewayBlob)gatewayAdapterCursor.CurrentRecord[fldIdx].Value).Blob), BlobType.CONTENT_TYPE_BINARY);
                            blobData = BlobType.getString(blobDataWithPrefix);
                        }

                        record.FieldValues.Add(new FieldData(field.DbName,
                                                             blobData,
                                                             gatewayAdapterCursor.CurrentRecord[fldIdx].IsNull));
                    }
                    else
                    {
                        record.FieldValues.Add(new FieldData(field.DbName,
                                                             (((GatewayBlob)gatewayAdapterCursor.CurrentRecord[fldIdx].Value).Blob).ToString(),
                                                             gatewayAdapterCursor.CurrentRecord[fldIdx].IsNull));
                    }
                }
                else
                {
                    record.FieldValues.Add(new FieldData(gatewayAdapterCursor.Definition.FieldsDefinition[fldIdx].DbName,
                                                         gatewayAdapterCursor.CurrentRecord[fldIdx].Value == null ? null : gatewayAdapterCursor.CurrentRecord[fldIdx].Value.ToString(),
                                                         gatewayAdapterCursor.CurrentRecord[fldIdx].IsNull));
                }
            }
            records.Add(record);
        }