SID-02424: no multi line matches for DATABSE_SQL?
| Status: |
Answered |
TWiki version: |
6.1.0 |
Perl version: |
This is perl, v5.10.1 (*) built for x86_64-linux-thread-mult |
| Category: |
DatabasePlugin |
Server OS: |
CentOS release 6.10 (Final), 2.6.32-754.10.1.el6.x86_64 |
Last update: |
6 years ago |
The regex for DATABSE_SQL is written such that you cannot spread the %DATABASE_SQL{...}% expression over multiple lines.
These expressions tend to get lengthy, and spreading the expression over multiple lines would make the topic code more readable.
The regex expressions for DATABASE_REPEAT and DATABASE_SQL_REPEAT (both marked as deprecated) would allow of that.
Is there a good reason why DATABASE_SQL is not using
/%(DATABASE_SQL){(.*?)}%/_dispatch($1, $2)/eogs;
instead of
/%(DATABASE_SQL){(.*)}%/_dispatch($1, $2)/eog;
(in
DataBasePlugin.pm, sub commonTagsHandler)
--
Steffen Loeffler - 2019-12-21
Discussion and Answer
I am not using this plugin (doing mostly
NoSQL stuff). I do not see a reason why this plugin should not support multiple lines.
You proposed change looks good. Did you test it? If so, you can create a new plugin version with this change, or I can do that for you.
--
Peter Thoeny - 2019-12-22
Hi Peter,
It's working for me. I was rather wondering if there are (known) side-effects that I have not encountered.
If you think it's safe please go ahead and create an updated version - that'll be way faster.
as a follow-up question:
It appears that I need to reference columns that I selected in the query by the column name in the format string, even when I use a wild (*) for the select.
How would I reference data that are derived from a sql function, e.g. sql="select add(amount) from someTable"
This same question arises when you want to use sql funtions to format the data (the TWiki format does no provide anything to format floats with a fix number of decimals).
-Steffen
--
Steffen Loeffler - 2019-12-22
I updated the
DatabasePlugin accordingly. Now available in SVN and installer.
Steffen, could you please install and test, and let me know if OK?
--
Peter Thoeny - 2019-12-26
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.