HPCC-12408 Various code generator optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
It means if there is an expression (ds.myrow) then the table that needs to be recorded is "ds".  In various bits of the code this is called the base cursor.