mirror of
https://github.com/tstack/lnav
synced 2024-11-15 18:13:10 +00:00
[sql] add some more internal state functions
This commit is contained in:
parent
af3d2a432f
commit
025ca0586b
@ -101,7 +101,6 @@ libdiag_a_SOURCES = \
|
|||||||
ansi_scrubber.cc \
|
ansi_scrubber.cc \
|
||||||
bookmarks.cc \
|
bookmarks.cc \
|
||||||
collation-functions.cc \
|
collation-functions.cc \
|
||||||
datetime-extension-functions.cc \
|
|
||||||
extension-functions.c \
|
extension-functions.c \
|
||||||
fs-extension-functions.cc \
|
fs-extension-functions.cc \
|
||||||
grep_proc.cc \
|
grep_proc.cc \
|
||||||
@ -126,6 +125,7 @@ libdiag_a_SOURCES = \
|
|||||||
pcrepp.cc \
|
pcrepp.cc \
|
||||||
piper_proc.cc \
|
piper_proc.cc \
|
||||||
sql_util.cc \
|
sql_util.cc \
|
||||||
|
state-extension-functions.cc \
|
||||||
strnatcmp.c \
|
strnatcmp.c \
|
||||||
textview_curses.cc \
|
textview_curses.cc \
|
||||||
view_curses.cc \
|
view_curses.cc \
|
||||||
|
@ -107,20 +107,19 @@ am__v_AR_1 =
|
|||||||
libdiag_a_AR = $(AR) $(ARFLAGS)
|
libdiag_a_AR = $(AR) $(ARFLAGS)
|
||||||
libdiag_a_LIBADD =
|
libdiag_a_LIBADD =
|
||||||
am_libdiag_a_OBJECTS = ansi_scrubber.$(OBJEXT) bookmarks.$(OBJEXT) \
|
am_libdiag_a_OBJECTS = ansi_scrubber.$(OBJEXT) bookmarks.$(OBJEXT) \
|
||||||
collation-functions.$(OBJEXT) \
|
collation-functions.$(OBJEXT) extension-functions.$(OBJEXT) \
|
||||||
datetime-extension-functions.$(OBJEXT) \
|
fs-extension-functions.$(OBJEXT) grep_proc.$(OBJEXT) \
|
||||||
extension-functions.$(OBJEXT) fs-extension-functions.$(OBJEXT) \
|
hist_source.$(OBJEXT) line_buffer.$(OBJEXT) \
|
||||||
grep_proc.$(OBJEXT) hist_source.$(OBJEXT) \
|
listview_curses.$(OBJEXT) lnav_commands.$(OBJEXT) \
|
||||||
line_buffer.$(OBJEXT) listview_curses.$(OBJEXT) \
|
lnav_config.$(OBJEXT) lnav_util.$(OBJEXT) log_format.$(OBJEXT) \
|
||||||
lnav_commands.$(OBJEXT) lnav_config.$(OBJEXT) \
|
logfile.$(OBJEXT) logfile_sub_source.$(OBJEXT) \
|
||||||
lnav_util.$(OBJEXT) log_format.$(OBJEXT) logfile.$(OBJEXT) \
|
|
||||||
logfile_sub_source.$(OBJEXT) \
|
|
||||||
network-extension-functions.$(OBJEXT) data_scanner.$(OBJEXT) \
|
network-extension-functions.$(OBJEXT) data_scanner.$(OBJEXT) \
|
||||||
data_parser.$(OBJEXT) readline_curses.$(OBJEXT) \
|
data_parser.$(OBJEXT) readline_curses.$(OBJEXT) \
|
||||||
session_data.$(OBJEXT) sequence_matcher.$(OBJEXT) \
|
session_data.$(OBJEXT) sequence_matcher.$(OBJEXT) \
|
||||||
sqlite-extension-func.$(OBJEXT) statusview_curses.$(OBJEXT) \
|
sqlite-extension-func.$(OBJEXT) statusview_curses.$(OBJEXT) \
|
||||||
string-extension-functions.$(OBJEXT) pcrepp.$(OBJEXT) \
|
string-extension-functions.$(OBJEXT) pcrepp.$(OBJEXT) \
|
||||||
piper_proc.$(OBJEXT) sql_util.$(OBJEXT) strnatcmp.$(OBJEXT) \
|
piper_proc.$(OBJEXT) sql_util.$(OBJEXT) \
|
||||||
|
state-extension-functions.$(OBJEXT) strnatcmp.$(OBJEXT) \
|
||||||
textview_curses.$(OBJEXT) view_curses.$(OBJEXT) \
|
textview_curses.$(OBJEXT) view_curses.$(OBJEXT) \
|
||||||
vt52_curses.$(OBJEXT) log_vtab_impl.$(OBJEXT) \
|
vt52_curses.$(OBJEXT) log_vtab_impl.$(OBJEXT) \
|
||||||
xterm_mouse.$(OBJEXT) yajlpp.$(OBJEXT) yajl.$(OBJEXT) \
|
xterm_mouse.$(OBJEXT) yajlpp.$(OBJEXT) yajl.$(OBJEXT) \
|
||||||
@ -432,7 +431,6 @@ libdiag_a_SOURCES = \
|
|||||||
ansi_scrubber.cc \
|
ansi_scrubber.cc \
|
||||||
bookmarks.cc \
|
bookmarks.cc \
|
||||||
collation-functions.cc \
|
collation-functions.cc \
|
||||||
datetime-extension-functions.cc \
|
|
||||||
extension-functions.c \
|
extension-functions.c \
|
||||||
fs-extension-functions.cc \
|
fs-extension-functions.cc \
|
||||||
grep_proc.cc \
|
grep_proc.cc \
|
||||||
@ -457,6 +455,7 @@ libdiag_a_SOURCES = \
|
|||||||
pcrepp.cc \
|
pcrepp.cc \
|
||||||
piper_proc.cc \
|
piper_proc.cc \
|
||||||
sql_util.cc \
|
sql_util.cc \
|
||||||
|
state-extension-functions.cc \
|
||||||
strnatcmp.c \
|
strnatcmp.c \
|
||||||
textview_curses.cc \
|
textview_curses.cc \
|
||||||
view_curses.cc \
|
view_curses.cc \
|
||||||
@ -617,7 +616,6 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collation-functions.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collation-functions.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_parser.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_parser.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_scanner.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_scanner.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datetime-extension-functions.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extension-functions.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extension-functions.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-extension-functions.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-extension-functions.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@
|
||||||
@ -640,6 +638,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session_data.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session_data.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_util.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_util.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqlite-extension-func.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqlite-extension-func.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state-extension-functions.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statusview_curses.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statusview_curses.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-extension-functions.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-extension-functions.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnatcmp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnatcmp.Po@am__quote@
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
sqlite_registration_func_t sqlite_registration_funcs[] = {
|
sqlite_registration_func_t sqlite_registration_funcs[] = {
|
||||||
common_extension_functions,
|
common_extension_functions,
|
||||||
datetime_extension_functions,
|
state_extension_functions,
|
||||||
string_extension_functions,
|
string_extension_functions,
|
||||||
network_extension_functions,
|
network_extension_functions,
|
||||||
fs_extension_functions,
|
fs_extension_functions,
|
||||||
|
@ -63,8 +63,8 @@ typedef int (*sqlite_registration_func_t)(const struct FuncDef **basic_funcs,
|
|||||||
int common_extension_functions(const struct FuncDef **basic_funcs,
|
int common_extension_functions(const struct FuncDef **basic_funcs,
|
||||||
const struct FuncDefAgg **agg_funcs);
|
const struct FuncDefAgg **agg_funcs);
|
||||||
|
|
||||||
int datetime_extension_functions(const struct FuncDef **basic_funcs,
|
int state_extension_functions(const struct FuncDef **basic_funcs,
|
||||||
const struct FuncDefAgg **agg_funcs);
|
const struct FuncDefAgg **agg_funcs);
|
||||||
|
|
||||||
int string_extension_functions(const struct FuncDef **basic_funcs,
|
int string_extension_functions(const struct FuncDef **basic_funcs,
|
||||||
const struct FuncDefAgg **agg_funcs);
|
const struct FuncDefAgg **agg_funcs);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @file datetime-extension-functions.cc
|
* @file state-extension-functions.cc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -42,7 +42,14 @@
|
|||||||
#include "sql_util.hh"
|
#include "sql_util.hh"
|
||||||
#include "sqlite-extension-func.h"
|
#include "sqlite-extension-func.h"
|
||||||
|
|
||||||
static void sql_logline_datetime(sqlite3_context *context,
|
static void sql_log_top_line(sqlite3_context *context,
|
||||||
|
int argc, sqlite3_value **argv)
|
||||||
|
{
|
||||||
|
sqlite3_result_int64(context,
|
||||||
|
(int64_t)lnav_data.ld_views[LNV_LOG].get_top());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sql_log_top_datetime(sqlite3_context *context,
|
||||||
int argc, sqlite3_value **argv)
|
int argc, sqlite3_value **argv)
|
||||||
{
|
{
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
@ -55,11 +62,12 @@ static void sql_logline_datetime(sqlite3_context *context,
|
|||||||
sqlite3_result_text(context, buffer, strlen(buffer), SQLITE_TRANSIENT);
|
sqlite3_result_text(context, buffer, strlen(buffer), SQLITE_TRANSIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int datetime_extension_functions(const struct FuncDef **basic_funcs,
|
int state_extension_functions(const struct FuncDef **basic_funcs,
|
||||||
const struct FuncDefAgg **agg_funcs)
|
const struct FuncDefAgg **agg_funcs)
|
||||||
{
|
{
|
||||||
static const struct FuncDef datetime_funcs[] = {
|
static const struct FuncDef datetime_funcs[] = {
|
||||||
{ "logline_datetime", 0, 0, SQLITE_UTF8, 0, sql_logline_datetime },
|
{ "log_top_line", 0, 0, SQLITE_UTF8, 0, sql_log_top_line },
|
||||||
|
{ "log_top_datetime", 0, 0, SQLITE_UTF8, 0, sql_log_top_datetime },
|
||||||
|
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user