| 123 | |
| 124 | template <typename T> |
| 125 | unsigned add(unsigned& t, unsigned& sz, FieldLink* lnk) |
| 126 | { |
| 127 | if (metadata) |
| 128 | { |
| 129 | unsigned l = metadata->getCount(&statusWrapper); |
| 130 | check(&statusWrapper); |
| 131 | if (fieldCount >= l) |
| 132 | { |
| 133 | #ifdef INTERNAL_FIREBIRD |
| 134 | (Firebird::Arg::Gds(isc_random) << |
| 135 | "Attempt to add to the message more variables than possible").raise(); |
| 136 | #else |
| 137 | fatalErrorHandler("Attempt to add to the message more variables than possible"); |
| 138 | #endif |
| 139 | } |
| 140 | |
| 141 | t = metadata->getType(&statusWrapper, fieldCount); |
| 142 | check(&statusWrapper); |
| 143 | sz = metadata->getLength(&statusWrapper, fieldCount); |
| 144 | check(&statusWrapper); |
| 145 | if (!checkType<T>(t, sz)) |
| 146 | { |
| 147 | #ifdef INTERNAL_FIREBIRD |
| 148 | (Firebird::Arg::Gds(isc_random) << "Incompatible data type").raise(); |
| 149 | #else |
| 150 | fatalErrorHandler("Incompatible data type"); |
| 151 | #endif |
| 152 | } |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | fb_assert(builder); |
| 157 | |
| 158 | unsigned f = builder->addField(&statusWrapper); |
| 159 | check(&statusWrapper); |
| 160 | |
| 161 | fb_assert(f == fieldCount); |
| 162 | |
| 163 | t = getType<T>(sz); |
| 164 | builder->setType(&statusWrapper, f, t); |
| 165 | check(&statusWrapper); |
| 166 | builder->setLength(&statusWrapper, f, sz); |
| 167 | check(&statusWrapper); |
| 168 | |
| 169 | lnk->next = fieldList; |
| 170 | fieldList = lnk; |
| 171 | } |
| 172 | |
| 173 | return fieldCount++; |
| 174 | } |
| 175 | |
| 176 | static void check(Firebird::IStatus* status) |
| 177 | { |
no test coverage detected