twowaysql 0.2.1 → 0.3.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.
- data/History.txt +12 -4
- data/Manifest.txt +5 -0
- data/README.txt +84 -12
- data/issues/issue-001c53236380a42cd8c5a9099bbcc6ec613919c2.yaml +18 -0
- data/issues/issue-25efcfc383f3b0f6c0e2730ae7c2975bb2b3de26.yaml +15 -3
- data/issues/issue-279105dd0d9f03514d318f5eab5e99c4c2d47fda.yaml +21 -0
- data/issues/issue-28cde89ed3eb306957edc90595b1d16bf43daf42.yaml +26 -0
- data/issues/issue-664986b219202ff1948cab717b56e7540f493561.yaml +5 -1
- data/issues/issue-6daccddf089d11d42bf016897da98f70cf5ab46c.yaml +18 -0
- data/issues/issue-901f65630639507c8b05b466790e9f22256c6450.yaml +15 -3
- data/issues/issue-f1bd40de5458397d9b142ea3e197e5264e0dcdbf.yaml +26 -0
- data/issues/issue-f2b773020b54f839c03d899b38b5113c8fd991df.yaml +15 -3
- data/issues/issue-f64d73ed4f9854f1ded77e6496dbf59cfb3770a7.yaml +10 -2
- data/issues/project.yaml +15 -2
- data/lib/twowaysql/node.rb +16 -6
- data/lib/twowaysql/parser.rb +115 -126
- data/lib/twowaysql/parser.y +24 -29
- data/lib/twowaysql/template.rb +26 -4
- data/lib/twowaysql/version.rb +2 -2
- data/spec/large_sql_spec.rb +67 -4
- data/spec/twowaysql_spec.rb +225 -44
- metadata +7 -2
    
        data/History.txt
    CHANGED
    
    | @@ -1,7 +1,10 @@ | |
| 1 | 
            -
            ==  | 
| 2 | 
            -
            *  | 
| 3 | 
            -
            *  | 
| 4 | 
            -
            *  | 
| 1 | 
            +
            == release_0_3 / 2008-09-10
         | 
| 2 | 
            +
            * better whitespace handling
         | 
| 3 | 
            +
            * Whitespace compaction mode
         | 
| 4 | 
            +
            * remove preserve_eol flag
         | 
| 5 | 
            +
            * preserve actual comment content
         | 
| 6 | 
            +
            * write docs for space compaction mode
         | 
| 7 | 
            +
            * change line-based scanning to whole string based scanning
         | 
| 5 8 |  | 
| 6 9 | 
             
            == 0.2.1 / 2008-09-07
         | 
| 7 10 | 
             
            * bugfix: case insensitive match for SQL reserved words
         | 
| @@ -9,3 +12,8 @@ | |
| 9 12 | 
             
            * integrate ditz html into site
         | 
| 10 13 | 
             
            * change idiom 'substitution' to 'interpolation'
         | 
| 11 14 | 
             
            * Handle Embedded variable comment at Scanner/Grammar level
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            == 0.2.0 / 2008-09-05
         | 
| 17 | 
            +
            * Initial release
         | 
| 18 | 
            +
            * RubyForge settings
         | 
| 19 | 
            +
            * rdoc for published classes and methods
         | 
    
        data/Manifest.txt
    CHANGED
    
    | @@ -5,16 +5,21 @@ README.txt | |
| 5 5 | 
             
            Rakefile
         | 
| 6 6 | 
             
            config/hoe.rb
         | 
| 7 7 | 
             
            config/requirements.rb
         | 
| 8 | 
            +
            issues/issue-001c53236380a42cd8c5a9099bbcc6ec613919c2.yaml
         | 
| 8 9 | 
             
            issues/issue-1cee7e821865a216674832b0186bd92792680571.yaml
         | 
| 9 10 | 
             
            issues/issue-25efcfc383f3b0f6c0e2730ae7c2975bb2b3de26.yaml
         | 
| 11 | 
            +
            issues/issue-279105dd0d9f03514d318f5eab5e99c4c2d47fda.yaml
         | 
| 12 | 
            +
            issues/issue-28cde89ed3eb306957edc90595b1d16bf43daf42.yaml
         | 
| 10 13 | 
             
            issues/issue-39023ea09e17e2d64bcef03aa59cdfe38b78ad5b.yaml
         | 
| 11 14 | 
             
            issues/issue-4bc308d55ae91f266e656162a4147d356de1166c.yaml
         | 
| 12 15 | 
             
            issues/issue-5c973ef5bb074eacca0c6c84f7d27c4267773ea8.yaml
         | 
| 13 16 | 
             
            issues/issue-664986b219202ff1948cab717b56e7540f493561.yaml
         | 
| 17 | 
            +
            issues/issue-6daccddf089d11d42bf016897da98f70cf5ab46c.yaml
         | 
| 14 18 | 
             
            issues/issue-897995fa10377eabdf597e8e7692f17087c76923.yaml
         | 
| 15 19 | 
             
            issues/issue-901f65630639507c8b05b466790e9f22256c6450.yaml
         | 
| 16 20 | 
             
            issues/issue-bd38c1cdc965d73dd629a81db2de1bcdcf4b10b8.yaml
         | 
| 17 21 | 
             
            issues/issue-dca4b19aa13de59838b33e03252bf824670a2d12.yaml
         | 
| 22 | 
            +
            issues/issue-f1bd40de5458397d9b142ea3e197e5264e0dcdbf.yaml
         | 
| 18 23 | 
             
            issues/issue-f2b773020b54f839c03d899b38b5113c8fd991df.yaml
         | 
| 19 24 | 
             
            issues/issue-f39b907d01d7fa93df8c7a9de2e1b5e27727ee0a.yaml
         | 
| 20 25 | 
             
            issues/issue-f64d73ed4f9854f1ded77e6496dbf59cfb3770a7.yaml
         | 
    
        data/README.txt
    CHANGED
    
    | @@ -121,10 +121,9 @@ TwoWaySQL is not | |
| 121 121 |  | 
| 122 122 | 
             
            * actual SQL comment
         | 
| 123 123 |  | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
            * currently, ruby version of TwoWaySQL cannot parse multi-line comments.
         | 
| 124 | 
            +
            * parse options
         | 
| 125 | 
            +
              * preserve_space
         | 
| 126 | 
            +
              * preserve_comment
         | 
| 128 127 |  | 
| 129 128 |  | 
| 130 129 |  | 
| @@ -143,7 +142,7 @@ TwoWaySQL::Template is the class you may only use. TwoWaySQL::Template acts as a | |
| 143 142 | 
             
            ==== Input
         | 
| 144 143 | 
             
            * TwoWaySQL-style SQL(string,file or anything like IO) to TwoWaySQL::Template.parse to create template object (note: template object is stateless and reentrant, so you can cache it)
         | 
| 145 144 | 
             
              * (Optionally) TwoWaySQL::Template.parse accepts Hash of parse options as second argument
         | 
| 146 | 
            -
            * data object | 
| 145 | 
            +
            * data object to the TwoWaySQL::Template#merge then TwoWaySQL will evaluate the data as name 'ctx'.
         | 
| 147 146 |  | 
| 148 147 | 
             
            ==== Output
         | 
| 149 148 | 
             
            * SQL String with placeholders (generally, '?' is used for placeholders)
         | 
| @@ -174,7 +173,7 @@ TwoWaySQL may use bind variable as follows. In this case, value of ctx[:empno] i | |
| 174 173 | 
             
            ===== usage
         | 
| 175 174 |  | 
| 176 175 | 
             
              sql = "SELECT * FROM emp WHERE job = /*ctx[:job]*/'CLERK' AND deptno = /*ctx[:deptno]*/20"
         | 
| 177 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 176 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 178 177 |  | 
| 179 178 | 
             
              merged = template.merge(:job => "HOGE", :deptno => 30)
         | 
| 180 179 | 
             
              merged.sql                #=> "SELECT * FROM emp WHERE job = ? AND deptno = ?"
         | 
| @@ -197,7 +196,7 @@ acceptable argument for IN clause is an array-like object. Say, Object that resp | |
| 197 196 | 
             
            ===== usage
         | 
| 198 197 |  | 
| 199 198 | 
             
              sql = "SELECT * FROM emp WHERE deptno IN /*ctx[:deptnoList]*/(10, 20) ORDER BY ename"
         | 
| 200 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 199 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 201 200 |  | 
| 202 201 | 
             
              merged = template.merge(:deptnoList => [30,40,50])
         | 
| 203 202 | 
             
              merged.sql                #=> "SELECT * FROM emp WHERE deptno IN (?, ?, ?) ORDER BY ename"
         | 
| @@ -232,7 +231,7 @@ As you noticed. Embedded variable comment has risk for SQL Injection. Please not | |
| 232 231 | 
             
            ===== usage
         | 
| 233 232 |  | 
| 234 233 | 
             
              sql = "SELECT * FROM emp ORDER BY /*$ctx[:order_by]*/ename /*$ctx[:order]*/ASC"
         | 
| 235 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 234 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 236 235 |  | 
| 237 236 | 
             
              merged = template.merge(:order_by => 'id, :order => 'DESC')
         | 
| 238 237 | 
             
              merged.sql                #=> "SELECT * FROM emp ORDER BY id DESC"
         | 
| @@ -256,7 +255,7 @@ When the condition returns a truthy value, TwoWaySQL treats statements in "/*IF* | |
| 256 255 | 
             
            ==== usage
         | 
| 257 256 |  | 
| 258 257 | 
             
              sql = "SELECT * FROM emp/*IF ctx[:job] */ WHERE job = /*ctx[:job]*/'CLERK'/*END*/"
         | 
| 259 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 258 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 260 259 |  | 
| 261 260 |  | 
| 262 261 | 
             
              # active case
         | 
| @@ -286,7 +285,7 @@ In this case, when the eval(ctx[:foo]) returns an falsy value, string "hoge IS N | |
| 286 285 | 
             
            ==== ELSE comment sample
         | 
| 287 286 |  | 
| 288 287 | 
             
              sql = "SELECT * FROM emp WHERE /*IF ctx[:job]*/job = /*ctx[:job]*/'CLERK'-- ELSE job IS NULL/*END*/"
         | 
| 289 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 288 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 290 289 |  | 
| 291 290 | 
             
              # active case
         | 
| 292 291 | 
             
              merged = template.merge(:job => 'MANAGER')
         | 
| @@ -327,7 +326,7 @@ In the above example, | |
| 327 326 | 
             
            ==== usage
         | 
| 328 327 |  | 
| 329 328 | 
             
              sql = "SELECT * FROM emp/*BEGIN*/ WHERE /*IF ctx[:job]*/job = /*ctx[:job]*/'CLERK'/*END*//*IF ctx[:deptno]*/ AND deptno = /*ctx[:deptno]*/20/*END*//*END*/"
         | 
| 330 | 
            -
              template = TwoWaySQL::Template.parse(sql | 
| 329 | 
            +
              template = TwoWaySQL::Template.parse(sql)
         | 
| 331 330 |  | 
| 332 331 | 
             
              # when data is empty (no param exists)
         | 
| 333 332 | 
             
              ctx = {}
         | 
| @@ -350,6 +349,79 @@ In the above example, | |
| 350 349 |  | 
| 351 350 |  | 
| 352 351 |  | 
| 352 | 
            +
            === Parse Options
         | 
| 353 | 
            +
             | 
| 354 | 
            +
            TwoWaySQL::Template.parse takes parse options as optional second argument. Acceptable parse options are kind_of Hash with available keys. Unknown options are just ignored.
         | 
| 355 | 
            +
             | 
| 356 | 
            +
            * available parse option keys
         | 
| 357 | 
            +
              * :preserve_space (default is true)
         | 
| 358 | 
            +
              * :preserve_comment (default is false)
         | 
| 359 | 
            +
              * :debug (internal use only)
         | 
| 360 | 
            +
             | 
| 361 | 
            +
             | 
| 362 | 
            +
            ==== :preserve_space (default is true)
         | 
| 363 | 
            +
             | 
| 364 | 
            +
            Default is true. When true, parser preserves original whitespaces. When false, parser translates consecutive whitespaces to single whitespace. This flag is useful for log space saving.
         | 
| 365 | 
            +
             | 
| 366 | 
            +
             | 
| 367 | 
            +
                sql = <<-EOS
         | 
| 368 | 
            +
              SELECT
         | 
| 369 | 
            +
                *
         | 
| 370 | 
            +
              FROM
         | 
| 371 | 
            +
                emp
         | 
| 372 | 
            +
              WHERE
         | 
| 373 | 
            +
                job    =   /*ctx[:job]*/'CLERK'
         | 
| 374 | 
            +
                AND   deptno   =   /*ctx[:deptno]*/10
         | 
| 375 | 
            +
              EOS
         | 
| 376 | 
            +
                template = TwoWaySQL::Template.parse(sql, :preserve_space => false)
         | 
| 377 | 
            +
                
         | 
| 378 | 
            +
                result = template.merge(:job => 'MANAGER', :deptno => 30)
         | 
| 379 | 
            +
                
         | 
| 380 | 
            +
                result.sql                 #=> "SELECT * FROM emp WHERE job = ? AND deptno = ? "
         | 
| 381 | 
            +
                result.bound_variables     #=> ["MANAGER", 30]
         | 
| 382 | 
            +
             | 
| 383 | 
            +
             | 
| 384 | 
            +
            ==== :preserve_comment (default is false)
         | 
| 385 | 
            +
             | 
| 386 | 
            +
            Default is false. When true, parser preserves original actual comments. When false, parser skips actual comment, therefore parsed SQL does not contain actual comments.
         | 
| 387 | 
            +
             | 
| 388 | 
            +
                sql = <<-EOS
         | 
| 389 | 
            +
              SELECT
         | 
| 390 | 
            +
                *
         | 
| 391 | 
            +
              FROM
         | 
| 392 | 
            +
                emp
         | 
| 393 | 
            +
                /* 
         | 
| 394 | 
            +
                   This is a
         | 
| 395 | 
            +
                   multiline comment
         | 
| 396 | 
            +
                */
         | 
| 397 | 
            +
              WHERE
         | 
| 398 | 
            +
                job    =   /*ctx[:job]*/'CLERK'
         | 
| 399 | 
            +
                AND   deptno   =   /*ctx[:deptno]*/10
         | 
| 400 | 
            +
              EOS
         | 
| 401 | 
            +
                template = TwoWaySQL::Template.parse(sql, :preserve_comment => true)
         | 
| 402 | 
            +
                
         | 
| 403 | 
            +
                result = template.merge(:job => 'MANAGER', :deptno => 30)
         | 
| 404 | 
            +
                
         | 
| 405 | 
            +
                expected = <<-EOS
         | 
| 406 | 
            +
              SELECT
         | 
| 407 | 
            +
                *
         | 
| 408 | 
            +
              FROM
         | 
| 409 | 
            +
                emp
         | 
| 410 | 
            +
                /* 
         | 
| 411 | 
            +
                   This is a
         | 
| 412 | 
            +
                   multiline comment
         | 
| 413 | 
            +
                */
         | 
| 414 | 
            +
              WHERE
         | 
| 415 | 
            +
                job    =   ?
         | 
| 416 | 
            +
                AND   deptno   =   ?
         | 
| 417 | 
            +
              EOS
         | 
| 418 | 
            +
                result.sql == expected     #=> true
         | 
| 419 | 
            +
                result.bound_variables     #=> ["MANAGER", 30]
         | 
| 420 | 
            +
             | 
| 421 | 
            +
             | 
| 422 | 
            +
             | 
| 423 | 
            +
             | 
| 424 | 
            +
             | 
| 353 425 | 
             
            == REQUIREMENTS:
         | 
| 354 426 |  | 
| 355 427 | 
             
            * racc/parser (basically bundled with ruby)
         | 
| @@ -357,7 +429,7 @@ In the above example, | |
| 357 429 |  | 
| 358 430 | 
             
            == INSTALL:
         | 
| 359 431 |  | 
| 360 | 
            -
            * sudo gem install twowaysql
         | 
| 432 | 
            +
            * (sudo) gem install twowaysql
         | 
| 361 433 |  | 
| 362 434 |  | 
| 363 435 | 
             
            == AUTHOR:
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            --- !ditz.rubyforge.org,2008-03-06/issue 
         | 
| 2 | 
            +
            title: integrate RSpec report into website
         | 
| 3 | 
            +
            desc: integrate RSpec report into website
         | 
| 4 | 
            +
            type: :task
         | 
| 5 | 
            +
            component: twowaysql
         | 
| 6 | 
            +
            release: 
         | 
| 7 | 
            +
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            +
            status: :unstarted
         | 
| 9 | 
            +
            disposition: 
         | 
| 10 | 
            +
            creation_time: 2008-09-09 05:46:28.201883 Z
         | 
| 11 | 
            +
            references: []
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            id: 001c53236380a42cd8c5a9099bbcc6ec613919c2
         | 
| 14 | 
            +
            log_events: 
         | 
| 15 | 
            +
            - - 2008-09-09 05:46:29.606754 Z
         | 
| 16 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 17 | 
            +
              - created
         | 
| 18 | 
            +
              - ""
         | 
| @@ -3,10 +3,10 @@ title: better whitespace handling | |
| 3 3 | 
             
            desc: better whitespace handling on Scanner/Grammar.
         | 
| 4 4 | 
             
            type: :feature
         | 
| 5 5 | 
             
            component: twowaysql
         | 
| 6 | 
            -
            release: 
         | 
| 6 | 
            +
            release: release_0_3
         | 
| 7 7 | 
             
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            -
            status: : | 
| 9 | 
            -
            disposition: 
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 10 | 
             
            creation_time: 2008-09-03 09:00:15.483485 Z
         | 
| 11 11 | 
             
            references: []
         | 
| 12 12 |  | 
| @@ -16,3 +16,15 @@ log_events: | |
| 16 16 | 
             
              - takuto <takuto.wada@gmail.com>
         | 
| 17 17 | 
             
              - created
         | 
| 18 18 | 
             
              - fix some dirty rules for whitespaces, if possible.
         | 
| 19 | 
            +
            - - 2008-09-08 08:56:27.771360 Z
         | 
| 20 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 21 | 
            +
              - assigned to release release_0_3 from unassigned
         | 
| 22 | 
            +
              - ""
         | 
| 23 | 
            +
            - - 2008-09-08 08:57:22.550994 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - changed status from unstarted to in_progress
         | 
| 26 | 
            +
              - ""
         | 
| 27 | 
            +
            - - 2008-09-09 05:38:29.182555 Z
         | 
| 28 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 29 | 
            +
              - closed with disposition fixed
         | 
| 30 | 
            +
              - ""
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            --- !ditz.rubyforge.org,2008-03-06/issue 
         | 
| 2 | 
            +
            title: deal with trailing space of ELSE
         | 
| 3 | 
            +
            desc: |-
         | 
| 4 | 
            +
              deal with trailing space of ELSE. e.g.
         | 
| 5 | 
            +
              ... --ELSE age IS NULL  #=> 'age IS NULL'
         | 
| 6 | 
            +
              ... --ELSE AND age IS NULL  #=> 'AND age IS NULL' or ' age IS NULL' 
         | 
| 7 | 
            +
            type: :task
         | 
| 8 | 
            +
            component: twowaysql
         | 
| 9 | 
            +
            release: 
         | 
| 10 | 
            +
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 11 | 
            +
            status: :unstarted
         | 
| 12 | 
            +
            disposition: 
         | 
| 13 | 
            +
            creation_time: 2008-09-09 05:43:46.691586 Z
         | 
| 14 | 
            +
            references: []
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            id: 279105dd0d9f03514d318f5eab5e99c4c2d47fda
         | 
| 17 | 
            +
            log_events: 
         | 
| 18 | 
            +
            - - 2008-09-09 05:43:48.017710 Z
         | 
| 19 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 20 | 
            +
              - created
         | 
| 21 | 
            +
              - ""
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            --- !ditz.rubyforge.org,2008-03-06/issue 
         | 
| 2 | 
            +
            title: write docs for space compaction mode
         | 
| 3 | 
            +
            desc: write docs for space compaction mode
         | 
| 4 | 
            +
            type: :task
         | 
| 5 | 
            +
            component: twowaysql
         | 
| 6 | 
            +
            release: release_0_3
         | 
| 7 | 
            +
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 | 
            +
            creation_time: 2008-09-09 05:40:16.864740 Z
         | 
| 11 | 
            +
            references: []
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            id: 28cde89ed3eb306957edc90595b1d16bf43daf42
         | 
| 14 | 
            +
            log_events: 
         | 
| 15 | 
            +
            - - 2008-09-09 05:40:18.449669 Z
         | 
| 16 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 17 | 
            +
              - created
         | 
| 18 | 
            +
              - ""
         | 
| 19 | 
            +
            - - 2008-09-09 09:56:02.992717 Z
         | 
| 20 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 21 | 
            +
              - changed status from unstarted to in_progress
         | 
| 22 | 
            +
              - ""
         | 
| 23 | 
            +
            - - 2008-09-10 06:28:29.298991 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - closed with disposition fixed
         | 
| 26 | 
            +
              - ""
         | 
| @@ -3,7 +3,7 @@ title: line number support on parse error | |
| 3 3 | 
             
            desc: show line number of SQL when parse error has occurred.
         | 
| 4 4 | 
             
            type: :feature
         | 
| 5 5 | 
             
            component: twowaysql
         | 
| 6 | 
            -
            release:  | 
| 6 | 
            +
            release: release_0_4
         | 
| 7 7 | 
             
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 8 | 
             
            status: :unstarted
         | 
| 9 9 | 
             
            disposition: 
         | 
| @@ -20,3 +20,7 @@ log_events: | |
| 20 20 | 
             
              - takuto <takuto.wada@gmail.com>
         | 
| 21 21 | 
             
              - assigned to release release_0_3 from unassigned
         | 
| 22 22 | 
             
              - assign to release_0_3
         | 
| 23 | 
            +
            - - 2008-09-10 06:27:47.942216 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - assigned to release release_0_4 from release_0_3
         | 
| 26 | 
            +
              - ""
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            --- !ditz.rubyforge.org,2008-03-06/issue 
         | 
| 2 | 
            +
            title: integrate ditz to 'push-button release'
         | 
| 3 | 
            +
            desc: integrate 'ditz release' and 'ditz changelog' into rake task
         | 
| 4 | 
            +
            type: :task
         | 
| 5 | 
            +
            component: twowaysql
         | 
| 6 | 
            +
            release: 
         | 
| 7 | 
            +
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            +
            status: :unstarted
         | 
| 9 | 
            +
            disposition: 
         | 
| 10 | 
            +
            creation_time: 2008-09-07 17:34:42.830046 Z
         | 
| 11 | 
            +
            references: []
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            id: 6daccddf089d11d42bf016897da98f70cf5ab46c
         | 
| 14 | 
            +
            log_events: 
         | 
| 15 | 
            +
            - - 2008-09-07 17:34:44.130887 Z
         | 
| 16 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 17 | 
            +
              - created
         | 
| 18 | 
            +
              - ""
         | 
| @@ -3,10 +3,10 @@ title: Whitespace compaction mode | |
| 3 3 | 
             
            desc: Whitespace compaction mode for log space saving
         | 
| 4 4 | 
             
            type: :feature
         | 
| 5 5 | 
             
            component: twowaysql
         | 
| 6 | 
            -
            release: 
         | 
| 6 | 
            +
            release: release_0_3
         | 
| 7 7 | 
             
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            -
            status: : | 
| 9 | 
            -
            disposition: 
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 10 | 
             
            creation_time: 2008-09-05 11:32:38.661495 Z
         | 
| 11 11 | 
             
            references: []
         | 
| 12 12 |  | 
| @@ -16,3 +16,15 @@ log_events: | |
| 16 16 | 
             
              - takuto <takuto.wada@gmail.com>
         | 
| 17 17 | 
             
              - created
         | 
| 18 18 | 
             
              - ""
         | 
| 19 | 
            +
            - - 2008-09-08 08:56:36.791742 Z
         | 
| 20 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 21 | 
            +
              - assigned to release release_0_3 from unassigned
         | 
| 22 | 
            +
              - ""
         | 
| 23 | 
            +
            - - 2008-09-08 08:57:29.584166 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - changed status from unstarted to in_progress
         | 
| 26 | 
            +
              - ""
         | 
| 27 | 
            +
            - - 2008-09-09 05:38:35.131235 Z
         | 
| 28 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 29 | 
            +
              - closed with disposition fixed
         | 
| 30 | 
            +
              - ""
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            --- !ditz.rubyforge.org,2008-03-06/issue 
         | 
| 2 | 
            +
            title: remove preserve_eol flag
         | 
| 3 | 
            +
            desc: remove preserve_eol flag. both for one-liner and multi-line SQL.
         | 
| 4 | 
            +
            type: :feature
         | 
| 5 | 
            +
            component: twowaysql
         | 
| 6 | 
            +
            release: release_0_3
         | 
| 7 | 
            +
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 | 
            +
            creation_time: 2008-09-08 18:50:03.580663 Z
         | 
| 11 | 
            +
            references: []
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            id: f1bd40de5458397d9b142ea3e197e5264e0dcdbf
         | 
| 14 | 
            +
            log_events: 
         | 
| 15 | 
            +
            - - 2008-09-08 18:50:05.346009 Z
         | 
| 16 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 17 | 
            +
              - created
         | 
| 18 | 
            +
              - ""
         | 
| 19 | 
            +
            - - 2008-09-08 18:50:28.843212 Z
         | 
| 20 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 21 | 
            +
              - changed status from unstarted to in_progress
         | 
| 22 | 
            +
              - ""
         | 
| 23 | 
            +
            - - 2008-09-08 19:11:02.345285 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - closed with disposition fixed
         | 
| 26 | 
            +
              - ""
         | 
| @@ -3,10 +3,10 @@ title: change line-based scanning to whole string based scanning | |
| 3 3 | 
             
            desc: try whole string based scanning to handle multiline comments and directives
         | 
| 4 4 | 
             
            type: :task
         | 
| 5 5 | 
             
            component: twowaysql
         | 
| 6 | 
            -
            release: 
         | 
| 6 | 
            +
            release: release_0_3
         | 
| 7 7 | 
             
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            -
            status: : | 
| 9 | 
            -
            disposition: 
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 10 | 
             
            creation_time: 2008-09-03 09:04:04.695887 Z
         | 
| 11 11 | 
             
            references: []
         | 
| 12 12 |  | 
| @@ -16,3 +16,15 @@ log_events: | |
| 16 16 | 
             
              - takuto <takuto.wada@gmail.com>
         | 
| 17 17 | 
             
              - created
         | 
| 18 18 | 
             
              - this is a trial. not necessary for current specs.
         | 
| 19 | 
            +
            - - 2008-09-08 08:56:33.359947 Z
         | 
| 20 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 21 | 
            +
              - assigned to release release_0_3 from unassigned
         | 
| 22 | 
            +
              - ""
         | 
| 23 | 
            +
            - - 2008-09-08 08:57:26.255202 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - changed status from unstarted to in_progress
         | 
| 26 | 
            +
              - ""
         | 
| 27 | 
            +
            - - 2008-09-08 18:16:21.995139 Z
         | 
| 28 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 29 | 
            +
              - closed with disposition fixed
         | 
| 30 | 
            +
              - ""
         | 
| @@ -5,8 +5,8 @@ type: :feature | |
| 5 5 | 
             
            component: twowaysql
         | 
| 6 6 | 
             
            release: release_0_3
         | 
| 7 7 | 
             
            reporter: takuto <takuto.wada@gmail.com>
         | 
| 8 | 
            -
            status: : | 
| 9 | 
            -
            disposition: 
         | 
| 8 | 
            +
            status: :closed
         | 
| 9 | 
            +
            disposition: :fixed
         | 
| 10 10 | 
             
            creation_time: 2008-09-03 08:33:12.940300 Z
         | 
| 11 11 | 
             
            references: []
         | 
| 12 12 |  | 
| @@ -20,3 +20,11 @@ log_events: | |
| 20 20 | 
             
              - takuto <takuto.wada@gmail.com>
         | 
| 21 21 | 
             
              - assigned to release release_0_3 from unassigned
         | 
| 22 22 | 
             
              - assign to release_0_3
         | 
| 23 | 
            +
            - - 2008-09-08 10:33:48.093770 Z
         | 
| 24 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 25 | 
            +
              - changed status from unstarted to in_progress
         | 
| 26 | 
            +
              - ""
         | 
| 27 | 
            +
            - - 2008-09-08 17:51:22.696803 Z
         | 
| 28 | 
            +
              - takuto <takuto.wada@gmail.com>
         | 
| 29 | 
            +
              - closed with disposition fixed
         | 
| 30 | 
            +
              - ""
         | 
    
        data/issues/project.yaml
    CHANGED
    
    | @@ -20,13 +20,17 @@ releases: | |
| 20 20 | 
             
                - 0.2 release done.
         | 
| 21 21 | 
             
            - !ditz.rubyforge.org,2008-03-06/release 
         | 
| 22 22 | 
             
              name: release_0_3
         | 
| 23 | 
            -
              status: : | 
| 24 | 
            -
              release_time: 
         | 
| 23 | 
            +
              status: :released
         | 
| 24 | 
            +
              release_time: 2008-09-10 06:33:15.041316 Z
         | 
| 25 25 | 
             
              log_events: 
         | 
| 26 26 | 
             
              - - 2008-09-05 11:23:24.696817 Z
         | 
| 27 27 | 
             
                - takuto <takuto.wada@gmail.com>
         | 
| 28 28 | 
             
                - created
         | 
| 29 29 | 
             
                - release 0.3
         | 
| 30 | 
            +
              - - 2008-09-10 06:33:15.041327 Z
         | 
| 31 | 
            +
                - takuto <takuto.wada@gmail.com>
         | 
| 32 | 
            +
                - released
         | 
| 33 | 
            +
                - ""
         | 
| 30 34 | 
             
            - !ditz.rubyforge.org,2008-03-06/release 
         | 
| 31 35 | 
             
              name: release_0_2_1
         | 
| 32 36 | 
             
              status: :released
         | 
| @@ -40,3 +44,12 @@ releases: | |
| 40 44 | 
             
                - takuto <takuto.wada@gmail.com>
         | 
| 41 45 | 
             
                - released
         | 
| 42 46 | 
             
                - 0.2.1 release
         | 
| 47 | 
            +
            - !ditz.rubyforge.org,2008-03-06/release 
         | 
| 48 | 
            +
              name: release_0_4
         | 
| 49 | 
            +
              status: :unreleased
         | 
| 50 | 
            +
              release_time: 
         | 
| 51 | 
            +
              log_events: 
         | 
| 52 | 
            +
              - - 2008-09-10 06:27:14.808896 Z
         | 
| 53 | 
            +
                - takuto <takuto.wada@gmail.com>
         | 
| 54 | 
            +
                - created
         | 
| 55 | 
            +
                - ""
         | 
    
        data/lib/twowaysql/node.rb
    CHANGED
    
    | @@ -210,20 +210,30 @@ module TwoWaySQL | |
| 210 210 | 
             
              end
         | 
| 211 211 |  | 
| 212 212 |  | 
| 213 | 
            -
              class  | 
| 214 | 
            -
                def initialize( | 
| 215 | 
            -
                  @ | 
| 213 | 
            +
              class ActualCommentNode < Node
         | 
| 214 | 
            +
                def initialize(delim, content)
         | 
| 215 | 
            +
                  @delim = delim
         | 
| 216 | 
            +
                  @content = content
         | 
| 216 217 | 
             
                end
         | 
| 217 218 | 
             
                def accept(ctx)
         | 
| 218 | 
            -
                  # | 
| 219 | 
            +
                  ctx.add_sql("#{@delim}*#{@content}*#{@delim}")
         | 
| 219 220 | 
             
                end
         | 
| 220 221 | 
             
              end
         | 
| 221 222 |  | 
| 222 223 |  | 
| 223 | 
            -
              class  | 
| 224 | 
            +
              class WhiteSpaceNode < Node
         | 
| 225 | 
            +
                def initialize(val, preserve)
         | 
| 226 | 
            +
                  @val = val
         | 
| 227 | 
            +
                  @preserve = preserve
         | 
| 228 | 
            +
                end
         | 
| 224 229 | 
             
                def accept(ctx)
         | 
| 225 | 
            -
                   | 
| 230 | 
            +
                  if @preserve
         | 
| 231 | 
            +
                    ctx.add_sql(@val)
         | 
| 232 | 
            +
                  else
         | 
| 233 | 
            +
                    ctx.add_sql(" ")
         | 
| 234 | 
            +
                  end
         | 
| 226 235 | 
             
                end
         | 
| 227 236 | 
             
              end
         | 
| 228 237 |  | 
| 238 | 
            +
             | 
| 229 239 | 
             
            end
         |