ibm_db 2.5.6-x86-mingw32
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/CHANGES +181 -0
 - data/LICENSE +18 -0
 - data/MANIFEST +14 -0
 - data/ParameterizedQueries README +39 -0
 - data/README +282 -0
 - data/ext/Makefile.nt32 +181 -0
 - data/ext/extconf.rb +66 -0
 - data/ext/ibm_db.c +11166 -0
 - data/ext/ruby_ibm_db.h +236 -0
 - data/ext/ruby_ibm_db_cli.c +738 -0
 - data/ext/ruby_ibm_db_cli.h +431 -0
 - data/init.rb +42 -0
 - data/lib/IBM_DB.rb +2 -0
 - data/lib/active_record/connection_adapters/ibm_db_adapter.rb +2598 -0
 - data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1965 -0
 - data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
 - data/lib/mswin32/ibm_db.rb +1 -0
 - data/lib/mswin32/rb18x/ibm_db.so +0 -0
 - data/lib/mswin32/rb19x/ibm_db.so +0 -0
 - data/test/cases/adapter_test.rb +202 -0
 - data/test/cases/associations/belongs_to_associations_test.rb +486 -0
 - data/test/cases/associations/cascaded_eager_loading_test.rb +183 -0
 - data/test/cases/associations/eager_test.rb +862 -0
 - data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +917 -0
 - data/test/cases/associations/has_many_through_associations_test.rb +461 -0
 - data/test/cases/associations/join_model_test.rb +793 -0
 - data/test/cases/attribute_methods_test.rb +621 -0
 - data/test/cases/base_test.rb +1486 -0
 - data/test/cases/calculations_test.rb +362 -0
 - data/test/cases/finder_test.rb +1088 -0
 - data/test/cases/fixtures_test.rb +684 -0
 - data/test/cases/migration_test.rb +2014 -0
 - data/test/cases/schema_dumper_test.rb +232 -0
 - data/test/cases/validations/uniqueness_validation_test.rb +283 -0
 - data/test/connections/native_ibm_db/connection.rb +42 -0
 - data/test/ibm_db_test.rb +25 -0
 - data/test/models/warehouse_thing.rb +5 -0
 - data/test/schema/i5/ibm_db_specific_schema.rb +135 -0
 - data/test/schema/ids/ibm_db_specific_schema.rb +138 -0
 - data/test/schema/luw/ibm_db_specific_schema.rb +135 -0
 - data/test/schema/schema.rb +647 -0
 - data/test/schema/zOS/ibm_db_specific_schema.rb +206 -0
 - metadata +123 -0
 
| 
         @@ -0,0 +1,328 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
                       add                :   ADD
         
     | 
| 
      
 2 
     | 
    
         
            +
                       after              :   AFTER
         
     | 
| 
      
 3 
     | 
    
         
            +
                       alias              :   ALIAS
         
     | 
| 
      
 4 
     | 
    
         
            +
                       all                :   ALL
         
     | 
| 
      
 5 
     | 
    
         
            +
                       allocate           :   ALLOCATE
         
     | 
| 
      
 6 
     | 
    
         
            +
                       allow              :   ALLOW
         
     | 
| 
      
 7 
     | 
    
         
            +
                       alter              :   ALTER
         
     | 
| 
      
 8 
     | 
    
         
            +
                       and                :   AND
         
     | 
| 
      
 9 
     | 
    
         
            +
                       any                :   ANY
         
     | 
| 
      
 10 
     | 
    
         
            +
                       as                 :   AS
         
     | 
| 
      
 11 
     | 
    
         
            +
                       asensitive         :   ASENSITIVE
         
     | 
| 
      
 12 
     | 
    
         
            +
                       associate          :   ASSOCIATE
         
     | 
| 
      
 13 
     | 
    
         
            +
                       asutime            :   ASUTIME
         
     | 
| 
      
 14 
     | 
    
         
            +
                       audit              :   AUDIT
         
     | 
| 
      
 15 
     | 
    
         
            +
                       authorization      :   AUTHORIZATION
         
     | 
| 
      
 16 
     | 
    
         
            +
                       aux                :   AUX
         
     | 
| 
      
 17 
     | 
    
         
            +
                       auxiliary          :   AUXILIARY
         
     | 
| 
      
 18 
     | 
    
         
            +
                       before             :   BEFORE
         
     | 
| 
      
 19 
     | 
    
         
            +
                       begin              :   BEGIN
         
     | 
| 
      
 20 
     | 
    
         
            +
                       between            :   BETWEEN
         
     | 
| 
      
 21 
     | 
    
         
            +
                       binary             :   BINARY
         
     | 
| 
      
 22 
     | 
    
         
            +
                       bufferpool         :   BUFFERPOOL
         
     | 
| 
      
 23 
     | 
    
         
            +
                       by                 :   BY
         
     | 
| 
      
 24 
     | 
    
         
            +
                       cache              :   CACHE
         
     | 
| 
      
 25 
     | 
    
         
            +
                       call               :   CALL
         
     | 
| 
      
 26 
     | 
    
         
            +
                       called             :   CALLED
         
     | 
| 
      
 27 
     | 
    
         
            +
                       cardinality        :   CARDINALITY
         
     | 
| 
      
 28 
     | 
    
         
            +
                       capture            :   CAPTURE
         
     | 
| 
      
 29 
     | 
    
         
            +
                       cascaded           :   CASCADED
         
     | 
| 
      
 30 
     | 
    
         
            +
                       case               :   CASE
         
     | 
| 
      
 31 
     | 
    
         
            +
                       cast               :   CAST
         
     | 
| 
      
 32 
     | 
    
         
            +
                       ccsid              :   CCSID
         
     | 
| 
      
 33 
     | 
    
         
            +
                       char               :   CHAR
         
     | 
| 
      
 34 
     | 
    
         
            +
                       character          :   CHARACTER
         
     | 
| 
      
 35 
     | 
    
         
            +
                       check              :   CHECK
         
     | 
| 
      
 36 
     | 
    
         
            +
                       close              :   CLOSE
         
     | 
| 
      
 37 
     | 
    
         
            +
                       cluster            :   CLUSTER
         
     | 
| 
      
 38 
     | 
    
         
            +
                       collection         :   COLLECTION
         
     | 
| 
      
 39 
     | 
    
         
            +
                       collid             :   COLLID
         
     | 
| 
      
 40 
     | 
    
         
            +
                       column             :   COLUMN
         
     | 
| 
      
 41 
     | 
    
         
            +
                       comment            :   COMMENT
         
     | 
| 
      
 42 
     | 
    
         
            +
                       commit             :   COMMIT
         
     | 
| 
      
 43 
     | 
    
         
            +
                       concat             :   CONCAT
         
     | 
| 
      
 44 
     | 
    
         
            +
                       condition          :   CONDITION
         
     | 
| 
      
 45 
     | 
    
         
            +
                       connect            :   CONNECT
         
     | 
| 
      
 46 
     | 
    
         
            +
                       connection         :   CONNECTION
         
     | 
| 
      
 47 
     | 
    
         
            +
                       constraint         :   CONSTRAINT
         
     | 
| 
      
 48 
     | 
    
         
            +
                       contains           :   CONTAINS
         
     | 
| 
      
 49 
     | 
    
         
            +
                       continue           :   CONTINUE
         
     | 
| 
      
 50 
     | 
    
         
            +
                       count              :   COUNT
         
     | 
| 
      
 51 
     | 
    
         
            +
                       count_big          :   COUNT_BIG
         
     | 
| 
      
 52 
     | 
    
         
            +
                       create             :   CREATE
         
     | 
| 
      
 53 
     | 
    
         
            +
                       cross              :   CROSS
         
     | 
| 
      
 54 
     | 
    
         
            +
                       current            :   CURRENT
         
     | 
| 
      
 55 
     | 
    
         
            +
                       current_date       :   CURRENT_DATE
         
     | 
| 
      
 56 
     | 
    
         
            +
                       current_lc_ctype   :   CURRENT_LC_CTYPE
         
     | 
| 
      
 57 
     | 
    
         
            +
                       current_path       :   CURRENT_PATH
         
     | 
| 
      
 58 
     | 
    
         
            +
                       current_time       :   CURRENT_TIME
         
     | 
| 
      
 59 
     | 
    
         
            +
                       current_timestamp  :   CURRENT_TIMESTAMP
         
     | 
| 
      
 60 
     | 
    
         
            +
                       current_timezone   :   CURRENT_TIMEZONE
         
     | 
| 
      
 61 
     | 
    
         
            +
                       current_user       :   CURRENT_USER
         
     | 
| 
      
 62 
     | 
    
         
            +
                       cursor             :   CURSOR
         
     | 
| 
      
 63 
     | 
    
         
            +
                       cycle              :   CYCLE
         
     | 
| 
      
 64 
     | 
    
         
            +
                       data               :   DATA
         
     | 
| 
      
 65 
     | 
    
         
            +
                       database           :   DATABASE
         
     | 
| 
      
 66 
     | 
    
         
            +
                       day                :   DAY
         
     | 
| 
      
 67 
     | 
    
         
            +
                       days               :   DAYS
         
     | 
| 
      
 68 
     | 
    
         
            +
                       dbinfo             :   DBINFO
         
     | 
| 
      
 69 
     | 
    
         
            +
                       db2genrl           :   DB2GENRL
         
     | 
| 
      
 70 
     | 
    
         
            +
                       db2sql             :   DB2SQL
         
     | 
| 
      
 71 
     | 
    
         
            +
                       declare            :   DECLARE
         
     | 
| 
      
 72 
     | 
    
         
            +
                       default            :   DEFAULT
         
     | 
| 
      
 73 
     | 
    
         
            +
                       defaults           :   DEFAULTS
         
     | 
| 
      
 74 
     | 
    
         
            +
                       definition         :   DEFINITION
         
     | 
| 
      
 75 
     | 
    
         
            +
                       delete             :   DELETE
         
     | 
| 
      
 76 
     | 
    
         
            +
                       descriptor         :   DESCRIPTOR
         
     | 
| 
      
 77 
     | 
    
         
            +
                       deterministic      :   DETERMINISTIC
         
     | 
| 
      
 78 
     | 
    
         
            +
                       disallow           :   DISALLOW
         
     | 
| 
      
 79 
     | 
    
         
            +
                       disconnect         :   DISCONNECT
         
     | 
| 
      
 80 
     | 
    
         
            +
                       distinct           :   DISTINCT
         
     | 
| 
      
 81 
     | 
    
         
            +
                       do                 :   DO
         
     | 
| 
      
 82 
     | 
    
         
            +
                       double             :   DOUBLE
         
     | 
| 
      
 83 
     | 
    
         
            +
                       drop               :   DROP
         
     | 
| 
      
 84 
     | 
    
         
            +
                       dssize             :   DSSIZE
         
     | 
| 
      
 85 
     | 
    
         
            +
                       dynamic            :   DYNAMIC
         
     | 
| 
      
 86 
     | 
    
         
            +
                       each               :   EACH
         
     | 
| 
      
 87 
     | 
    
         
            +
                       editproc           :   EDITPROC
         
     | 
| 
      
 88 
     | 
    
         
            +
                       else               :   ELSE
         
     | 
| 
      
 89 
     | 
    
         
            +
                       elseif             :   ELSEIF
         
     | 
| 
      
 90 
     | 
    
         
            +
                       encoding           :   ENCODING
         
     | 
| 
      
 91 
     | 
    
         
            +
                       encryption         :   ENCRYPTION
         
     | 
| 
      
 92 
     | 
    
         
            +
                       end                :   END
         
     | 
| 
      
 93 
     | 
    
         
            +
                       ending             :   ENDING
         
     | 
| 
      
 94 
     | 
    
         
            +
                       end-exec           :   END-EXEC
         
     | 
| 
      
 95 
     | 
    
         
            +
                       erase              :   ERASE
         
     | 
| 
      
 96 
     | 
    
         
            +
                       escape             :   ESCAPE
         
     | 
| 
      
 97 
     | 
    
         
            +
                       except             :   EXCEPT
         
     | 
| 
      
 98 
     | 
    
         
            +
                       excluding          :   EXCLUDING
         
     | 
| 
      
 99 
     | 
    
         
            +
                       exception          :   EXCEPTION
         
     | 
| 
      
 100 
     | 
    
         
            +
                       execute            :   EXECUTE
         
     | 
| 
      
 101 
     | 
    
         
            +
                       exists             :   EXISTS
         
     | 
| 
      
 102 
     | 
    
         
            +
                       exit               :   EXIT
         
     | 
| 
      
 103 
     | 
    
         
            +
                       explain            :   EXPLAIN
         
     | 
| 
      
 104 
     | 
    
         
            +
                       external           :   EXTERNAL
         
     | 
| 
      
 105 
     | 
    
         
            +
                       fenced             :   FENCED
         
     | 
| 
      
 106 
     | 
    
         
            +
                       fetch              :   FETCH
         
     | 
| 
      
 107 
     | 
    
         
            +
                       fieldproc          :   FIELDPROC
         
     | 
| 
      
 108 
     | 
    
         
            +
                       file               :   FILE
         
     | 
| 
      
 109 
     | 
    
         
            +
                       final              :   FINAL
         
     | 
| 
      
 110 
     | 
    
         
            +
                       for                :   FOR
         
     | 
| 
      
 111 
     | 
    
         
            +
                       foreign            :   FOREIGN
         
     | 
| 
      
 112 
     | 
    
         
            +
                       free               :   FREE
         
     | 
| 
      
 113 
     | 
    
         
            +
                       from               :   FROM
         
     | 
| 
      
 114 
     | 
    
         
            +
                       full               :   FULL
         
     | 
| 
      
 115 
     | 
    
         
            +
                       function           :   FUNCTION
         
     | 
| 
      
 116 
     | 
    
         
            +
                       general            :   GENERAL
         
     | 
| 
      
 117 
     | 
    
         
            +
                       generated          :   GENERATED
         
     | 
| 
      
 118 
     | 
    
         
            +
                       get                :   GET
         
     | 
| 
      
 119 
     | 
    
         
            +
                       global             :   GLOBAL
         
     | 
| 
      
 120 
     | 
    
         
            +
                       go                 :   GO
         
     | 
| 
      
 121 
     | 
    
         
            +
                       goto               :   GOTO
         
     | 
| 
      
 122 
     | 
    
         
            +
                       grant              :   GRANT
         
     | 
| 
      
 123 
     | 
    
         
            +
                       graphic            :   GRAPHIC
         
     | 
| 
      
 124 
     | 
    
         
            +
                       group              :   GROUP
         
     | 
| 
      
 125 
     | 
    
         
            +
                       handler            :   HANDLER
         
     | 
| 
      
 126 
     | 
    
         
            +
                       having             :   HAVING
         
     | 
| 
      
 127 
     | 
    
         
            +
                       hold               :   HOLD
         
     | 
| 
      
 128 
     | 
    
         
            +
                       hour               :   HOUR
         
     | 
| 
      
 129 
     | 
    
         
            +
                       hours              :   HOURS
         
     | 
| 
      
 130 
     | 
    
         
            +
                       identity           :   IDENTITY
         
     | 
| 
      
 131 
     | 
    
         
            +
                       if                 :   IF
         
     | 
| 
      
 132 
     | 
    
         
            +
                       immediate          :   IMMEDIATE
         
     | 
| 
      
 133 
     | 
    
         
            +
                       in                 :   IN
         
     | 
| 
      
 134 
     | 
    
         
            +
                       including          :   INCLUDING
         
     | 
| 
      
 135 
     | 
    
         
            +
                       inclusive          :   INCLUSIVE
         
     | 
| 
      
 136 
     | 
    
         
            +
                       increment          :   INCREMENT
         
     | 
| 
      
 137 
     | 
    
         
            +
                       index              :   INDEX
         
     | 
| 
      
 138 
     | 
    
         
            +
                       indicator          :   INDICATOR
         
     | 
| 
      
 139 
     | 
    
         
            +
                       inherit            :   INHERIT
         
     | 
| 
      
 140 
     | 
    
         
            +
                       inner              :   INNER
         
     | 
| 
      
 141 
     | 
    
         
            +
                       inout              :   INOUT
         
     | 
| 
      
 142 
     | 
    
         
            +
                       insensitive        :   INSENSITIVE
         
     | 
| 
      
 143 
     | 
    
         
            +
                       insert             :   INSERT
         
     | 
| 
      
 144 
     | 
    
         
            +
                       integrity          :   INTEGRITY
         
     | 
| 
      
 145 
     | 
    
         
            +
                       into               :   INTO
         
     | 
| 
      
 146 
     | 
    
         
            +
                       is                 :   IS
         
     | 
| 
      
 147 
     | 
    
         
            +
                       isobid             :   ISOBID
         
     | 
| 
      
 148 
     | 
    
         
            +
                       isolation          :   ISOLATION
         
     | 
| 
      
 149 
     | 
    
         
            +
                       iterate            :   ITERATE
         
     | 
| 
      
 150 
     | 
    
         
            +
                       jar                :   JAR
         
     | 
| 
      
 151 
     | 
    
         
            +
                       java               :   JAVA
         
     | 
| 
      
 152 
     | 
    
         
            +
                       join               :   JOIN
         
     | 
| 
      
 153 
     | 
    
         
            +
                       key                :   KEY
         
     | 
| 
      
 154 
     | 
    
         
            +
                       label              :   LABEL
         
     | 
| 
      
 155 
     | 
    
         
            +
                       language           :   LANGUAGE
         
     | 
| 
      
 156 
     | 
    
         
            +
                       lc_ctype           :   LC_CTYPE
         
     | 
| 
      
 157 
     | 
    
         
            +
                       leave              :   LEAVE
         
     | 
| 
      
 158 
     | 
    
         
            +
                       left               :   LEFT
         
     | 
| 
      
 159 
     | 
    
         
            +
                       like               :   LIKE
         
     | 
| 
      
 160 
     | 
    
         
            +
                       linktype           :   LINKTYPE
         
     | 
| 
      
 161 
     | 
    
         
            +
                       local              :   LOCAL
         
     | 
| 
      
 162 
     | 
    
         
            +
                       locale             :   LOCALE
         
     | 
| 
      
 163 
     | 
    
         
            +
                       locator            :   LOCATOR
         
     | 
| 
      
 164 
     | 
    
         
            +
                       locators           :   LOCATORS
         
     | 
| 
      
 165 
     | 
    
         
            +
                       lock               :   LOCK
         
     | 
| 
      
 166 
     | 
    
         
            +
                       lockmax            :   LOCKMAX
         
     | 
| 
      
 167 
     | 
    
         
            +
                       locksize           :   LOCKSIZE
         
     | 
| 
      
 168 
     | 
    
         
            +
                       long               :   LONG
         
     | 
| 
      
 169 
     | 
    
         
            +
                       loop               :   LOOP
         
     | 
| 
      
 170 
     | 
    
         
            +
                       maintained         :   MAINTAINED
         
     | 
| 
      
 171 
     | 
    
         
            +
                       materialized       :   MATERIALIZED
         
     | 
| 
      
 172 
     | 
    
         
            +
                       maxvalue           :   MAXVALUE
         
     | 
| 
      
 173 
     | 
    
         
            +
                       microsecond        :   MICROSECOND
         
     | 
| 
      
 174 
     | 
    
         
            +
                       microseconds       :   MICROSECONDS
         
     | 
| 
      
 175 
     | 
    
         
            +
                       minute             :   MINUTE
         
     | 
| 
      
 176 
     | 
    
         
            +
                       minutes            :   MINUTES
         
     | 
| 
      
 177 
     | 
    
         
            +
                       minvalue           :   MINVALUE
         
     | 
| 
      
 178 
     | 
    
         
            +
                       mode               :   MODE
         
     | 
| 
      
 179 
     | 
    
         
            +
                       modifies           :   MODIFIES
         
     | 
| 
      
 180 
     | 
    
         
            +
                       month              :   MONTH
         
     | 
| 
      
 181 
     | 
    
         
            +
                       months             :   MONTHS
         
     | 
| 
      
 182 
     | 
    
         
            +
                       new                :   NEW
         
     | 
| 
      
 183 
     | 
    
         
            +
                       new_table          :   NEW_TABLE
         
     | 
| 
      
 184 
     | 
    
         
            +
                       nextval            :   NEXTVAL
         
     | 
| 
      
 185 
     | 
    
         
            +
                       no                 :   NO
         
     | 
| 
      
 186 
     | 
    
         
            +
                       nocache            :   NOCACHE
         
     | 
| 
      
 187 
     | 
    
         
            +
                       nocycle            :   NOCYCLE
         
     | 
| 
      
 188 
     | 
    
         
            +
                       nodename           :   NODENAME
         
     | 
| 
      
 189 
     | 
    
         
            +
                       nodenumber         :   NODENUMBER
         
     | 
| 
      
 190 
     | 
    
         
            +
                       nomaxvalue         :   NOMAXVALUE
         
     | 
| 
      
 191 
     | 
    
         
            +
                       nominvalue         :   NOMINVALUE
         
     | 
| 
      
 192 
     | 
    
         
            +
                       none               :   NONE
         
     | 
| 
      
 193 
     | 
    
         
            +
                       noorder            :   NOORDER
         
     | 
| 
      
 194 
     | 
    
         
            +
                       not                :   NOT
         
     | 
| 
      
 195 
     | 
    
         
            +
                       null               :   NULL
         
     | 
| 
      
 196 
     | 
    
         
            +
                       nulls              :   NULLS
         
     | 
| 
      
 197 
     | 
    
         
            +
                       numparts           :   NUMPARTS
         
     | 
| 
      
 198 
     | 
    
         
            +
                       obid               :   OBID
         
     | 
| 
      
 199 
     | 
    
         
            +
                       of                 :   OF
         
     | 
| 
      
 200 
     | 
    
         
            +
                       old                :   OLD
         
     | 
| 
      
 201 
     | 
    
         
            +
                       old_table          :   OLD_TABLE
         
     | 
| 
      
 202 
     | 
    
         
            +
                       on                 :   ON
         
     | 
| 
      
 203 
     | 
    
         
            +
                       open               :   OPEN
         
     | 
| 
      
 204 
     | 
    
         
            +
                       optimization       :   OPTIMIZATION
         
     | 
| 
      
 205 
     | 
    
         
            +
                       optimize           :   OPTIMIZE
         
     | 
| 
      
 206 
     | 
    
         
            +
                       option             :   OPTION
         
     | 
| 
      
 207 
     | 
    
         
            +
                       or                 :   OR
         
     | 
| 
      
 208 
     | 
    
         
            +
                       order              :   ORDER
         
     | 
| 
      
 209 
     | 
    
         
            +
                       out                :   OUT
         
     | 
| 
      
 210 
     | 
    
         
            +
                       outer              :   OUTER
         
     | 
| 
      
 211 
     | 
    
         
            +
                       overriding         :   OVERRIDING
         
     | 
| 
      
 212 
     | 
    
         
            +
                       package            :   PACKAGE
         
     | 
| 
      
 213 
     | 
    
         
            +
                       parameter          :   PARAMETER
         
     | 
| 
      
 214 
     | 
    
         
            +
                       part               :   PART
         
     | 
| 
      
 215 
     | 
    
         
            +
                       padded             :   PADDED
         
     | 
| 
      
 216 
     | 
    
         
            +
                       partition          :   PARTITION
         
     | 
| 
      
 217 
     | 
    
         
            +
                       partitioned        :   PARTITIONED
         
     | 
| 
      
 218 
     | 
    
         
            +
                       partitioning       :   PARTITIONING
         
     | 
| 
      
 219 
     | 
    
         
            +
                       path               :   PATH
         
     | 
| 
      
 220 
     | 
    
         
            +
                       piecesize          :   PIECESIZE
         
     | 
| 
      
 221 
     | 
    
         
            +
                       plan               :   PLAN
         
     | 
| 
      
 222 
     | 
    
         
            +
                       position           :   POSITION
         
     | 
| 
      
 223 
     | 
    
         
            +
                       precision          :   PRECISION
         
     | 
| 
      
 224 
     | 
    
         
            +
                       prepare            :   PREPARE
         
     | 
| 
      
 225 
     | 
    
         
            +
                       prevval            :   PREVVAL
         
     | 
| 
      
 226 
     | 
    
         
            +
                       primary            :   PRIMARY
         
     | 
| 
      
 227 
     | 
    
         
            +
                       priqty             :   PRIQTY
         
     | 
| 
      
 228 
     | 
    
         
            +
                       privileges         :   PRIVILEGES
         
     | 
| 
      
 229 
     | 
    
         
            +
                       procedure          :   PROCEDURE
         
     | 
| 
      
 230 
     | 
    
         
            +
                       program            :   PROGRAM
         
     | 
| 
      
 231 
     | 
    
         
            +
                       psid               :   PSID
         
     | 
| 
      
 232 
     | 
    
         
            +
                       query              :   QUERY
         
     | 
| 
      
 233 
     | 
    
         
            +
                       queryno            :   QUERYNO
         
     | 
| 
      
 234 
     | 
    
         
            +
                       read               :   READ
         
     | 
| 
      
 235 
     | 
    
         
            +
                       reads              :   READS
         
     | 
| 
      
 236 
     | 
    
         
            +
                       recovery           :   RECOVERY
         
     | 
| 
      
 237 
     | 
    
         
            +
                       references         :   REFERENCES
         
     | 
| 
      
 238 
     | 
    
         
            +
                       referencing        :   REFERENCING
         
     | 
| 
      
 239 
     | 
    
         
            +
                       refresh            :   REFRESH
         
     | 
| 
      
 240 
     | 
    
         
            +
                       resignal           :   RESIGNAL
         
     | 
| 
      
 241 
     | 
    
         
            +
                       release            :   RELEASE
         
     | 
| 
      
 242 
     | 
    
         
            +
                       rename             :   RENAME
         
     | 
| 
      
 243 
     | 
    
         
            +
                       repeat             :   REPEAT
         
     | 
| 
      
 244 
     | 
    
         
            +
                       reset              :   RESET
         
     | 
| 
      
 245 
     | 
    
         
            +
                       resignal           :   RESIGNAL
         
     | 
| 
      
 246 
     | 
    
         
            +
                       restart            :   RESTART
         
     | 
| 
      
 247 
     | 
    
         
            +
                       restrict           :   RESTRICT
         
     | 
| 
      
 248 
     | 
    
         
            +
                       result             :   RESULT
         
     | 
| 
      
 249 
     | 
    
         
            +
                       result_set_locator :   RESULT_SET_LOCATOR
         
     | 
| 
      
 250 
     | 
    
         
            +
                       return             :   RETURN
         
     | 
| 
      
 251 
     | 
    
         
            +
                       returns            :   RETURNS
         
     | 
| 
      
 252 
     | 
    
         
            +
                       revoke             :   REVOKE
         
     | 
| 
      
 253 
     | 
    
         
            +
                       right              :   RIGHT
         
     | 
| 
      
 254 
     | 
    
         
            +
                       rollback           :   ROLLBACK
         
     | 
| 
      
 255 
     | 
    
         
            +
                       routine            :   ROUTINE
         
     | 
| 
      
 256 
     | 
    
         
            +
                       row                :   ROW
         
     | 
| 
      
 257 
     | 
    
         
            +
                       rows               :   ROWS
         
     | 
| 
      
 258 
     | 
    
         
            +
                       rowset             :   ROWSET
         
     | 
| 
      
 259 
     | 
    
         
            +
                       rrn                :   RRN
         
     | 
| 
      
 260 
     | 
    
         
            +
                       run                :   RUN
         
     | 
| 
      
 261 
     | 
    
         
            +
                       savepoint          :   SAVEPOINT
         
     | 
| 
      
 262 
     | 
    
         
            +
                       schema             :   SCHEMA
         
     | 
| 
      
 263 
     | 
    
         
            +
                       scratchpad         :   SCRATCHPAD
         
     | 
| 
      
 264 
     | 
    
         
            +
                       second             :   SECOND
         
     | 
| 
      
 265 
     | 
    
         
            +
                       seconds            :   SECONDS
         
     | 
| 
      
 266 
     | 
    
         
            +
                       secqty             :   SECQTY
         
     | 
| 
      
 267 
     | 
    
         
            +
                       security           :   SECURITY
         
     | 
| 
      
 268 
     | 
    
         
            +
                       sequence           :   SEQUENCE
         
     | 
| 
      
 269 
     | 
    
         
            +
                       select             :   SELECT
         
     | 
| 
      
 270 
     | 
    
         
            +
                       sensitive          :   SENSITIVE
         
     | 
| 
      
 271 
     | 
    
         
            +
                       set                :   SET
         
     | 
| 
      
 272 
     | 
    
         
            +
                       signal             :   SIGNAL
         
     | 
| 
      
 273 
     | 
    
         
            +
                       simple             :   SIMPLE
         
     | 
| 
      
 274 
     | 
    
         
            +
                       some               :   SOME
         
     | 
| 
      
 275 
     | 
    
         
            +
                       source             :   SOURCE
         
     | 
| 
      
 276 
     | 
    
         
            +
                       specific           :   SPECIFIC
         
     | 
| 
      
 277 
     | 
    
         
            +
                       sql                :   SQL
         
     | 
| 
      
 278 
     | 
    
         
            +
                       sqlid              :   SQLID
         
     | 
| 
      
 279 
     | 
    
         
            +
                       standard           :   STANDARD
         
     | 
| 
      
 280 
     | 
    
         
            +
                       start              :   START
         
     | 
| 
      
 281 
     | 
    
         
            +
                       static             :   STATIC
         
     | 
| 
      
 282 
     | 
    
         
            +
                       stay               :   STAY
         
     | 
| 
      
 283 
     | 
    
         
            +
                       stogroup           :   STOGROUP
         
     | 
| 
      
 284 
     | 
    
         
            +
                       stores             :   STORES
         
     | 
| 
      
 285 
     | 
    
         
            +
                       style              :   STYLE
         
     | 
| 
      
 286 
     | 
    
         
            +
                       substring          :   SUBSTRING
         
     | 
| 
      
 287 
     | 
    
         
            +
                       summary            :   SUMMARY
         
     | 
| 
      
 288 
     | 
    
         
            +
                       synonym            :   SYNONYM
         
     | 
| 
      
 289 
     | 
    
         
            +
                       sysfun             :   SYSFUN
         
     | 
| 
      
 290 
     | 
    
         
            +
                       sysibm             :   SYSIBM
         
     | 
| 
      
 291 
     | 
    
         
            +
                       sysproc            :   SYSPROC
         
     | 
| 
      
 292 
     | 
    
         
            +
                       system             :   SYSTEM
         
     | 
| 
      
 293 
     | 
    
         
            +
                       table              :   TABLE
         
     | 
| 
      
 294 
     | 
    
         
            +
                       tablespace         :   TABLESPACE
         
     | 
| 
      
 295 
     | 
    
         
            +
                       then               :   THEN
         
     | 
| 
      
 296 
     | 
    
         
            +
                       to                 :   TO
         
     | 
| 
      
 297 
     | 
    
         
            +
                       transaction        :   TRANSACTION
         
     | 
| 
      
 298 
     | 
    
         
            +
                       trigger            :   TRIGGER
         
     | 
| 
      
 299 
     | 
    
         
            +
                       trim               :   TRIM
         
     | 
| 
      
 300 
     | 
    
         
            +
                       type               :   TYPE
         
     | 
| 
      
 301 
     | 
    
         
            +
                       undo               :   UNDO
         
     | 
| 
      
 302 
     | 
    
         
            +
                       union              :   UNION
         
     | 
| 
      
 303 
     | 
    
         
            +
                       unique             :   UNIQUE
         
     | 
| 
      
 304 
     | 
    
         
            +
                       until              :   UNTIL
         
     | 
| 
      
 305 
     | 
    
         
            +
                       update             :   UPDATE
         
     | 
| 
      
 306 
     | 
    
         
            +
                       user               :   USER
         
     | 
| 
      
 307 
     | 
    
         
            +
                       usage              :   USAGE
         
     | 
| 
      
 308 
     | 
    
         
            +
                       user               :   USER
         
     | 
| 
      
 309 
     | 
    
         
            +
                       using              :   USING
         
     | 
| 
      
 310 
     | 
    
         
            +
                       validproc          :   VALIDPROC
         
     | 
| 
      
 311 
     | 
    
         
            +
                       value              :   VALUE
         
     | 
| 
      
 312 
     | 
    
         
            +
                       values             :   VALUES
         
     | 
| 
      
 313 
     | 
    
         
            +
                       variable           :   VARIABLE
         
     | 
| 
      
 314 
     | 
    
         
            +
                       variant            :   VARIANT
         
     | 
| 
      
 315 
     | 
    
         
            +
                       vcat               :   VCAT
         
     | 
| 
      
 316 
     | 
    
         
            +
                       view               :   VIEW
         
     | 
| 
      
 317 
     | 
    
         
            +
                       volatile           :   VOLATILE
         
     | 
| 
      
 318 
     | 
    
         
            +
                       volumes            :   VOLUMES
         
     | 
| 
      
 319 
     | 
    
         
            +
                       when               :   WHEN
         
     | 
| 
      
 320 
     | 
    
         
            +
                       whenever           :   WHENEVER
         
     | 
| 
      
 321 
     | 
    
         
            +
                       where              :   WHERE
         
     | 
| 
      
 322 
     | 
    
         
            +
                       while              :   WHILE
         
     | 
| 
      
 323 
     | 
    
         
            +
                       with               :   WITH
         
     | 
| 
      
 324 
     | 
    
         
            +
                       wlm                :   WLM
         
     | 
| 
      
 325 
     | 
    
         
            +
                       write              :   WRITE
         
     | 
| 
      
 326 
     | 
    
         
            +
                       xmlelement         :   XMLELEMENT
         
     | 
| 
      
 327 
     | 
    
         
            +
                       year               :   YEAR
         
     | 
| 
      
 328 
     | 
    
         
            +
                       years              :   YEARS
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require (RUBY_VERSION =~ /1.9/) ? 'mswin32/rb19x/ibm_db.so':'mswin32/rb18x/ibm_db.so'
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,202 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "cases/helper"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class AdapterTest < ActiveRecord::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 5 
     | 
    
         
            +
                @connection = ActiveRecord::Base.connection
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              if current_adapter?(:IBM_DBAdapter)
         
     | 
| 
      
 9 
     | 
    
         
            +
                def test_a_connection_attributes
         
     | 
| 
      
 10 
     | 
    
         
            +
                  if @connection.servertype.class.name.include?('::IBM_IDS')
         
     | 
| 
      
 11 
     | 
    
         
            +
                    return
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  if @connection.respond_to?(:schema)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    previous_schema = ActiveRecord::Base.connection.schema
         
     | 
| 
      
 15 
     | 
    
         
            +
                    ActiveRecord::Base.connection.schema = 'SYSCAT'
         
     | 
| 
      
 16 
     | 
    
         
            +
                    assert_equal 'SYSCAT', ActiveRecord::Base.connection.schema
         
     | 
| 
      
 17 
     | 
    
         
            +
                    ActiveRecord::Base.connection.schema = previous_schema
         
     | 
| 
      
 18 
     | 
    
         
            +
                  else
         
     | 
| 
      
 19 
     | 
    
         
            +
                    warn "#{@connection.class} does not support client connection attribute schema_name"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
              
         
     | 
| 
      
 22 
     | 
    
         
            +
                  if @connection.respond_to?(:app_user)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    ActiveRecord::Base.connection.app_user = 'new_user'
         
     | 
| 
      
 24 
     | 
    
         
            +
                    assert_equal 'new_user', ActiveRecord::Base.connection.app_user
         
     | 
| 
      
 25 
     | 
    
         
            +
                  else
         
     | 
| 
      
 26 
     | 
    
         
            +
                    warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_USER"
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
              
         
     | 
| 
      
 29 
     | 
    
         
            +
                  if @connection.respond_to?(:account)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    ActiveRecord::Base.connection.account = 'new_acct'
         
     | 
| 
      
 31 
     | 
    
         
            +
                    assert_equal 'new_acct', ActiveRecord::Base.connection.account
         
     | 
| 
      
 32 
     | 
    
         
            +
                  else
         
     | 
| 
      
 33 
     | 
    
         
            +
                    warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_ACCTSTR"
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
              
         
     | 
| 
      
 36 
     | 
    
         
            +
                  if @connection.respond_to?(:application)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    ActiveRecord::Base.connection.application = 'new_app'
         
     | 
| 
      
 38 
     | 
    
         
            +
                    assert_equal 'new_app', ActiveRecord::Base.connection.application
         
     | 
| 
      
 39 
     | 
    
         
            +
                  else
         
     | 
| 
      
 40 
     | 
    
         
            +
                    warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_APPLNAME"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
                  if @connection.respond_to?(:workstation)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    ActiveRecord::Base.connection.workstation = 'new_wrkst'
         
     | 
| 
      
 45 
     | 
    
         
            +
                    assert_equal 'new_wrkst', ActiveRecord::Base.connection.workstation
         
     | 
| 
      
 46 
     | 
    
         
            +
                  else
         
     | 
| 
      
 47 
     | 
    
         
            +
                    warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_WRKSTNNAME"
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
              
         
     | 
| 
      
 52 
     | 
    
         
            +
              def test_tables
         
     | 
| 
      
 53 
     | 
    
         
            +
                tables = @connection.tables
         
     | 
| 
      
 54 
     | 
    
         
            +
                assert tables.include?("accounts")
         
     | 
| 
      
 55 
     | 
    
         
            +
                assert tables.include?("authors")
         
     | 
| 
      
 56 
     | 
    
         
            +
                assert tables.include?("tasks")
         
     | 
| 
      
 57 
     | 
    
         
            +
                assert tables.include?("topics")
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              def test_table_exists?
         
     | 
| 
      
 61 
     | 
    
         
            +
                assert @connection.table_exists?("accounts")
         
     | 
| 
      
 62 
     | 
    
         
            +
                assert !@connection.table_exists?("nonexistingtable")
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
              def test_indexes
         
     | 
| 
      
 66 
     | 
    
         
            +
                idx_name = "accounts_idx"
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                if @connection.respond_to?(:indexes)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  indexes = @connection.indexes("accounts")
         
     | 
| 
      
 70 
     | 
    
         
            +
                  assert indexes.empty?
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  @connection.add_index :accounts, :firm_id, :name => idx_name
         
     | 
| 
      
 73 
     | 
    
         
            +
                  indexes = @connection.indexes("accounts")
         
     | 
| 
      
 74 
     | 
    
         
            +
                  assert_equal "accounts", indexes.first.table
         
     | 
| 
      
 75 
     | 
    
         
            +
                  # OpenBase does not have the concept of a named index
         
     | 
| 
      
 76 
     | 
    
         
            +
                  # Indexes are merely properties of columns.
         
     | 
| 
      
 77 
     | 
    
         
            +
                  assert_equal idx_name, indexes.first.name unless current_adapter?(:OpenBaseAdapter)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  assert !indexes.first.unique
         
     | 
| 
      
 79 
     | 
    
         
            +
                  assert_equal ["firm_id"], indexes.first.columns
         
     | 
| 
      
 80 
     | 
    
         
            +
                else
         
     | 
| 
      
 81 
     | 
    
         
            +
                  warn "#{@connection.class} does not respond to #indexes"
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 85 
     | 
    
         
            +
                @connection.remove_index(:accounts, :name => idx_name) rescue nil
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              def test_current_database
         
     | 
| 
      
 89 
     | 
    
         
            +
                if @connection.respond_to?(:current_database)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  assert_equal ENV['ARUNIT_DB_NAME'] || "activerecord_unittest", @connection.current_database
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              if current_adapter?(:MysqlAdapter)
         
     | 
| 
      
 95 
     | 
    
         
            +
                def test_charset
         
     | 
| 
      
 96 
     | 
    
         
            +
                  assert_not_nil @connection.charset
         
     | 
| 
      
 97 
     | 
    
         
            +
                  assert_not_equal 'character_set_database', @connection.charset
         
     | 
| 
      
 98 
     | 
    
         
            +
                  assert_equal @connection.show_variable('character_set_database'), @connection.charset
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                def test_collation
         
     | 
| 
      
 102 
     | 
    
         
            +
                  assert_not_nil @connection.collation
         
     | 
| 
      
 103 
     | 
    
         
            +
                  assert_not_equal 'collation_database', @connection.collation
         
     | 
| 
      
 104 
     | 
    
         
            +
                  assert_equal @connection.show_variable('collation_database'), @connection.collation
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                def test_show_nonexistent_variable_returns_nil
         
     | 
| 
      
 108 
     | 
    
         
            +
                  assert_nil @connection.show_variable('foo_bar_baz')
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                def test_not_specifying_database_name_for_cross_database_selects
         
     | 
| 
      
 112 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 113 
     | 
    
         
            +
                    assert_nothing_raised do
         
     | 
| 
      
 114 
     | 
    
         
            +
                      ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['arunit'].except(:database))
         
     | 
| 
      
 115 
     | 
    
         
            +
                      ActiveRecord::Base.connection.execute "SELECT activerecord_unittest.pirates.*, activerecord_unittest2.courses.* FROM activerecord_unittest.pirates, activerecord_unittest2.courses"
         
     | 
| 
      
 116 
     | 
    
         
            +
                    end
         
     | 
| 
      
 117 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 118 
     | 
    
         
            +
                    ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 119 
     | 
    
         
            +
                  end
         
     | 
| 
      
 120 
     | 
    
         
            +
                end
         
     | 
| 
      
 121 
     | 
    
         
            +
              end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
              if current_adapter?(:PostgreSQLAdapter)
         
     | 
| 
      
 124 
     | 
    
         
            +
                def test_encoding
         
     | 
| 
      
 125 
     | 
    
         
            +
                  assert_not_nil @connection.encoding
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              def test_table_alias
         
     | 
| 
      
 130 
     | 
    
         
            +
                def @connection.test_table_alias_length() 10; end
         
     | 
| 
      
 131 
     | 
    
         
            +
                class << @connection
         
     | 
| 
      
 132 
     | 
    
         
            +
                  alias_method :old_table_alias_length, :table_alias_length
         
     | 
| 
      
 133 
     | 
    
         
            +
                  alias_method :table_alias_length,     :test_table_alias_length
         
     | 
| 
      
 134 
     | 
    
         
            +
                end
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
                assert_equal 'posts',      @connection.table_alias_for('posts')
         
     | 
| 
      
 137 
     | 
    
         
            +
                assert_equal 'posts_comm', @connection.table_alias_for('posts_comments')
         
     | 
| 
      
 138 
     | 
    
         
            +
                assert_equal 'dbo_posts',  @connection.table_alias_for('dbo.posts')
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                class << @connection
         
     | 
| 
      
 141 
     | 
    
         
            +
                  remove_method :table_alias_length
         
     | 
| 
      
 142 
     | 
    
         
            +
                  alias_method :table_alias_length, :old_table_alias_length
         
     | 
| 
      
 143 
     | 
    
         
            +
                end
         
     | 
| 
      
 144 
     | 
    
         
            +
              end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
              # test resetting sequences in odd tables in postgreSQL
         
     | 
| 
      
 147 
     | 
    
         
            +
              if ActiveRecord::Base.connection.respond_to?(:reset_pk_sequence!)
         
     | 
| 
      
 148 
     | 
    
         
            +
                require 'models/movie'
         
     | 
| 
      
 149 
     | 
    
         
            +
                require 'models/subscriber'
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                def test_reset_empty_table_with_custom_pk
         
     | 
| 
      
 152 
     | 
    
         
            +
                  Movie.delete_all
         
     | 
| 
      
 153 
     | 
    
         
            +
                  Movie.connection.reset_pk_sequence! 'movies'
         
     | 
| 
      
 154 
     | 
    
         
            +
                  assert_equal 1, Movie.create(:name => 'fight club').id
         
     | 
| 
      
 155 
     | 
    
         
            +
                end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                if ActiveRecord::Base.connection.adapter_name != "FrontBase"
         
     | 
| 
      
 158 
     | 
    
         
            +
                  def test_reset_table_with_non_integer_pk
         
     | 
| 
      
 159 
     | 
    
         
            +
                    Subscriber.delete_all
         
     | 
| 
      
 160 
     | 
    
         
            +
                    Subscriber.connection.reset_pk_sequence! 'subscribers'
         
     | 
| 
      
 161 
     | 
    
         
            +
                    sub = Subscriber.new(:name => 'robert drake')
         
     | 
| 
      
 162 
     | 
    
         
            +
                    sub.id = 'bob drake'
         
     | 
| 
      
 163 
     | 
    
         
            +
                    assert_nothing_raised { sub.save! }
         
     | 
| 
      
 164 
     | 
    
         
            +
                  end
         
     | 
| 
      
 165 
     | 
    
         
            +
                end
         
     | 
| 
      
 166 
     | 
    
         
            +
              end
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
              def test_uniqueness_violations_are_translated_to_specific_exception
         
     | 
| 
      
 169 
     | 
    
         
            +
                @connection.execute "INSERT INTO subscribers(nick) VALUES('me')"
         
     | 
| 
      
 170 
     | 
    
         
            +
                assert_raises(ActiveRecord::RecordNotUnique) do
         
     | 
| 
      
 171 
     | 
    
         
            +
                  @connection.execute "INSERT INTO subscribers(nick) VALUES('me')"
         
     | 
| 
      
 172 
     | 
    
         
            +
                end
         
     | 
| 
      
 173 
     | 
    
         
            +
              end
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
              def test_foreign_key_violations_are_translated_to_specific_exception
         
     | 
| 
      
 176 
     | 
    
         
            +
                unless @connection.adapter_name == 'SQLite'
         
     | 
| 
      
 177 
     | 
    
         
            +
                  assert_raises(ActiveRecord::InvalidForeignKey) do
         
     | 
| 
      
 178 
     | 
    
         
            +
                    # Oracle adapter uses prefetched primary key values from sequence and passes them to connection adapter insert method
         
     | 
| 
      
 179 
     | 
    
         
            +
                    if @connection.prefetch_primary_key?
         
     | 
| 
      
 180 
     | 
    
         
            +
                      id_value = @connection.next_sequence_value(@connection.default_sequence_name("fk_test_has_fk", "id"))
         
     | 
| 
      
 181 
     | 
    
         
            +
                      @connection.execute "INSERT INTO fk_test_has_fk (id, fk_id) VALUES (#{id_value},0)"
         
     | 
| 
      
 182 
     | 
    
         
            +
                    else
         
     | 
| 
      
 183 
     | 
    
         
            +
                      @connection.execute "INSERT INTO fk_test_has_fk (fk_id) VALUES (0)"
         
     | 
| 
      
 184 
     | 
    
         
            +
                    end
         
     | 
| 
      
 185 
     | 
    
         
            +
                  end
         
     | 
| 
      
 186 
     | 
    
         
            +
                end
         
     | 
| 
      
 187 
     | 
    
         
            +
              end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              unless current_adapter?(:IBM_DBAdapter)
         
     | 
| 
      
 190 
     | 
    
         
            +
                def test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas
         
     | 
| 
      
 191 
     | 
    
         
            +
                  sql_inject = "1 select * from schema"
         
     | 
| 
      
 192 
     | 
    
         
            +
                  assert_no_match(/schema/, @connection.add_limit_offset!("", :limit=>sql_inject))
         
     | 
| 
      
 193 
     | 
    
         
            +
                  assert_no_match(/schema/, @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7))
         
     | 
| 
      
 194 
     | 
    
         
            +
                end
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
                def test_add_limit_offset_should_sanitize_sql_injection_for_limit_with_comas
         
     | 
| 
      
 197 
     | 
    
         
            +
                  sql_inject = "1, 7 procedure help()"
         
     | 
| 
      
 198 
     | 
    
         
            +
                  assert_no_match(/procedure/, @connection.add_limit_offset!("", :limit=>sql_inject))
         
     | 
| 
      
 199 
     | 
    
         
            +
                  assert_no_match(/procedure/, @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7))
         
     | 
| 
      
 200 
     | 
    
         
            +
                end
         
     | 
| 
      
 201 
     | 
    
         
            +
              end
         
     | 
| 
      
 202 
     | 
    
         
            +
            end
         
     |