• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 798
  • Last Modified:

Query inmemory dataset

I have created an inmemory dataset with a few columns and several rows. I now want to query the dataset to get a result which is a count of similar text items such as select count(names) from dataset group by names. How can I query an in-memory dataset to get this result?
0
stonemeadow
Asked:
stonemeadow
  • 3
  • 2
1 Solution
 
paulo_psaCommented:
I suppose it is a ClientDataSet, so you can:

ClientDataSet.filtered := true;
ClientDataSet.filter := 'fieldname = 'value''; {here you filter what you want}
ClientDataSet.filtered := true;
x := ClientDataSet.recordcount; {here you check how many fields you get}
0
 
stonemeadowAuthor Commented:
I am familiar with filtering but want to query the dataset as if it were a Table.
0
 
Geert GOracle dbaCommented:
how did you create your data
are using a TStringList, TClientDataset, etc ?

what do you understand under query data ?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
stonemeadowAuthor Commented:
The dataset is a TTable without a database backend. All fields are created using the FieldDef's property. You can create fields of float, string  etc. and populate the table using insert, append etc. as if it were a database table. After the data is populated, it would be nice to 'query' the table using sql commands. That is what I am looking to do.
0
 
Geert GOracle dbaCommented:
doesn't work unless you use a 'embedded' database

you will allways need a engine to interpret the 'query'
otherwise you'll have to write your own engine to do that

you could use absolute database for a single file db
http://www.componentace.com/bde_replacement_database_delphi_absolute_database.htm
or an extreme in memory db:
http://www.mcobject.com/extremedbfamily.shtml?gclid=CIKqnubdnaECFYSD3godlSRPxg
or local files, like SQLite
http://www.sqlite.org/
0
 
stonemeadowAuthor Commented:
Solution makes sense. I appreciate the reference to these products.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now