RowID

djeanveau

New Member
Good day everyone!

Is it possible to search a whole database for a specific ROWID without having to identify the table name it's in?

:blush:
 
I don't think that rowid is unique for while db, but here is a function that returns the table(s) that contain the supplied rowid:
Code:
function TablesFromRowid returns char
	(ipc_rowid as char):

	def var lc_return as char no-undo.
	def var lh_buffer as handle no-undo.
	def var lh_query as handle no-undo.

	for each _file no-lock where not _file._hidden:
	
		create buffer lh_buffer for table _file._file-name buffer-name "lb_table".
		
		create query lh_query.
		
		lh_query:set-buffers(lh_buffer).
		
		lh_query:query-prepare("for each lb_table no-lock where " +
			"rowid(lb_table) = to-rowid('" + lc_tmp + "')").
	
		lh_query:query-open.
		lh_query:get-next().
	
		if not lh_query:query-off-end
		then lc_return = lc_return + "," + _file._file-name.
	
		delete object lh_query.
		delete object lh_buffer.
	end.
	return substring(lc_return, 2).
end.
 
Top