old_sql 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| 
         @@ -6,6 +6,7 @@ module OldSql 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  COLUMN = 1
         
     | 
| 
       7 
7 
     | 
    
         
             
                  LABEL = 2
         
     | 
| 
       8 
8 
     | 
    
         
             
                  OPERATOR = 3
         
     | 
| 
      
 9 
     | 
    
         
            +
                  NUMERIC_LITERAL = 4
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  def initialize(value)
         
     | 
| 
       11 
12 
     | 
    
         
             
                    @data = value
         
     | 
| 
         @@ -15,12 +16,13 @@ module OldSql 
     | 
|
| 
       15 
16 
     | 
    
         
             
                  private
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
18 
     | 
    
         
             
                  def set_type
         
     | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
       19 
     | 
    
         
            -
                    @type = case first_char
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @type = case @data[0]
         
     | 
| 
       20 
20 
     | 
    
         
             
                            when /['"]/
         
     | 
| 
       21 
21 
     | 
    
         
             
                              LABEL
         
     | 
| 
       22 
     | 
    
         
            -
                            when /[ 
     | 
| 
      
 22 
     | 
    
         
            +
                            when /[\/*+-\Q()]/
         
     | 
| 
       23 
23 
     | 
    
         
             
                              OPERATOR
         
     | 
| 
      
 24 
     | 
    
         
            +
                            when /[0-9]/
         
     | 
| 
      
 25 
     | 
    
         
            +
                              NUMERIC_LITERAL
         
     | 
| 
       24 
26 
     | 
    
         
             
                            else
         
     | 
| 
       25 
27 
     | 
    
         
             
                              COLUMN
         
     | 
| 
       26 
28 
     | 
    
         
             
                            end
         
     | 
| 
         @@ -59,7 +59,7 @@ module OldSql 
     | 
|
| 
       59 
59 
     | 
    
         
             
                      r.each do |key, value|
         
     | 
| 
       60 
60 
     | 
    
         
             
                        cell << value
         
     | 
| 
       61 
61 
     | 
    
         
             
                      end
         
     | 
| 
       62 
     | 
    
         
            -
                       
     | 
| 
      
 62 
     | 
    
         
            +
                      add_row(nil, cell)
         
     | 
| 
       63 
63 
     | 
    
         
             
                    end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                    @data
         
     | 
| 
         @@ -79,7 +79,8 @@ module OldSql 
     | 
|
| 
       79 
79 
     | 
    
         
             
                          if cell.expression?
         
     | 
| 
       80 
80 
     | 
    
         
             
                            if cd.type == OldSql::ReportDesign::CellData::COLUMN
         
     | 
| 
       81 
81 
     | 
    
         
             
                              expression << @rec[cd.data].to_s
         
     | 
| 
       82 
     | 
    
         
            -
                            elsif cd.type == OldSql::ReportDesign::CellData::OPERATOR
         
     | 
| 
      
 82 
     | 
    
         
            +
                            elsif cd.type == OldSql::ReportDesign::CellData::OPERATOR ||
         
     | 
| 
      
 83 
     | 
    
         
            +
                                  cd.type == OldSql::ReportDesign::CellData::NUMERIC_LITERAL
         
     | 
| 
       83 
84 
     | 
    
         
             
                              expression << cd.data
         
     | 
| 
       84 
85 
     | 
    
         
             
                            end
         
     | 
| 
       85 
86 
     | 
    
         
             
                          else
         
     | 
| 
         @@ -90,10 +91,23 @@ module OldSql 
     | 
|
| 
       90 
91 
     | 
    
         
             
                            end
         
     | 
| 
       91 
92 
     | 
    
         
             
                          end
         
     | 
| 
       92 
93 
     | 
    
         
             
                        end
         
     | 
| 
       93 
     | 
    
         
            -
                        report_row <<  
     | 
| 
      
 94 
     | 
    
         
            +
                        report_row << eval_expression(expression) unless expression.length==0 
         
     | 
| 
       94 
95 
     | 
    
         
             
                      end
         
     | 
| 
       95 
96 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                       
     | 
| 
      
 97 
     | 
    
         
            +
                      add_row(nil, report_row)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    end
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
                  
         
     | 
| 
      
 101 
     | 
    
         
            +
                  def eval_expression expression
         
     | 
| 
      
 102 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 103 
     | 
    
         
            +
                      result = eval(expression)
         
     | 
| 
      
 104 
     | 
    
         
            +
                      if result.to_s!="Infinity"
         
     | 
| 
      
 105 
     | 
    
         
            +
                        return result
         
     | 
| 
      
 106 
     | 
    
         
            +
                      else
         
     | 
| 
      
 107 
     | 
    
         
            +
                        return "0"
         
     | 
| 
      
 108 
     | 
    
         
            +
                      end
         
     | 
| 
      
 109 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 110 
     | 
    
         
            +
                      return "0"
         
     | 
| 
       97 
111 
     | 
    
         
             
                    end
         
     | 
| 
       98 
112 
     | 
    
         
             
                  end
         
     | 
| 
       99 
113 
     | 
    
         | 
| 
         @@ -106,7 +120,7 @@ module OldSql 
     | 
|
| 
       106 
120 
     | 
    
         
             
                    @data[:rows] = []
         
     | 
| 
       107 
121 
     | 
    
         
             
                  end
         
     | 
| 
       108 
122 
     | 
    
         | 
| 
       109 
     | 
    
         
            -
                  def  
     | 
| 
      
 123 
     | 
    
         
            +
                  def add_row(title = nil, cell_data = [], id = @id+1)        
         
     | 
| 
       110 
124 
     | 
    
         
             
                    if !title.nil?
         
     | 
| 
       111 
125 
     | 
    
         
             
                      cell_data.unshift "<b>#{title}</b>"
         
     | 
| 
       112 
126 
     | 
    
         
             
                    end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: old_sql
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 0.47.0
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Eddie Gonzales
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2011-06- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2011-06-10 00:00:00 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: sanitize
         
     | 
| 
         @@ -199,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       199 
199 
     | 
    
         
             
              requirements: 
         
     | 
| 
       200 
200 
     | 
    
         
             
              - - ">="
         
     | 
| 
       201 
201 
     | 
    
         
             
                - !ruby/object:Gem::Version 
         
     | 
| 
       202 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 202 
     | 
    
         
            +
                  hash: 4461611604993439562
         
     | 
| 
       203 
203 
     | 
    
         
             
                  segments: 
         
     | 
| 
       204 
204 
     | 
    
         
             
                  - 0
         
     | 
| 
       205 
205 
     | 
    
         
             
                  version: "0"
         
     |