old_sql 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/README.rdoc +65 -1
  2. metadata +2 -2
data/README.rdoc CHANGED
@@ -46,7 +46,7 @@ This generator will also create a migration that will add a old_sql_admin column
46
46
 
47
47
  If not already installed Devise is setup.
48
48
 
49
- == Setup
49
+ == Creating Reports
50
50
 
51
51
  Configure your reports config/old_sql/report.yml. An example configuration is created when you run the old_sql:install generator.
52
52
 
@@ -78,8 +78,72 @@ Configure your reports config/old_sql/report.yml. An example configuration is cr
78
78
  - 'id'
79
79
  - 'name'
80
80
 
81
+ Create a sql file under config/old_sql/report_sql. The following example is included:
82
+
83
+ SELECT u.id, u.name
84
+ FROM users u
85
+ WHERE u.created_at > date('<%=start_date.gsub('/','-')%>')
86
+ AND u.created_at < date('<%=end_date.gsub('/','-')%>')
87
+
88
+ Optionally create a design file under config/old_sql/report_design:
89
+
90
+ # Old SQL:
91
+ # Example Report Design Document
92
+ #
93
+ # Text not in quotes are column names from the SQL query.
94
+ # Quoted text are labels that will appear in the report.
95
+ # Expressions like ( id + id ) * 10 below must be single
96
+ # space delimited. So (id+id) will not parse correctly.
97
+ #
98
+ # NaN and Infinity are returned as zero.
99
+ #
100
+ # Comments are lines beginning with a hash #. They are
101
+ # stripped when this document is parsed.
102
+ #
103
+ # Values (either columns or expressions) are rounded by default.
104
+ # To disable this set round_report_values to false in
105
+ # config/initializers/old_sql.rb. You can also change the
106
+ # precision, which is 2 by default.
107
+ #
108
+ id,name
109
+ "Example Math Operation",id + id
110
+ "Totals","..."
111
+ "Expression",( id + id ) * 10
112
+ "Divide by Zero 1",0 / 0
113
+ "Divide by Zero 2",1.0 / 0
114
+ "Divide by Zero 3",0.0 / 0.0
115
+ "Rounding",200.0 / 43.0
116
+
117
+ Optionally create a processor under lib/old_sql_report_processor:
118
+
119
+ require 'old_sql/report_processor/base'
120
+
121
+ module OldSql
122
+ module ReportProcessor
123
+ class UserOldSqlDemoProcessor < OldSql::ReportProcessor::Base
124
+
125
+ def parse(resultset)
126
+ init(resultset)
127
+
128
+ Rails.logger.debug "REC: #{@rec}"
129
+
130
+ add_row(nil, [@rec['id'], @rec['name']])
131
+ add_row('Totals', ['...'])
132
+
133
+ @data
134
+ end
135
+ end
136
+ end
137
+ end
138
+
81
139
  == Customize
82
140
 
141
+ All css and html template files can be copied to your installation by executing:
142
+
143
+ rails g old_sql:copy_assets
144
+
145
+ Settings for Old SQL can be configured in config/initializers/old_sql.rb.
146
+
83
147
  == Contributing to old_sql
84
148
 
85
149
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: old_sql
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.11.0
5
+ version: 1.12.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eddie Gonzales
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - ">="
187
187
  - !ruby/object:Gem::Version
188
- hash: 780971945359697670
188
+ hash: 3429982058084266482
189
189
  segments:
190
190
  - 0
191
191
  version: "0"