You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Greg Reiser (JIRA)" <em...@incubator.apache.org> on 2010/03/30 21:32:27 UTC

[jira] Created: (EMPIREDB-75) DBCommand should allow me to select duplicate columns

DBCommand should allow me to select duplicate columns
-----------------------------------------------------

                 Key: EMPIREDB-75
                 URL: https://issues.apache.org/jira/browse/EMPIREDB-75
             Project: Empire-DB
          Issue Type: Bug
          Components: Core
    Affects Versions: empire-db-2.0.5-incubating
         Environment: Win32, JDK1.6.0_15
            Reporter: Greg Reiser


Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69, EDUCATOR_FACILITY t70
WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
UNION 
SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69
WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1

An overloaded select() method on DBCommand in my dev environment:
public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
    { // Select this column
        if (select == null)
            select = new ArrayList<DBColumnExpr>();
        if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
            select.add(expr);
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMPIREDB-75) DBCommand should allow me to select duplicate columns

Posted by "Greg Reiser (JIRA)" <em...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/EMPIREDB-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Reiser updated EMPIREDB-75:
--------------------------------


Thank you for the explanation...that works for me. And thank you for such an excellent and innovative library.

> DBCommand should allow me to select duplicate columns
> -----------------------------------------------------
>
>                 Key: EMPIREDB-75
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-75
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.0.5-incubating
>         Environment: Win32, JDK1.6.0_15
>            Reporter: Greg Reiser
>
> Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
> SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69, EDUCATOR_FACILITY t70
> WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
> UNION 
> SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69
> WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1
> An overloaded select() method on DBCommand was sufficient in my dev environment:
> public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
>     { // Select this column
>         if (select == null)
>             select = new ArrayList<DBColumnExpr>();
>         if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
>             select.add(expr);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (EMPIREDB-75) DBCommand should allow me to select duplicate columns

Posted by "Rainer Döbele (JIRA)" <em...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/EMPIREDB-75?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852289#action_12852289 ] 

Rainer Döbele commented on EMPIREDB-75:
---------------------------------------

Hi Greg

The reason why we're not allowing to select the same column twice is that we need to address this column in a result set (reader) or a record, hence if the same column expression is selected twice we don't know which column to address.

However it is still possible to select the same column twice - all you need to do is to rename one of them like this:
cmd.select(T.C1, T.C1.as("C2"));
In this case we'll have two different objects and are now able to address the individual columns.

Hence it don't think it is necessary to create an overload for column selection in the DBCommand as you suggested.
Do you mind if I close this issue als "not a Problem"?


> DBCommand should allow me to select duplicate columns
> -----------------------------------------------------
>
>                 Key: EMPIREDB-75
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-75
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.0.5-incubating
>         Environment: Win32, JDK1.6.0_15
>            Reporter: Greg Reiser
>
> Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
> SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69, EDUCATOR_FACILITY t70
> WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
> UNION 
> SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69
> WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1
> An overloaded select() method on DBCommand was sufficient in my dev environment:
> public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
>     { // Select this column
>         if (select == null)
>             select = new ArrayList<DBColumnExpr>();
>         if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
>             select.add(expr);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMPIREDB-75) DBCommand should allow me to select duplicate columns

Posted by "Greg Reiser (JIRA)" <em...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/EMPIREDB-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Reiser updated EMPIREDB-75:
--------------------------------

    Description: 
Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69, EDUCATOR_FACILITY t70
WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
UNION 
SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69
WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1

An overloaded select() method on DBCommand was sufficient in my dev environment:
public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
    { // Select this column
        if (select == null)
            select = new ArrayList<DBColumnExpr>();
        if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
            select.add(expr);
    }

  was:
Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69, EDUCATOR_FACILITY t70
WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
UNION 
SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
FROM EDUCATOR t69
WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1

An overloaded select() method on DBCommand in my dev environment:
public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
    { // Select this column
        if (select == null)
            select = new ArrayList<DBColumnExpr>();
        if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
            select.add(expr);
    }


> DBCommand should allow me to select duplicate columns
> -----------------------------------------------------
>
>                 Key: EMPIREDB-75
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-75
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.0.5-incubating
>         Environment: Win32, JDK1.6.0_15
>            Reporter: Greg Reiser
>
> Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
> SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69, EDUCATOR_FACILITY t70
> WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
> UNION 
> SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69
> WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1
> An overloaded select() method on DBCommand was sufficient in my dev environment:
> public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
>     { // Select this column
>         if (select == null)
>             select = new ArrayList<DBColumnExpr>();
>         if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
>             select.add(expr);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (EMPIREDB-75) DBCommand should allow me to select duplicate columns

Posted by "Rainer Döbele (JIRA)" <em...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/EMPIREDB-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rainer Döbele resolved EMPIREDB-75.
-----------------------------------

    Resolution: Not A Problem
      Assignee: Rainer Döbele

> DBCommand should allow me to select duplicate columns
> -----------------------------------------------------
>
>                 Key: EMPIREDB-75
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-75
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.0.5-incubating
>         Environment: Win32, JDK1.6.0_15
>            Reporter: Greg Reiser
>            Assignee: Rainer Döbele
>
> Allowing the option to (explicitly) select a duplicate column in DBCommand would be helpful for a UNION type of statement. Here is the scenario: I have enterprise educators that are able to work within all colleges in a university while I have others that can only work in specific colleges (specialized). Also, each educator can have an enterprise id and/or a facility-specific ID. I need to be able to query the possible educators for a specific college. Here is my SQL:
> SELECT t70.EDUCATOR_CODE, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69, EDUCATOR_FACILITY t70
> WHERE t69.EDUCATOR_SID=t70.EDUCATOR_SID AND t69.STATUS=1 AND t70.FACILITY_SID=355 
> UNION 
> SELECT t69.EDUCATOR_ID, t69.EDUCATOR_ID, t69.EDUCATOR_SID
> FROM EDUCATOR t69
> WHERE t69.FACILITY_MAP_CODE=1 AND t69.STATUS=1
> An overloaded select() method on DBCommand was sufficient in my dev environment:
> public void select(DBColumnExpr expr, boolean allowDuplicateColumns)
>     { // Select this column
>         if (select == null)
>             select = new ArrayList<DBColumnExpr>();
>         if (expr != null && allowDuplicateColumns ? true : (select.contains(expr) == false))
>             select.add(expr);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.