<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 14, 2015 at 4:27 AM, Dan Ungureanu <span dir="ltr"><<a href="mailto:udan1107@gmail.com" target="_blank">udan1107@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <div>On 13.07.2015 18:09, Madhura Jayaratne
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <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 href="https://sourceforge.net/p/phpmyadmin/feature-requests/1517/" target="_blank">https://sourceforge.net/p/phpmyadmin/feature-requests/1517/</a></div>
        <div>[2] <a href="https://github.com/madhuracj/phpmyadmin/commit/b287aae9d56c4ae15d850b47a5f76d49f4f155ba" target="_blank">https://github.com/madhuracj/phpmyadmin/commit/b287aae9d56c4ae15d850b47a5f76d49f4f155ba</a><br clear="all">
          <div><br>
          </div>
          -- <br>
          <div>Thanks and Regards,
            <div><br>
            </div>
            <div>Madhura Jayaratne<br>
              <div><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>------------------------------------------------------------------------------
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 href="https://www.gigenetcloud.com/" target="_blank">https://www.gigenetcloud.com/</a></pre>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Phpmyadmin-devel mailing list
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">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 href="https://gist.github.com/udan11/4b6eaee2a1fb7fa315c2" target="_blank">https://gist.github.com/udan11/4b6eaee2a1fb7fa315c2</a><br>
    [2]
<a href="https://github.com/udan11/sql-parser/commit/68ad40b4f30c0ff55d662413729fec4a535a3fec" target="_blank">https://github.com/udan11/sql-parser/commit/68ad40b4f30c0ff55d662413729fec4a535a3fec</a><br>
    <br>
    Best regards,<br>
    Dan Ungureanu<br>
  </div>

<br></blockquote><div> </div><div>Thanks Dan. </div><div>I've taken the latest version of sql-parser into phpMyAdmin in [1]. I've used the parsed output to detect the expression in MariaDB generated columns and it works fine.</div><div>Btw, great job with parser rewrite!</div><div><br></div><div>[1] <a href="https://github.com/phpmyadmin/phpmyadmin/commit/d90ebfe96b820271649011b10b020c67d7f096af">https://github.com/phpmyadmin/phpmyadmin/commit/d90ebfe96b820271649011b10b020c67d7f096af</a></div></div><br><div>-- <br></div><div class="gmail_signature">Thanks and Regards,<div><br></div><div>Madhura Jayaratne<br><div><br></div></div></div>
</div></div>