Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 10 of 11 total |
Invalid signature in stream data |
Wed, Jan 11 2006 11:19 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
I'm doing a data conversion. During it I'm extracting stuff from a memo field in one table (sorted using HKStreams) into a TDBISAMTable and then streaming that table into a memo field in the new table. Works great for some but others I get the error above when trying to retrieve the data from the new table. Any ideas? Roy Lambert |
Wed, Jan 11 2006 2:08 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
I've eliminated all of the records that don't have anything in the memo field and all those that stream properly (1742) and attached the remainder (232) where they don't. Since I'm incapable of peering inside them can you have a shuftie and tell me what's going wrong. TIA Roy Lambert function Smts(Fld: string; SrcTbl: TDBISAMDataset; DestTbl: TDBISAMTable): boolean; var ms: TMemoryStream; begin try DestTbl.Close; DestTbl.Exclusive := True; DestTbl.EmptyTable; DestTbl.Close; DestTbl.Exclusive := False; DestTbl.Open; if not SrcTbl.FieldByName(Fld).IsNull then begin ms := TMemoryStream.Create; try TMemoField(SrcTbl.FieldByName(Fld)).SaveToStream(ms); DestTbl.LoadFromStream(ms); DestTbl.Refresh; DestTbl.First; finally ms.Free; end; end; Result := True; except Result := False; end; end; Attachments: mandn.zip |
Wed, Jan 11 2006 4:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< I've eliminated all of the records that don't have anything in the memo field and all those that stream properly (1742) and attached the remainder (232) where they don't. >> I don't know what happened to those memo fields, but they appear to all have 3 bytes in them, which is less than what is required for a DBISAM table stream header. How were the memo fields populated ? -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Jan 12 2006 3:25 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>I don't know what happened to those memo fields, but they appear to all have >3 bytes in them, which is less than what is required for a DBISAM table >stream header. How were the memo fields populated ? All 1974 records were populated the same way. Were the 3 bytes the same in each case, if so what are they and I'll simply junk those on data transfer. procedure TForm1.ObtainInLinePics; var Cntr: integer; imgStream: TStringStream; imgStr: string; PicStream: TMemoryStream; begin InLinePics.First; while not InLinePics.Eof do InLinePics.Delete; ilMgr.ClearStreams; imgStream := TStringStream.Create(imgStr); if DoingEMails then imgStream.WriteString(impTbl.FieldByName('_InLine').AsString) else if DoingHistory then imgStream.WriteString(Source.FieldByName('_InLine').AsString); ilMgr.LoadFromStream(imgStream); imgStream.Free; if ilMgr.StreamList.Count > 0 then begin for Cntr := 0 to ilMgr.StreamList.Count - 1 do begin try with InLinePics do begin PicStream := TMemoryStream.Create; ilMgr.GetStream(ilMgr.StreamList[Cntr], PicStream); Insert; FieldByName('_Name').AsString := ilMgr.StreamList[Cntr]; FieldByName('_CID').AsString := ilMgr.StreamList[Cntr]; FieldByName('_Web').AsBoolean := False; FieldByName('_Size').AsInteger := PicStream.Size; TMemoField(FieldByName('_Item')).LoadFromStream(PicStream); Post; PicStream.Free; end; except if InLinePics.State in dsEditModes then InLinePics.Cancel; end; end; end; if InLinePics.RecordCount > 0 then begin if DoingEMails then begin InLinePics.First; while not InLinePics.Eof do InLinePics.Delete; end else if DoingHistory then begin ReturnTableToMemo('_InLine', InLinePics, Source); end; end else begin if DoingEMails then begin ClearField('_InLine', luMandN); end else if DoingHistory then begin ClearField('_InLine', Source); end; end; end; procedure TForm1.ClearField(Fld: string; DestTbl: TDBISAMTable); var WasEditing: boolean; begin WasEditing := (DestTbl.State in dsEditModes); if not WasEditing then GetRecordLock(DestTbl, 200); DestTbl.FieldByName(Fld).AsString := 'x*x'; if not WasEditing then DestTbl.Post; end; |
Thu, Jan 12 2006 11:20 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Were the 3 bytes the same in each case, if so what are they and I'll simply junk those on data transfer. >> I didn't look that closely, but what the 3 bytes are is probably irrelevant anyways. In your code, what does the GetStream function or procedure look like ? My guess is that there's an issue in there somewhere. DBISAM will never save just 3 bytes as a table stream - the signature alone is 16 bytes. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Jan 12 2006 11:47 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>In your code, what does the GetStream function or procedure look like ? My >guess is that there's an issue in there somewhere. DBISAM will never save >just 3 bytes as a table stream - the signature alone is 16 bytes. procedure THKStreams.GetStream(const ID: string; Dest: TStream); var i: integer; begin if (length(id) > 0) then begin i := Streamlist.IndexOf(ID); if i >= 0 then dest.CopyFrom(TMemoryStream(Streamlist.objects[i]), 0); dest.Position := 0; end; end; But even if that is a problem I'm using this component to populate a TDBISAMTable which is the stuffed into a memo field with procedure ReturnTableToMemo(Fld: string; SrcTbl, DestTbl: TDBISAMTable); var ms: TMemoryStream; WasEditing: boolean; begin ms := TMemoryStream.Create; try SrcTbl.SaveToStream(ms); WasEditing := (DestTbl.State in dsEditModes); if not WasEditing then GetRecordLock(DestTbl, 200); if SrcTbl.RecordCount > 0 then TMemoField(DestTbl.FieldByName(Fld)).LoadFromStream(ms) else DestTbl.FieldByName(Fld).Clear; if not WasEditing then DestTbl.Post; finally ms.Free; end; end; So wouldn't it be here where the problem arose? If it was in the earlier code the table shouldn't have been populated. Roy Lambert |
Fri, Jan 13 2006 9:55 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
It was actually me. I'd forgotten to "clean up" the column after processing. Roy Lambert |
Fri, Jan 13 2006 3:54 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< It was actually me. I'd forgotten to "clean up" the column after processing. >> Well, that makes it: Tim - 1 Roy - 43 -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Jan 13 2006 3:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
Just to clarify - what I was poking fun at was me. Usually the problems you bring up are my fault, not yours, but it was hard to say that for sure from my post. -- Tim Young Elevate Software www.elevatesoft.com |
Sat, Jan 14 2006 4:00 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
There is NO need to clarify those type of jokes - I enjoy them regardless of who they're aimed at. And anyway I'd suggest more like Tim - 27 Roy - 34 Roy Lambert |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |