Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Tue, 1 Oct 2013, Dennis Poon wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? Simply said: You cannot. Can any one suggest an in-memory dataset in fpc/lazarus that allows direct access? Does TMemDataset allow it? No. The architecture of TDataset does not allow this. The buffer mechanism is quite complicated, and there are quite some layers to go through. T(Mem)Dataset is not just an array of records. The records can be at wildly different locations, the values may or may not be computed. Blobs are stored entirely in different locations etc. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Mon, 30 Sep 2013, Marcos Douglas wrote: On Mon, Sep 30, 2013 at 8:09 AM, Dennis Poon den...@avidsoft.com.hk wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? [...] You can use buf.RecNo and buf.FieldByName('field_name') OR buf.Fields[i]. This is not direct memory access. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
Dennis Poon wrote / napísal(a): Also, how do I use the procedure LoadFromStream(AStream : TStream; Format: TDataPacketFormat = dfAny)? Especially, I don't understand the TDataPacketFormat parameter. Using Format parameter you can signal to DatapacketReader in which format expect data (dfBinary, dfXML etc) It is not required , when not set there is procedure which tests incoming data using RecognizeStream method and select those DatapacketReader, which is able handle incoming data. In other words each registered DataPacketReader is able say if is able handle data in stream or not. (examines begining of stream and looks for own format identification) -Laco. Let me clarify. How do I SaveToStream from another TDataset descendant and LoadFromStream in TBufdataSet? I am trying to call SaveToStream from some Delphi TDataset Descendent to to be loaded by FPC's TBufdataSet.LoadFromStream. How should I do it? Can you try SaveToStream(..., dfXML) ? Because Binary formats are not compatible between Delphi and FPC But in XML should be situation better ;-) If you encounter any incompatibility please let us know ... (and attach XML saved by Delphi + if possible any test application) -Laco. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
Michael Van Canneyt wrote: On Tue, 1 Oct 2013, Dennis Poon wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? Simply said: You cannot. Can any one suggest an in-memory dataset in fpc/lazarus that allows direct access? Does TMemDataset allow it? No. The architecture of TDataset does not allow this. The buffer mechanism is quite complicated, and there are quite some layers to go through. T(Mem)Dataset is not just an array of records. The records can be at wildly different locations, the values may or may not be computed. Blobs are stored entirely in different locations etc. Michael. That is too bad. I used to use TdxMemData from DevExpress and it allows such direct access. The benefit is record can be accessed without CHANGING the current record pointer which will trigger updating of all linked DB controls (that could be time consuming or even confusing to the user). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Tue, 1 Oct 2013, Dennis Poon wrote: Michael Van Canneyt wrote: On Tue, 1 Oct 2013, Dennis Poon wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? Simply said: You cannot. Can any one suggest an in-memory dataset in fpc/lazarus that allows direct access? Does TMemDataset allow it? No. The architecture of TDataset does not allow this. The buffer mechanism is quite complicated, and there are quite some layers to go through. T(Mem)Dataset is not just an array of records. The records can be at wildly different locations, the values may or may not be computed. Blobs are stored entirely in different locations etc. Michael. That is too bad. I used to use TdxMemData from DevExpress and it allows such direct access. Yes, it is possible to construct such a descendent. But in the general case it is not possible to provide this mechanism. Maybe bufdataset can be extended to deliver this, but I would not hold my breath waiting for this. I also used TdxMemData, but didn't see such mechanism. Of course, I never looked for it :) The benefit is record can be accessed without CHANGING the current record pointer which will trigger updating of all linked DB controls (that could be time consuming or even confusing to the user). I understand the benefits. But if you need such access, then I think that TDataset is not for you. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] how to directly access field/record value of TBufDataSet?
Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? At this stage, I only need to read the value, no to write it. Also, how do I use the procedure LoadFromStream(AStream : TStream; Format: TDataPacketFormat = dfAny)? Especially, I don't understand the TDataPacketFormat parameter. Any help is greatly appreciated. Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Mon, 30 Sep 2013, Dennis Poon wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? Simply said: You cannot. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Monday 30 September 2013 13:09:16 Dennis Poon wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? The MSEgui version of tbufdataset and its descendants supports direct field value access by property currentas*[const afield: tfield; aindex: integer]: * I fear that this will not help you. :-( Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
Dennis Poon wrote / napísal(a): Also, how do I use the procedure LoadFromStream(AStream : TStream; Format: TDataPacketFormat = dfAny)? Especially, I don't understand the TDataPacketFormat parameter. Using Format parameter you can signal to DatapacketReader in which format expect data (dfBinary, dfXML etc) It is not required , when not set there is procedure which tests incoming data using RecognizeStream method and select those DatapacketReader, which is able handle incoming data. In other words each registered DataPacketReader is able say if is able handle data in stream or not. (examines begining of stream and looks for own format identification) -Laco. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
Also, how do I use the procedure LoadFromStream(AStream : TStream; Format: TDataPacketFormat = dfAny)? Especially, I don't understand the TDataPacketFormat parameter. Using Format parameter you can signal to DatapacketReader in which format expect data (dfBinary, dfXML etc) It is not required , when not set there is procedure which tests incoming data using RecognizeStream method and select those DatapacketReader, which is able handle incoming data. In other words each registered DataPacketReader is able say if is able handle data in stream or not. (examines begining of stream and looks for own format identification) -Laco. Let me clarify. How do I SaveToStream from another TDataset descendant and LoadFromStream in TBufdataSet? I am trying to call SaveToStream from some Delphi TDataset Descendent to to be loaded by FPC's TBufdataSet.LoadFromStream. How should I do it? Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? Simply said: You cannot. Can any one suggest an in-memory dataset in fpc/lazarus that allows direct access? Does TMemDataset allow it? Thanks. Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to directly access field/record value of TBufDataSet?
On Mon, Sep 30, 2013 at 8:09 AM, Dennis Poon den...@avidsoft.com.hk wrote: Since TBufDataSet is in-memory, to speed things up, how can I directly access the N'th record and M'th field's value as Variant? [...] You can use buf.RecNo and buf.FieldByName('field_name') OR buf.Fields[i]. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal