OpenSAGA Core

SELECT COUNT(*) should be simpler for SQL based data access

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: OpenSAGA 1.1.0
  • Fix Version/s: OpenSAGA 3.0.0
  • Component/s: Persistence
  • Labels:
    None

Description

Currently we do something like

<#if isCount>
  SELECT COUNT(*)
<#else>
  SELECT ... a lot ...
</#if>

It would be much preferrable to just have

SELECT ... a lot ...

and then let the corresponding DAO check

  • if COUNT(*) occurs in the resulting SQL expression and then
  • just use it when it is there
  • do some simple string parsing that cuts away everything between SELECT and FROM (for the first match) and replaces it with COUNT(*).

By adding this check we will be able to use both the old style and the new much improved style.

Activity

Hide
Jochen Terstiege added a comment - - edited

Parsing for count() might be a little dangerous, what happens if an inner subselect statement uses count() too?

Show
Jochen Terstiege added a comment - - edited Parsing for count() might be a little dangerous, what happens if an inner subselect statement uses count() too?
Hide
Thomas Biskup added a comment -

Ok, maybe "if COUNT occurs in the resulting SQL expression and there is but one occurrence of SELECT before it, then..."

Show
Thomas Biskup added a comment - Ok, maybe "if COUNT occurs in the resulting SQL expression and there is but one occurrence of SELECT before it, then..."

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: