internal override object ConvertRuntimeFieldToGateway(DBField dbField, string runtimeValue) { GatewayBlob gatewayValue = new GatewayBlob(); gatewayValue.Blob = BlobType.getBytes(runtimeValue); gatewayValue.blobContent = BlobContent.Binary; gatewayValue.BlobSize = BlobType.getBlobSize(runtimeValue); return(gatewayValue); }
internal override object ConvertRuntimeFieldToGateway(DBField dbField, string runtimeValue) { Debug.Assert(BlobType.getContentType(runtimeValue) == BlobType.CONTENT_TYPE_ANSI); GatewayBlob gatewayValue = new GatewayBlob(); gatewayValue.Blob = BlobType.getString(runtimeValue); gatewayValue.blobContent = BlobContent.Ansi; gatewayValue.BlobSize = BlobType.getBlobSize(runtimeValue); return(gatewayValue); }
/// <summary> /// fm_flds_mg_2_db /// Converts a record from magic presentation to gateway /// </summary> protected void ConvertToGateway(GatewayAdapterCursor gatewayAdapterCursor) { FieldValues currentRecord = gatewayAdapterCursor.CurrentRecord; FieldValues runtimeRecord = RuntimeCursor.RuntimeCursorData.CurrentValues; for (int i = 0; i < currentRecord.Count; i++) { currentRecord[i].IsNull = runtimeRecord.IsNull(i); if (currentRecord[i].IsNull) { currentRecord[i].Value = null; } else { DBField dbField = gatewayAdapterCursor.Definition.FieldsDefinition[i]; if (ValueInGatewayFormat) { if (dbField.IsBlob()) { GatewayBlob blob = new GatewayBlob(); blob.Blob = runtimeRecord.GetValue(i); if (dbField.Storage == magicsoftware.util.FldStorage.Blob) { blob.BlobSize = ((Byte[])runtimeRecord.GetValue(i)).Length; } else { blob.BlobSize = ((string)runtimeRecord.GetValue(i)).Length; } currentRecord[i].Value = blob; } else { currentRecord[i].Value = runtimeRecord.GetValue(i); } } else { string trimValue = ((string)runtimeRecord.GetValue(i)).TrimEnd(); currentRecord[i].Value = GatewayAdapter.StorageConvertor.ConvertRuntimeFieldToGateway(dbField, trimValue); } } } }