[Maria-developers] Getting the columns from LEX or THD
Hi all, I wanted to retrieve a tables columns i.e its schema definition when a query is executed. I figured out LEX and THD structures store these in different variables for different queries. I wanted to get the same when a simple INSERT query is executed, e.g INSERT INTO <table> VALUES(<values>). Where can I find it? Is there any mechanism to get a tables schema that will work for any kind of query? Thanks, Sriram
Hi, Sriram! On Jun 14, Sriram Patil wrote:
Hi all,
I wanted to retrieve a tables columns i.e its schema definition when a query is executed. I figured out LEX and THD structures store these in different variables for different queries.
I wanted to get the same when a simple INSERT query is executed, e.g INSERT INTO <table> VALUES(<values>). Where can I find it?
Is there any mechanism to get a tables schema that will work for any kind of query?
You're working on MaxScale now, so, I'm guessing that you only have the parser and have all the data that the parser created, but no more. In that case, the answer is no, it is impossible to get a table schema (or all table columns). Most probably you only have the information that the parser has, that was contained in the query. Table definition is stored in the real dbms server, the proxy doesn't have it, as far as I understand. Regards, Sergei
Thank you Sergei. We need to think of a work-around now. On Mon, Jun 15, 2015 at 11:48 PM, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Sriram!
On Jun 14, Sriram Patil wrote:
Hi all,
I wanted to retrieve a tables columns i.e its schema definition when a query is executed. I figured out LEX and THD structures store these in different variables for different queries.
I wanted to get the same when a simple INSERT query is executed, e.g INSERT INTO <table> VALUES(<values>). Where can I find it?
Is there any mechanism to get a tables schema that will work for any kind of query?
You're working on MaxScale now, so, I'm guessing that you only have the parser and have all the data that the parser created, but no more.
In that case, the answer is no, it is impossible to get a table schema (or all table columns). Most probably you only have the information that the parser has, that was contained in the query. Table definition is stored in the real dbms server, the proxy doesn't have it, as far as I understand.
Regards, Sergei
participants (2)
-
Sergei Golubchik
-
sriram patil