On 13.07.2015 18:09, Madhura Jayaratne wrote:
Hello Madhura,Hi Dan,
MariaDB (5.2.0+) supports virtual columns and the syntax is<type> [GENERATED ALWAYS] AS ( <expression> ) [VIRTUAL | PERSISTENT] [UNIQUE] [UNIQUE KEY] [COMMENT <text>]
While implementing [1], to add parser support for virtual columns, I tried to model this syntax using $FIELD_OPTIONS [2]. Even though I am able to retrieve the expression this way, all the brackets and spaces of the expression are gone. As I understand, this due to the tokenization.
Do you have any suggestion for an alternative approach?
[2] https://github.com/madhuracj/phpmyadmin/commit/b287aae9d56c4ae15d850b47a5f76d49f4f155ba
--
Thanks and Regards,
Madhura Jayaratne
------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/
_______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
The way you approached this was the correct solution, however, there was a bug in my code which skipped white-spaces. I am not sure what exactly you want to extract from that expression and I implemented here [2] a new type of option "expr" that should make your job easier and parse an expression directly.
You can find here [1] a snippet of code I used to parse a CREATE statement that contains virtual fields and the result of the parsing. As you can see, the fact that I used the `Expression` component to parse the expression extracted the function name as well. Anyway, you can continue using the "var" option which will only format the expression, without extracting any information.
[1] https://gist.github.com/udan11/4b6eaee2a1fb7fa315c2
[2] https://github.com/udan11/sql-parser/commit/68ad40b4f30c0ff55d662413729fec4a535a3fec
Best regards,
Dan Ungureanu