如何取得datawindow中sql里面所有表的名称
------解决方案--------------------
用dw_1.getselectsql()返回sql语法,然后根据关键字来截取字符
string ls_syntax
integer li_pos
ls_syntax = dw_1.getselectsql()
ls_syntax =lower(ls_syntax)
li_pos = pos(ls_syntax,'from')
ls_syntax = mid(ls_syntax ,li_pos +1)//现在已经截取到了 from后面的字符了 再检查下有没where,
li_pos = pos(ls_syntax,'where')
if li_pos > 0 then
ls_syntax =left(ls_syntax ,li_pos - 1)
else
li_pos = pos(ls_syntax,'group')
if li_pos > 0 then
ls_syntax = left(ls_syntax, li_pos - 1)
else
li_pos = pos(ls_syntax,'order')
if li_pos > 0 then
ls_syntax = left(ls_syntax, li_pos - 1)
end if
end if
end if
得到的字符大概是 table1 , table2,table3 ..或者table1 as t1,table2 as t2,table3 as t3...
在稍微处理下就可以了