When I save a view on MySQL, it is "rewritten". How I can avoid this?
Example, when saving this view:
SELECT * FROM `cont开发者_如何学Cas_users`
It is rewritten to:
select `contas_users`.`id` AS `id`,`contas_users`.`username` AS
`username`,`contas_users`.`password` AS `password` from `contas_users`
I want to avoid this behavior (can be locally only), because I need do some tests, and copy/past to a TXT is too slow and boring.
You should not care what mysql does with your query internally.
You should be managing your SQL source is some form of source control, but even if you aren't, you should work with your SQL source (text) files only, then execute them as a script to mysql.
I found the solution for that, but works only in specific configurations. Here works fine. The original SOURCE is stored on a file .frm of VIEW. See code below:
SELECT LOAD_FILE(CONCAT(@@GLOBAL.datadir, 'tablename/viewname.frm'));
You cannot avoid it. It is MySQL behavior.
精彩评论