[sql] multiline text was not returned correctly

pull/254/head
Timothy Stack 9 years ago
parent b76b6175c6
commit 6f26aa7f3e

@ -357,12 +357,11 @@ static int vt_column(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int col)
else {
shared_buffer_ref line;
if (lf->read_line(ll, line)) {
sqlite3_result_text(ctx,
line.get_data(),
line.length(),
SQLITE_TRANSIENT);
}
lf->read_full_message(ll, line);
sqlite3_result_text(ctx,
line.get_data(),
line.length(),
SQLITE_TRANSIENT);
}
}
else {
@ -370,7 +369,7 @@ static int vt_column(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int col)
logfile::iterator line_iter;
line_iter = lf->begin() + cl;
lf->read_line(line_iter, vc->log_msg);
lf->read_full_message(line_iter, vc->log_msg);
vt->vi->extract(lf, vc->log_msg, vc->line_values);
}

@ -502,3 +502,20 @@ check_output "access_log not found within syslog file" <<EOF
log_line,log_part,log_time,log_idle_msecs,log_level,log_mark,c_ip,cs_method,cs_referer,cs_uri_query,cs_uri_stem,cs_user_agent,cs_username,cs_version,sc_bytes,sc_status
1,p.0,2015-03-24 14:02:50.000,6927348000,info,0,127.0.0.1,GET,<NULL>,<NULL>,/includes/js/combined-javascript.js,<NULL>,-,HTTP/1.1,65508,200
EOF
run_test ${lnav_test} -n \
-c ";select log_text from generic_log" \
-c ":write-json-to -" \
${test_dir}/logfile_multiline.0
check_output "multiline data is not right?" <<EOF
[
{
"log_text": "2009-07-20 22:59:27,672:DEBUG:Hello, World!\n How are you today?"
},
{
"log_text": "2009-07-20 22:59:30,221:ERROR:Goodbye, World!"
}
]
EOF

Loading…
Cancel
Save