| 1008 | // |
| 1009 | |
| 1010 | static void gen_blob_open( const act* action, USHORT column) |
| 1011 | { |
| 1012 | const TEXT* pattern1 = |
| 1013 | "%BH = %DH->%IFcreate%ELopen%ENBlob (%V1, %RT, %FR, %N1, %I1);"; |
| 1014 | const TEXT* pattern2 = |
| 1015 | "%BH = %DH->%IFcreate%ELopen%ENBlob (%V1, %RT, %FR);"; |
| 1016 | |
| 1017 | if (gpreGlob.sw_auto && (action->act_flags & ACT_sql)) |
| 1018 | { |
| 1019 | t_start_auto(action, action->act_request, status_vector(action), column, true); |
| 1020 | printa(column, "if (%s)", request_trans(action, action->act_request)); |
| 1021 | column += INDENT; |
| 1022 | } |
| 1023 | |
| 1024 | if ((action->act_error && (action->act_type != ACT_blob_for)) || (action->act_flags & ACT_sql)) |
| 1025 | { |
| 1026 | begin(column); |
| 1027 | } |
| 1028 | |
| 1029 | TEXT s[MAX_REF_SIZE]; |
| 1030 | const blb* blob; |
| 1031 | const ref* reference; |
| 1032 | if (action->act_flags & ACT_sql) |
| 1033 | { |
| 1034 | column = gen_cursor_open(action, action->act_request, column); |
| 1035 | blob = (blb*) action->act_request->req_blobs; |
| 1036 | reference = ((const open_cursor*) action->act_object)->opn_using; |
| 1037 | gen_name(s, reference, true); |
| 1038 | } |
| 1039 | else |
| 1040 | { |
| 1041 | blob = (blb*) action->act_object; |
| 1042 | reference = blob->blb_reference; |
| 1043 | } |
| 1044 | |
| 1045 | PAT args; |
| 1046 | args.pat_condition = (action->act_type == ACT_blob_create); // open or create blob |
| 1047 | args.pat_vector1 = status_vector(action); // status vector |
| 1048 | args.pat_database = blob->blb_request->req_database; // database handle |
| 1049 | args.pat_request = blob->blb_request; // transaction handle |
| 1050 | args.pat_blob = blob; // blob handle |
| 1051 | args.pat_reference = reference; // blob identifier |
| 1052 | args.pat_ident1 = blob->blb_bpb_ident; |
| 1053 | |
| 1054 | if ((action->act_flags & ACT_sql) && action->act_type == ACT_blob_open) |
| 1055 | { |
| 1056 | align(column); |
| 1057 | fprintf(gpreGlob.out_file, "%s = %s;", s, reference->ref_value); |
| 1058 | } |
| 1059 | |
| 1060 | if (args.pat_value1 = blob->blb_bpb_length) |
| 1061 | PATTERN_expand(column, pattern1, &args); |
| 1062 | else |
| 1063 | PATTERN_expand(column, pattern2, &args); |
| 1064 | |
| 1065 | if (action->act_flags & ACT_sql) |
| 1066 | { |
| 1067 | endp(column); |
no test coverage detected