Question

I am trying to figure out how I can use a JDBC connection and SQL statements to read DBF/CDX tables that reside on an Advantage Database Server (using a free connection) and find "deleted" records. (Those records that are logically deleted and not physically deleted.)

I know that I can include or exclude deleted records using a connection property, however my question is how to include them and then later identify them.

Was it helpful?

Solution

Unfortunately, I don't think there is a simple way to do that through JDBC and an SQL-only solution. As you state, it is possible to display the logically deleted records by including ShowDeleted=true; in the connection string. But after doing that, it is not possible to distinguish between the deleted and non-deleted DBF records in an SQL statement.

It might be possible to write an Advantage Extended Procedure that used a navigational approach to return information about logically deleted records, but that could be a fair bit of work to do from scratch. Another idea (a rather messy/ugly one) would be to maybe use two separate connections to the same table where one shows deleted records and the other doesn't and then get ROWIDs and use that to isolate the deleted records. Not fun.

It doesn't help you now, but the forthcoming release (v12) will contain an SQL scalar function DELETED() that returns true/false for logically deleted records. That is exactly what you need but won't be available until later in 2014.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top