Hello,
In EDConnectorDb.php there is a statement (line 54), which removes table prefixes from column names:
// Deal with table prefixes in column names (internal_var=tbl1.col1). if ( preg_match( '/[^.]+$/', $alias, $matches ) ) { $alias = $matches[0]; }
It works fine in most cases, but when, for example, we have the following #get_db_data, with column value in an SQL expression
{{#get_db_data: |db=enc |from=enccategorylinks=ecl,encpage=p |join on=ecl.cl_from=p.page_id |where=ecl.cl_to='Gimę_{{CURRENTMONTHNAMEGEN}}_{{LOCALDAY}}_d.' |limit=200 |order by=ecl.cl_sortkey asc |data=asm=p.page_title,asmt=replace(p.page_title, '_', ' ') }}
it turns replace(p.page_title, '_', ' ') into page_title, '_', ' ') and things break. Expected SQL would be
SELECT p.page_title,replace(p.page_title, '_', ' ') …
but the result is
SELECT p.page_title,page_title, '_', ' ') …
As a workaround I use strpbrk() to check whether column name is not just table.column, but instead is evaluated from an SQL expression
if ( !strpbrk($alias, '\(\)\'\\",') ) { if ( preg_match( '/[^.]+$/', $alias, $matches ) ) { $alias = $matches[0]; } }
So this “fixes” articles involved, but then I don't know how important it is to remove table name prefixes and perhaps there can be a better workaround. Thanks for any comment on this.