database-js icon indicating copy to clipboard operation
database-js copied to clipboard

Add support to TXT files

Open thiagodp opened this issue 7 years ago • 0 comments

Proposal

database-js-txt

Virtual Columns

Text files could have these virtual columns:

  1. line (any line of the file)
  2. line_number

Examples:

# Line starting with Hello
SELECT `line_number`, `line` WHERE `line` LIKE "Hello%"

# First line in the file
SELECT `line` WHERE `line_number` = 1

# Number of lines in the file
SELECT COUNT( `line` )

# Number of lines in the file, different way
SELECT MAX( `line_number` )

# Last line in the file
SELECT `line` WHERE `line_number` = COUNT( `line` )

# Content from some lines
SELECT `line` WHERE `line_number` BETWEEN 5 AND 10

# Content from some lines, different way (needed?)
SELECT `line` OFFSET 5 LIMIT 5

Basic Operators

=, <>, >, >=, <, <=, LIKE, NOT, AND, OR, BETWEEN

Basic Constructions

WHERE, ORDER BY

Basic Functions

COUNT, MAX

Expected future enhancements

  • MATCHES operator, for matching a given regular expression. E.g., SELECT * WHERE line MATCHES "^Created at [0-9]{1,2}:[0-9]{1,2}"

thiagodp avatar Mar 01 '18 16:03 thiagodp