Hi,

Viktor Szakáts wrote:
Or, RDDSQL itself may track these changes and automatically generate
the UPDATE/INSERT requests to SQL server. Given that the recordset
can be the result of any kind of queries, this doesn't seem to be doable
(seemed a good idea for a few minutes though :).

The problem is more complex. Let's say I use:
  DBUSEAREA(.T.,, "select code from purchase", "purchase")
  CODE := 1234

In this case I'm unable to generate update query, because I have no ID column in workarea resultset. So, I'm unable to generate UPDATE query at all.

To generate automatic query you need to define a primary key id, it can have any name: ID, ITEM_ID, or BLAH. Some table may not contain a single primary numeric id column, the can be uniquely defined using a few fields:
   UPDATE purchase SET amount=5 WHERE order="AB00647" AND code=1234

Some tables may not have a update meaning at all:
DBUSEAREA(.T.,, "select code,count(*) as count from purchase group by code", "purchase")
  COUNT := 9876

Another difference between DBF and SQL is that: DBAPPEND() adds record to table, later you assign (or not) field values. In SQL you INSERT query do both inserts record and assigns values as one atomic operation. This makes some more issues.

Because of above I have not implemented automatic UPDATE/INSERT operations in RDD.


Regards,
Mindaugas

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to