| 5725 | // |
| 5726 | |
| 5727 | static gpre_req* par_cursor( gpre_sym** symbol_ptr) |
| 5728 | { |
| 5729 | // par_cursor() is called to use a previously declared cursor. |
| 5730 | // tok_symbol == NULL means one of the two things. |
| 5731 | // a) The name does not belong to a cursor. OR |
| 5732 | // b) get_token() function in gpre.cpp was not able to find the cursor |
| 5733 | // in hash table. |
| 5734 | // |
| 5735 | // case a) is an error condition. |
| 5736 | // case b) Could have resulted because the cursor name was upcased and |
| 5737 | // inserted into hash table since it was not quoted and it is |
| 5738 | // now being refered as it was declared. |
| 5739 | // |
| 5740 | // Hence, Try and lookup the cursor name after resolving it once more. If |
| 5741 | // it still cannot be located, Its an error |
| 5742 | |
| 5743 | SQL_resolve_identifier("<cursor name>", NULL, MAX_CURSOR_SIZE); |
| 5744 | gpre_sym* symbol = HSH_lookup(gpreGlob.token_global.tok_string); |
| 5745 | gpreGlob.token_global.tok_symbol = symbol; |
| 5746 | if (symbol && symbol->sym_type == SYM_keyword) |
| 5747 | gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword; |
| 5748 | else |
| 5749 | gpreGlob.token_global.tok_keyword = KW_none; |
| 5750 | |
| 5751 | symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_cursor); |
| 5752 | |
| 5753 | if (!symbol) |
| 5754 | symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_delimited_cursor); |
| 5755 | |
| 5756 | if (symbol) |
| 5757 | { |
| 5758 | PAR_get_token(); |
| 5759 | if (symbol_ptr) |
| 5760 | *symbol_ptr = symbol; |
| 5761 | return (gpre_req*) symbol->sym_object; |
| 5762 | } |
| 5763 | |
| 5764 | symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_dyn_cursor); |
| 5765 | if (symbol) |
| 5766 | PAR_error("DSQL cursors require DSQL update & delete statements"); |
| 5767 | |
| 5768 | CPR_s_error("<cursor name>"); |
| 5769 | return NULL; // silence compiler |
| 5770 | } |
| 5771 | |
| 5772 | |
| 5773 | //____________________________________________________________ |
no test coverage detected