<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 13.07.2015 18:09, Madhura Jayaratne
wrote:<br>
</div>
<blockquote
cite="mid:CAC5h4aNv7-O4ippy0FmswxvBccOB4UosU9Ta3EZVheJYo0K0RQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Dan,
<div><br>
</div>
<div>MariaDB (5.2.0+) supports virtual columns and the syntax
is </div>
<div><type> [GENERATED ALWAYS] AS ( <expression>
) [VIRTUAL | PERSISTENT] [UNIQUE] [UNIQUE KEY] [COMMENT
<text>]</div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>Do you have any suggestion for an alternative approach?</div>
<div><br>
</div>
<div>[1] <a moz-do-not-send="true"
href="https://sourceforge.net/p/phpmyadmin/feature-requests/1517/">https://sourceforge.net/p/phpmyadmin/feature-requests/1517/</a></div>
<div>[2] <a moz-do-not-send="true"
href="https://github.com/madhuracj/phpmyadmin/commit/b287aae9d56c4ae15d850b47a5f76d49f4f155ba">https://github.com/madhuracj/phpmyadmin/commit/b287aae9d56c4ae15d850b47a5f76d49f4f155ba</a><br
clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">Thanks and Regards,
<div><br>
</div>
<div>Madhura Jayaratne<br>
<div><br>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">------------------------------------------------------------------------------
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.
<a class="moz-txt-link-freetext" href="https://www.gigenetcloud.com/">https://www.gigenetcloud.com/</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Phpmyadmin-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a>
</pre>
</blockquote>
Hello Madhura,<br>
<br>
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.<br>
<br>
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.<br>
<br>
[1] <a class="moz-txt-link-freetext" href="https://gist.github.com/udan11/4b6eaee2a1fb7fa315c2">https://gist.github.com/udan11/4b6eaee2a1fb7fa315c2</a><br>
[2]
<a class="moz-txt-link-freetext" href="https://github.com/udan11/sql-parser/commit/68ad40b4f30c0ff55d662413729fec4a535a3fec">https://github.com/udan11/sql-parser/commit/68ad40b4f30c0ff55d662413729fec4a535a3fec</a><br>
<br>
Best regards,<br>
Dan Ungureanu<br>
</body>
</html>