Opened 12 years ago

Closed 9 years ago

#245 closed defect (fixed)

Update and select rasql queries distinction

Reported by: Dimitar Misev Owned by: Dimitar Misev
Priority: major Milestone: 9.0.x
Component: rasodmg Version: 8.3
Keywords: Cc: Peter Baumann
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 by Peter Baumann, 12 years ago

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 by Peter Baumann, 12 years ago

Milestone: 9.0

comment:3 by Dimitar Misev, 9 years ago

Complexity: 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 by Dimitar Misev, 9 years ago

Patch submitted.

comment:5 by Dimitar Misev, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.