flexirecord 1.0.5 → 1.0.6
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/CHANGELOG +8 -0
- data/lib/flexirecord.rb +13 -2
- metadata +2 -2
    
        data/CHANGELOG
    CHANGED
    
    | @@ -85,3 +85,11 @@ | |
| 85 85 |  | 
| 86 86 | 
             
            - Release of version 1.0.5
         | 
| 87 87 |  | 
| 88 | 
            +
            - 2007-04-17:
         | 
| 89 | 
            +
              - >
         | 
| 90 | 
            +
                When a database error occurs, the corresponding connection is marked as "spoiled" and will not be reused by the current or other threads. This is neccessary to get rid of broken connections, as the ruby "postgres" library doesn't pass PostgreSQL error codes, making it impossible to cleanly detect bad connections.
         | 
| 91 | 
            +
              - >
         | 
| 92 | 
            +
                PGError's raised during opening of a connection are now catched and transformed to FlexiRecord::DatabaseError exceptions.
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            - Release of version 1.0.6
         | 
| 95 | 
            +
             | 
    
        data/lib/flexirecord.rb
    CHANGED
    
    | @@ -1256,12 +1256,22 @@ module FlexiRecord | |
| 1256 1256 | 
             
                    end
         | 
| 1257 1257 | 
             
                    options[:data_types] = @data_types.freeze
         | 
| 1258 1258 | 
             
                  end
         | 
| 1259 | 
            -
                   | 
| 1259 | 
            +
                  begin
         | 
| 1260 | 
            +
                    @backend_connection = PGconn.new(@host, @port, @options, nil, @dbname, @login, @passwd)
         | 
| 1261 | 
            +
                  rescue PGError
         | 
| 1262 | 
            +
                    raise FlexiRecord::DatabaseError, $!.message
         | 
| 1263 | 
            +
                  end
         | 
| 1260 1264 | 
             
                  @transaction_stacklevel = 0
         | 
| 1261 1265 | 
             
                  @isolation_level = nil
         | 
| 1266 | 
            +
                  @spoiled = false
         | 
| 1262 1267 | 
             
                  nil
         | 
| 1263 1268 | 
             
                end
         | 
| 1264 1269 |  | 
| 1270 | 
            +
                # Returns true, if an error has been occured in the lifetime of this connection.
         | 
| 1271 | 
            +
                def spoiled?
         | 
| 1272 | 
            +
                  @spoiled
         | 
| 1273 | 
            +
                end
         | 
| 1274 | 
            +
             | 
| 1265 1275 | 
             
                # Executes an SQL query and returns an Array of objects of 'record_class' (which should be a sub-class of BaseRecord). The 'command_template' is an SQL statement with '$' placeholders to be replaced by the following 'command_arguments'.
         | 
| 1266 1276 | 
             
                def record_query(record_class, command_template, *command_arguments)
         | 
| 1267 1277 | 
             
                  command = command_template.to_s.gsub(/\$([^0-9]|$)/) {
         | 
| @@ -1374,6 +1384,7 @@ module FlexiRecord | |
| 1374 1384 | 
             
                      end
         | 
| 1375 1385 | 
             
                    end
         | 
| 1376 1386 | 
             
                  rescue PGError
         | 
| 1387 | 
            +
                    @spoiled = true
         | 
| 1377 1388 | 
             
                    raise FlexiRecord::DatabaseError, $!.message
         | 
| 1378 1389 | 
             
                  end
         | 
| 1379 1390 | 
             
                end
         | 
| @@ -1506,7 +1517,7 @@ module FlexiRecord | |
| 1506 1517 |  | 
| 1507 1518 | 
             
                # Implementation of ThreadResourcePool#reset_resource.
         | 
| 1508 1519 | 
             
                def reset_resource(connection)
         | 
| 1509 | 
            -
                   | 
| 1520 | 
            +
                  not connection.spoiled?
         | 
| 1510 1521 | 
             
                end
         | 
| 1511 1522 |  | 
| 1512 1523 | 
             
                # Implementation of ThreadResourcePool#destroy_resource.
         | 
    
        metadata
    CHANGED
    
    | @@ -3,8 +3,8 @@ rubygems_version: 0.9.0 | |
| 3 3 | 
             
            specification_version: 1
         | 
| 4 4 | 
             
            name: flexirecord
         | 
| 5 5 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 6 | 
            -
              version: 1.0. | 
| 7 | 
            -
            date: 2007- | 
| 6 | 
            +
              version: 1.0.6
         | 
| 7 | 
            +
            date: 2007-04-17 00:00:00 +00:00
         | 
| 8 8 | 
             
            summary: Object-Oriented Database Access Library (ORM layer)
         | 
| 9 9 | 
             
            require_paths: 
         | 
| 10 10 | 
             
            - lib/
         |