Sha256: 48be6d5ca0e9d41abc294aaa47f59bfaab38b5a0a49f299b1abc338d029e6594
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
#!/usr/bin/env ruby require_relative '../lib/hsql/command_line' command_line = HSQL::CommandLine.new options = command_line.options filename = command_line.filename unless filename puts command_line.option_parser exit 1 end begin file = File.new(filename) rescue Errno::ENOENT puts "#{filename.inspect}: No such file" exit 1 end require_relative '../lib/hsql' file = HSQL::File.parse_file(file, options) if 'yaml' == options[:meta_only] puts file.to_yaml elsif 'json' == options[:meta_only] puts file.to_json else # Runs the whole SQL string through the parser to find the individual queries # and then deparses it file.queries.each do |query| warn '-- Parsed and deparsed SQL:' if command_line.options[:verbose] begin puts query rescue => e warn "-- #{e.inspect}" if command_line.options[:verbose] puts file.rendered_sql end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hsql-0.3.8 | bin/hsql |
hsql-0.3.7 | bin/hsql |