myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

commit 3afa246eb5346087b06b400e04014541f0c28526
parent d237edbb05fb09afee7584402e7b8ba468b447d7
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sat, 14 May 2016 16:55:50 +0200

Prevent having garbage if errors.

Diffstat:
Mmyadm.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/myadm.c b/myadm.c @@ -434,8 +434,10 @@ mksql_alter_table(char *sql, char *tbl) { int size = MAXQUERYLEN+1, len = 0, r; r = mysql_exec("describe `%s`", tbl); - if(r == -1 || !(res = mysql_store_result(mysql))) + if(r == -1 || !(res = mysql_store_result(mysql))) { + *sql = '\0'; return; + } mysql_items(res, &items); mysql_free_result(res); for(item = items; item; item = item->next) {