csv_query 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ stored in CSV files.
6
6
 
7
7
  For example:
8
8
 
9
- $ csvq --select "count(*)" sample.csv
9
+ $ csvq --select "count(*)" --where "name='Jakob'" sample.csv
10
10
  count(*)
11
11
  --------
12
12
  1
@@ -30,7 +30,7 @@ module CsvQuery
30
30
  opts.on(
31
31
  "-q",
32
32
  "--query SQL",
33
- "The SQL query to run on the dataset. If specified --select and --where will be ignored."
33
+ "The SQL query to run on the dataset. The table name to select data from is named \"csv\", ie \"--query 'SELECT * FROM csv'\" recreates default behavior. If specified --select and --where will be ignored."
34
34
  ) do |q|
35
35
  options[:sql_query] = q
36
36
  end
@@ -38,7 +38,7 @@ module CsvQuery
38
38
  def create_database_and_table(csv)
39
39
  database = SQLite3::Database.new(':memory:')
40
40
 
41
- column_definitions = csv.headers.collect { |name| "#{name} VARCHAR(255)" }
41
+ column_definitions = csv.headers.collect { |name| "\"#{name}\" VARCHAR(255)" }
42
42
  database.execute "CREATE TABLE csv (#{column_definitions.join(", ")})"
43
43
 
44
44
  database
@@ -1,3 +1,3 @@
1
1
  module CsvQuery
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-06 00:00:00.000000000 Z
12
+ date: 2012-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3