aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2008-03-01 23:56:19 -0500
committerBrian Cully <bjc@kublai.com>2008-03-01 23:56:19 -0500
commitd86216b6176ce1587584cb988bf73e6825ad3bb8 (patch)
tree36edc17f1fa384e4ad8b3276d9a417a855d493a2 /src
parentf5b510318a8f2062e79f2b73e6d13413c22a28b2 (diff)
downloadmysqlerl-d86216b6176ce1587584cb988bf73e6825ad3bb8.tar.gz
mysqlerl-d86216b6176ce1587584cb988bf73e6825ad3bb8.zip
Fix i/j tyop.
Diffstat (limited to 'src')
-rw-r--r--src/mysqlerl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mysqlerl.c b/src/mysqlerl.c
index d4b9065..b1729f6 100644
--- a/src/mysqlerl.c
+++ b/src/mysqlerl.c
@@ -214,9 +214,14 @@ handle_sql_query(MYSQL *dbh, ETERM *cmd)
rowtup = (ETERM **)malloc(num_fields * sizeof(ETERM *));
for (j = 0; j < num_fields; j++) {
logmsg("DEBUG: rows[%d][%d]: %s", i, j, row[j]);
- rowtup[i] = erl_format("~s", row[j]);
+ rowtup[j] = erl_format("~s", row[j]);
}
+ logmsg("DEBUG: making tuple of %d", num_fields);
rt = erl_mk_tuple(rowtup, num_fields);
+ if (rt == NULL) {
+ logmsg("ERROR: couldn't allocate %d-tuple", num_fields);
+ exit(3);
+ }
rows[i] = erl_format("~w", rt);
for (j = 0; j < num_fields; j++)