Jump to content

Capturing the file structure of a query's resultset


mrherman

Recommended Posts

Let's say that after a complicated (for me!) SELECT query is performed, there is a resultset in memory.  Is there a way to "capture" the file structure of the resultset in a text format for later reference?

 

I've spent some time on this, but cannot find anything about generating a text-based copy of the structure.

 

Thanks for any help!

Link to comment
Share on other sites

Thanks for your reply.  It just seems to me (...and what do I know?...) that this scenario could happen:

 

You are a DBA and you get a call from the boss, saying, "Look, I have a meeting at 3 this afternoon and I need to take with me a copy of the structure of the 'custormers' table.  Could you send a quick email to me with the file structure attached?  Thanks."

 

Without turning to any 3rd-party software, you type something like "SELECT TABLE_STRU FROM customers INTO FILE cust_structure TYPE TEXT" and a neat little text file (cust_structure.txt) is created.

 

Based on the research I have done, MySQL provides nothing this simple.  Am I correct? 

 

BTW, this is not a criticism...If MySQL needed this type of thing, obviously much smarter people than me would have asked for it long ago.

 

Thanks again!

Link to comment
Share on other sites

If the MySQL command line interface doesn't count as 3rd party,

 

[pre]mysql> describe cust;

+------------------+-------------+------+-----+---------+-------+

| Field            | Type        | Null | Key | Default | Extra |

+------------------+-------------+------+-----+---------+-------+

| customer_address | varchar(20) | YES  |    | NULL    |      |

| customer_trips  | int(11)    | YES  |    | NULL    |      |

| fname            | varchar(10) | YES  |    | NULL    |      |

| lname            | varchar(10) | YES  |    | NULL    |      |

| ref              | varchar(10) | YES  |    | NULL    |      |

+------------------+-------------+------+-----+---------+-------+

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.