mrherman Posted May 18, 2008 Share Posted May 18, 2008 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 https://forums.phpfreaks.com/topic/106237-capturing-the-file-structure-of-a-querys-resultset/ Share on other sites More sharing options...
fenway Posted May 19, 2008 Share Posted May 19, 2008 Why not just write it out originally? If it's hasn't been too long, it might still be cached when you run SELECT... INTO OUTFILE. Link to comment https://forums.phpfreaks.com/topic/106237-capturing-the-file-structure-of-a-querys-resultset/#findComment-544734 Share on other sites More sharing options...
mrherman Posted May 19, 2008 Author Share Posted May 19, 2008 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 https://forums.phpfreaks.com/topic/106237-capturing-the-file-structure-of-a-querys-resultset/#findComment-544811 Share on other sites More sharing options...
Barand Posted May 19, 2008 Share Posted May 19, 2008 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 https://forums.phpfreaks.com/topic/106237-capturing-the-file-structure-of-a-querys-resultset/#findComment-545137 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.