myadm

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

commit 9dd390e9425eda9339e76ff8aa3b55001485a20d
parent 1f8162ff525bd1e7574deea44c48d2606ff5df49
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Tue,  3 May 2016 23:05:55 +0200

Steal some sloc to mysql_exec()

Diffstat:
Mmyadm.c | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/myadm.c b/myadm.c @@ -434,17 +434,14 @@ int mysql_exec(const char *sqlstr, ...) { va_list ap; char *sql; - int sqlen; + int sqlen, r; va_start(ap, sqlstr); sqlen = vasprintf(&sql, sqlstr, ap); va_end(ap); - if(mysql_real_query(mysql, sql, sqlen)) { - free(sql); - return -1; - } + r = mysql_real_query(mysql, sql, sqlen); free(sql); - return mysql_field_count(mysql); + return (r ? -1 : mysql_field_count(mysql)); } int