Opened 5 years ago

Closed 20 months ago

#245 closed defect (fixed)

Update and select rasql queries distinction

Reported by: dmisev Owned by: dmisev
Priority: major Milestone: 9.0.x
Component: rasodmg Version: 8.3
Keywords: Cc: pbaumann
Complexity: Very Hard

Description

In source:rasodmg/oqlquery.cc (line 422), the code that determines if a query is a selection query should be fixed, as in many cases as it is now it would fail (e.g. if there are newlines in the query):

The relevant code is

returnValue = upperCaseQueryString.find("SELECT ") != std::string::npos &&
              upperCaseQueryString.find(" INTO ") == std::string::npos;

This functionality is only used by rasql at the moment, to determine which version of r_oql_execute to call. The same distinction is done in rasj as well.

Change History (5)

comment:1 Changed 5 years ago by pbaumann

yes, this was the naive way to find out the query type without parsing - obviously too shortsighted. The only clean way that comes to my mind now is to overload the execute() method and have variants, maybe by adding an optional parameter

enum r_QueryType

with default QUERYTYPE_SELECT. We might even have to distinguish further once UPDATE delivers the newly created OID and, hence, requires a different c/s protocol as well.
Or if we once want to allow several queries to be sent in one request...

comment:2 Changed 4 years ago by pbaumann

  • Milestone set to 9.0

comment:3 Changed 20 months ago by dmisev

  • Complexity set to Very Hard

This will fail because of the unreliable method of determining if a query is insert or update (function r_OQL_Query::is_insert_query() in source:rasodmg/oqlquery.cc

rasql -q 'create collection test_insert GreySet' --user rasadmin --passwd rasadmin

comment:4 Changed 20 months ago by dmisev

Patch submitted.

comment:5 Changed 20 months ago by dmisev

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.