[yunqa.de] Re: how to connect DISQLite3UniDirQuery to a dataset?

  • From: H M <docshotmail2@xxxxxxxxxxx>
  • To: DISQLite3 mailing list <yunqa@xxxxxxxxxxxxx>
  • Date: Sun, 10 Jul 2011 15:42:54 +0000

That's it!

Thank you Ralf

I think it might have been both the string grid restriction and me not knowing 
about the TDISQLite3UniDirQuery.OnInitFieldDef event.
Since the grid, the desgin report preview and the running report preview all 
truncated I thought it was just one problem.
 
Having used that event to set the length to 4000 my report correctly shows long 
strings ( the grid still shows truncated ones but I can live with that as it is 
being used for debugging and does not show in the app.)
That has saved me many hours.

It's a bit of a shame that there is no real documentation for these components 
(ie a list of what all the methods and properties are for.) You have to keep 
experimenting or searching through demo programs without really knowing what 
you are looking for. 

Thank goodness for this group and the exerienced people on it! 
Regards
Howard 



> Date: Sat, 9 Jul 2011 11:59:13 +0200
> From: delphi@xxxxxxxx
> To: yunqa@xxxxxxxxxxxxx
> Subject: [yunqa.de] Re: how to connect DISQLite3UniDirQuery to a dataset?
> 
> On 07.07.2011 15:31, H M wrote:
> 
> > I use Fastreport4 with Delhpi 2009 to produce reports from tables,
> > datasets and queries. It uses anything of type Tdataset as a source.Google

> > 
> > However it will not work with DISQLite3UniDirQuery, producing an error
> > 'operation not allowed on a unidirectional query' (nor can I even attach
> > a TDBgrid to a DISQLite3UniDirQuery for the same reason) - I think I
> > understand why this is the case.
> 
> TDISQLite3UniDirQuery is a unidirectional TDataSet. Applications can
> retrieve next records, but not previous ones. This closely models
> SQLite's sqlite3_step() function, which can step forward but not back.
> 
> TDBGrid requires to retrieve previous records if users scroll up the
> grid. The solution is to cache the grid records, for example using
> TClientDataSet.
> 
> > To try to resolve this I played with TClientdataset as follows;
> > 
> > TDISLite3Database  ---> DISQLite3UniDirQuery  --> TDatasetProvider  -->
> > TClientDataSet   --> TDatasource  --> TDBgrid -
> 
> Correct. See the DISQLite3_ClientDataSet_Grid and DISQLite3_World demos
> for examples.
> 
> > Ths displays data OK but because of the bug in TDatasetProvider it
> > truncates all string fields to 30 characters, so this combination is of
> > no use.
> 
> By default, Delphi's TStringField is limited to 20 characters. Is this
> the limit you are seeing?
> 
> Unlike TStringField, DISQLite3 can handle text / string fields of
> virtually unlimited size. To display those fields well with Delphi,
> assign the TDISQLite3UniDirQuery.OnInitFieldDef event. There you can
> override the default field types and sizes. See the
> DISQLite3_ClientDataSet_Grid demo for an example implementation.
> 
> > Question
> > 
> > How can I take to output of a DISQLite3UniDirQuery and get it into
> > something of type TDataSet that can be displayed in a dbgrid or used by
> > Fastreport4 (and show the correct field data without truncating)?
> > 
> > Your web site says iDISQLite3 has TdataSet support but I cannot for the
> > life of me find out how to do it.
> 
> I have attached a simple FastReport 4 project that uses DISQLite3's
> TDISQLite3UniDirQuery as  its dataset. As it turned out, FastReport
> works well with TDISQLite3UniDirQuery and can also retrieve long strings
> exceeding the 20 characters limit.
> 
> Ralf
                                          

Other related posts: