activerecord-cubrid2-adapter 0.0.4 → 0.0.5
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.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9e8634b1c39dd11d4694db73f13bf36b5f94a3a976f9d326dbffc5ce8e9145c2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: aad71acada082d9f3ddd1d7e339d4db8d6d6a7644824705daebed134d5c0f104
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ec45cc833218ea9b5193fecbeb27a3aacb85795a7a4a5495fb53ec7f73f8ebeb71a4589e55625222c5c69fe5d9684a964b86d9081c0353fe88e4581d5713f095
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 96882f548af718500348c060af3ab9563f04a504af3414304965e109abd7ab7896e442c815a7166c169298ae71eb62872bbb4d7f7e27d12a4267d26e572aca59
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.5
         
     | 
| 
         @@ -80,7 +80,10 @@ module ActiveRecord 
     | 
|
| 
       80 
80 
     | 
    
         
             
                    def _build_stmt_result(stmt)
         
     | 
| 
       81 
81 
     | 
    
         
             
                      columns = stmt.column_info.map { |col| col['name'] }
         
     | 
| 
       82 
82 
     | 
    
         
             
                      rows = is_conn_utf8? ? _extract_rows_from_stmt__utf8(stmt) : _extract_rows_from_stmt__raw(stmt)
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                      # build_result(columns: columns, rows: rows)
         
     | 
| 
      
 85 
     | 
    
         
            +
                      # for activerecord <= 6.0
         
     | 
| 
      
 86 
     | 
    
         
            +
                      ActiveRecord::Result.new(columns, rows, column_types = {})
         
     | 
| 
       84 
87 
     | 
    
         
             
                    end
         
     | 
| 
       85 
88 
     | 
    
         | 
| 
       86 
89 
     | 
    
         
             
                    def _extract_rows_from_stmt__raw(stmt, as_hash: false)
         
     | 
| 
         @@ -26,22 +26,21 @@ module ActiveRecord 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                    def visit_CreateIndexDefinition(o)
         
     | 
| 
       29 
     | 
    
         
            -
                       
     | 
| 
       30 
     | 
    
         
            -
                      sql
         
     | 
| 
      
 29 
     | 
    
         
            +
                      visit_IndexDefinition(o.index, true)
         
     | 
| 
       31 
30 
     | 
    
         
             
                    end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
                    def visit_IndexDefinition(o, create = false)
         
     | 
| 
       34 
     | 
    
         
            -
                      index_type = o.type&.to_s&.upcase || o.unique &&  
     | 
| 
      
 33 
     | 
    
         
            +
                      index_type = o.type&.to_s&.upcase || o.unique && 'UNIQUE'
         
     | 
| 
       35 
34 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                      sql = create ? [ 
     | 
| 
      
 35 
     | 
    
         
            +
                      sql = create ? ['CREATE'] : []
         
     | 
| 
       37 
36 
     | 
    
         
             
                      sql << index_type if index_type
         
     | 
| 
       38 
     | 
    
         
            -
                      sql <<  
     | 
| 
      
 37 
     | 
    
         
            +
                      sql << 'INDEX'
         
     | 
| 
       39 
38 
     | 
    
         
             
                      sql << quote_column_name(o.name)
         
     | 
| 
       40 
     | 
    
         
            -
                      #sql << "USING #{o.using}" if o.using
         
     | 
| 
      
 39 
     | 
    
         
            +
                      # sql << "USING #{o.using}" if o.using
         
     | 
| 
       41 
40 
     | 
    
         
             
                      sql << "ON #{quote_table_name(o.table)}" if create
         
     | 
| 
       42 
41 
     | 
    
         
             
                      sql << "(#{quoted_columns(o)})"
         
     | 
| 
       43 
42 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                      add_sql_comment!(sql.join( 
     | 
| 
      
 43 
     | 
    
         
            +
                      add_sql_comment!(sql.join(' '), o.comment)
         
     | 
| 
       45 
44 
     | 
    
         
             
                    end
         
     | 
| 
       46 
45 
     | 
    
         | 
| 
       47 
46 
     | 
    
         
             
                    def add_table_options!(create_sql, options)
         
     | 
| 
         @@ -57,15 +56,15 @@ module ActiveRecord 
     | 
|
| 
       57 
56 
     | 
    
         
             
                        sql << ' NULL'
         
     | 
| 
       58 
57 
     | 
    
         
             
                      end
         
     | 
| 
       59 
58 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                      if charset = options[:charset]
         
     | 
| 
      
 59 
     | 
    
         
            +
                      if (charset = options[:charset])
         
     | 
| 
       61 
60 
     | 
    
         
             
                        sql << " CHARSET #{charset}"
         
     | 
| 
       62 
61 
     | 
    
         
             
                      end
         
     | 
| 
       63 
62 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                      if collation = options[:collation]
         
     | 
| 
      
 63 
     | 
    
         
            +
                      if (collation = options[:collation])
         
     | 
| 
       65 
64 
     | 
    
         
             
                        sql << " COLLATE #{collation}"
         
     | 
| 
       66 
65 
     | 
    
         
             
                      end
         
     | 
| 
       67 
66 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                      if as = options[:as]
         
     | 
| 
      
 67 
     | 
    
         
            +
                      if (as = options[:as])
         
     | 
| 
       69 
68 
     | 
    
         
             
                        sql << " AS (#{as})"
         
     | 
| 
       70 
69 
     | 
    
         
             
                      end
         
     | 
| 
       71 
70 
     | 
    
         | 
| 
         @@ -83,14 +82,21 @@ module ActiveRecord 
     | 
|
| 
       83 
82 
     | 
    
         
             
                    end
         
     | 
| 
       84 
83 
     | 
    
         | 
| 
       85 
84 
     | 
    
         
             
                    def index_in_create(table_name, column_name, options)
         
     | 
| 
       86 
     | 
    
         
            -
                       
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
                      if ActiveRecord.version.to_s >= '6.1.0'
         
     | 
| 
      
 86 
     | 
    
         
            +
                        # for activerecord >= 6.1
         
     | 
| 
      
 87 
     | 
    
         
            +
                        index_def, algorithm, if_not_exists = @conn.add_index_options(table_name, column_name, **options)
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                        index_name = index_def.name
         
     | 
| 
      
 90 
     | 
    
         
            +
                        index_columns = index_def.columns.map { |x| quote_column_name(x) }.join(', ')
         
     | 
| 
      
 91 
     | 
    
         
            +
                        index_type = index_def.unique ? 'UNIQUE' : ''
         
     | 
| 
      
 92 
     | 
    
         
            +
                        comment = index_def.comment
         
     | 
| 
      
 93 
     | 
    
         
            +
                      else
         
     | 
| 
      
 94 
     | 
    
         
            +
                        # for activerecord == 6.0
         
     | 
| 
      
 95 
     | 
    
         
            +
                        index_name, index_type, index_columns, _, _, index_using, comment =
         
     | 
| 
      
 96 
     | 
    
         
            +
                                                                    @conn.add_index_options(table_name, column_name, **options)
         
     | 
| 
      
 97 
     | 
    
         
            +
                      end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                      add_sql_comment!(+"#{index_type} INDEX #{quote_column_name(index_name)} (#{index_columns})", comment)
         
     | 
| 
       94 
100 
     | 
    
         
             
                    end
         
     | 
| 
       95 
101 
     | 
    
         
             
                  end
         
     | 
| 
       96 
102 
     | 
    
         
             
                end
         
     |