Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
Description
Goal
the goal is to remove all these INSTR/REPLACE/SUBSTR/etc that replication tests are using to figure out the topology. The ultimate goal is: mysqltest should only send those commands to the server that constitute a test case, not anything it needs internally for itself.
Options
bash-like substitutions
- ${var}
- ${parameter:offset:length}
- ${#parameter}
- ${parameter/pattern/string/flags} — same as in replace_regex
- perhaps ${parameterˆ}, ${parameterˆˆ}, ${parameter,}, ${parameter,,}
- or ${parameter@function}, like ${a@U}, ${a@qs} or even ${a@uppercase}, ${a@shellquote}
- $( expression ) see MDEV-36107
also, repetition
- ${parameter*N}
and recursive expansion:
- ${${var}}
The problem — it's difficult to extend. There is a syntax for SUBSTR(), but if we'd like to add INSTR() we'd need to invent another combination of punctuation characters inside curly braces. E.g. ${parameter%substring} It's difficult to remember and there are only so many punctuation characters.
functions — this is currently the preferred approach
$( instr($a, "foo") ) or, more complex, $( substr($a, 1, instr($a, "/") )
this is more extendable that bash syntax. Function names should be the same as in SQL to not force users to learn a new language
cmake-like generator expressions
$<instr:$a:foo>, or, more complex, $<substr:$a:1:$<instr:$a:/>>
also more extendable than bash. Naturally string substitutions. Looks very weird.
Attachments
Issue Links
- relates to
-
MDEV-36107 expressions in mysqltest
-
- Open
-
-
MDEV-12130 Improve mysqltest language
-
- Open
-
Are we certain that we don’t want to just switch to a scripting-based framework (Perl, Python, Ruby, etc.)?