0

I'm very sorry if this is going to be a bad question. I've done very little database programming. This might be the time to read up on it from scratch, which I will probably do at some point, but I'm pressed for time right now.

Is there a way I can perform DataSet-like operations e.g. Inserts, Deletes, etc, on an Oracle database without caching a chunk of the database? I'm looking for something to avoid typing awkward SQL queries for objects with arbitrary fields/columns. Something where I could just define a DataRow and Insert it (or Update it based on some key). I don't see how I can do this with caching, since I can't possibly cache the whole database. It's pretty big.

Because the entities are largely arbitrary, I don't want to define static classes to wrap them.

GregRos
  • 8,667
  • 3
  • 37
  • 63

3 Answers3

2

I am not sure if I fully understood your question. You can create a class which with a method to do Upsert. That method would receive a DataRow and you can set the rule in the method to either insert or update the database according to values in datarow. But you have to write your own SQL queries to insert or to check whether the record exists in the db and then do update.

Why not use ORMs. Something like Entity frameowkrk, NHibernate

  1. Entity Framework
  2. NHibernate

You will not be required to write any SQL query and you can customize the options to enable LazzyLoading

Habib
  • 219,104
  • 29
  • 407
  • 436
  • This is what I should do, but honestly, I'm afraid learning those frameworks might take more time than I have. I really want a quick fix for this one, at least right at this moment. – GregRos May 28 '12 at 13:46
1

If you are using typed DataSet You can provide parameters for your Fill methods. Making them fill DataTable with only the neccessary rows.

If you are using DataReader you can provide any kind of query in your query string.

Basicly You can 'cache' only the rows You want to change.

Grzegorz W
  • 3,487
  • 1
  • 21
  • 21
0

a little difficult to tell what you really need...

but you can query Oracle data dictionary views for metadata then dynamically construct your SQl statements based on those results.

Randy
  • 16,480
  • 1
  • 37
  • 55
  • I basically want to do operations like on a DataSet/DataTable *without* caching with the Fill method. Unless I somehow misunderstand and it doesn't cache the whole table. – GregRos May 28 '12 at 12:35