| 2373 | // |
| 2374 | |
| 2375 | static void put_dtype( gpre_req* request, const gpre_fld* field) |
| 2376 | { |
| 2377 | USHORT dtype = 0; |
| 2378 | |
| 2379 | USHORT length = field->fld_length; |
| 2380 | //const USHORT precision = field->fld_precision; |
| 2381 | //const USHORT sub_type = field->fld_sub_type; |
| 2382 | switch (field->fld_dtype) |
| 2383 | { |
| 2384 | case dtype_cstring: |
| 2385 | |
| 2386 | // If the user is defining a field as cstring then generate |
| 2387 | // blr_cstring. Currently being used only for defining udf's |
| 2388 | |
| 2389 | if (field->fld_flags & FLD_meta_cstring) |
| 2390 | dtype = blr_cstring; |
| 2391 | else |
| 2392 | { |
| 2393 | |
| 2394 | // Correct the length of C string for meta data operations |
| 2395 | |
| 2396 | if (gpreGlob.sw_cstring && field->fld_sub_type != dsc_text_type_fixed) |
| 2397 | length--; |
| 2398 | dtype = blr_text; |
| 2399 | } |
| 2400 | |
| 2401 | case dtype_text: |
| 2402 | if (field->fld_dtype == dtype_text) |
| 2403 | dtype = blr_text; |
| 2404 | // Fall into |
| 2405 | |
| 2406 | case dtype_varying: |
| 2407 | fb_assert(length); |
| 2408 | if (field->fld_dtype == dtype_varying) |
| 2409 | dtype = blr_varying; |
| 2410 | |
| 2411 | put_numeric(request, isc_dyn_fld_type, dtype); |
| 2412 | put_numeric(request, isc_dyn_fld_length, length); |
| 2413 | put_numeric(request, isc_dyn_fld_scale, 0); |
| 2414 | |
| 2415 | if (field->fld_sub_type) |
| 2416 | put_numeric(request, isc_dyn_fld_sub_type, field->fld_sub_type); |
| 2417 | |
| 2418 | if (field->fld_char_length) |
| 2419 | put_numeric(request, isc_dyn_fld_char_length, field->fld_char_length); |
| 2420 | if (field->fld_collate_id) |
| 2421 | put_numeric(request, isc_dyn_fld_collation, field->fld_collate_id); |
| 2422 | |
| 2423 | if (field->fld_charset_id) |
| 2424 | put_numeric(request, isc_dyn_fld_character_set, field->fld_charset_id); |
| 2425 | return; |
| 2426 | |
| 2427 | case dtype_short: |
| 2428 | dtype = blr_short; |
| 2429 | length = sizeof(SSHORT); |
| 2430 | if (gpreGlob.sw_server_version >= 6) |
| 2431 | { |
| 2432 | put_numeric(request, isc_dyn_fld_type, dtype); |
no test coverage detected