Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

operationBinding.skipRowCount caused tableClause to be ignored?

$
0
0
This thread is related to the other one but I give it a separate thread to make the question more apparent.

http://forums.smartclient.com/showthread.php?t=33046

I have a data source with multiple operationBinding's. It has been working well until I add one more operationBinding with skipRowCount set to true.

Code:

<DataSource
    ID="rs358223955"
    serverType="sql"
    progressiveLoading="false"
    progressiveLoadingThreshold="-1"
    tableName="env"
>
    <fields>
        ...
    </fields>
    <operationBindings>
        <operationBinding operationType="fetch" operationId="RsUseQueryNonProgressive" 
                progressiveLoading="false"  >
            <selectClause><![CDATA[
                  env.timeDate as timeDate
                , env.app as app
                , env.totalBytesRatioInSysTotal as totalBytesRatioInSysTotal
                , env.downBytesRatioInSysTotal as downBytesRatioInSysTotal
                , env.pktLossRate as pktLossRate
                , env.downThruput as downThruput
                , env.satDownThruput as satDownThruput
            ]]></selectClause>
            <tableClause>nara_db.rs358223955 as env
            </tableClause>
        </operationBinding>
        <operationBinding operationType="fetch" operationId="RsUseQuerySkipRowCount" 
                progressiveLoading="false"  skipRowCount="true"  >
            <selectClause><![CDATA[
                  env.timeDate as timeDate
                , env.app as app
                , env.totalBytesRatioInSysTotal as totalBytesRatioInSysTotal
                , env.downBytesRatioInSysTotal as downBytesRatioInSysTotal
                , env.pktLossRate as pktLossRate
                , env.downThruput as downThruput
                , env.satDownThruput as satDownThruput
            ]]></selectClause>
            <tableClause>nara_db.rs358223955 as env
            </tableClause>
        </operationBinding>
        ...
    </operationBindings>
</DataSource>

The first operationBinding (with Id="RsUseQueryNonProgressive") worked perfectly, but the second operationBinding (with Id="RsUseQuerySkipRowCount") did not work.

First of all, I noticed that even I had specified skipRowCount="true", I still saw that SmartGWT issued a counting query.

And then the query also ignored the tableClause -- it should have say "from nara_db.rs358223955 as env" but it didn't -- it just said "from env", which is wrong and caused an SQL error of "com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dw_db.env' doesn't exist"

Below is the debug log I obtained.

Code:

=== 2015-06-17 17:50:33,757 [6-35] INFO  SQLDataSource - Performing fetch operation with
        criteria: {}    values: {}
=== 2015-06-17 17:50:33,757 [6-35] INFO  SQLWhereClause - empty condition
=== 2015-06-17 17:50:33,757 [6-35] INFO  SQLDataSource - derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause ORDER BY $defaultOrderClause
=== 2015-06-17 17:50:33,758 [6-35] DEBUG SQLDataSource - Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
=== 2015-06-17 17:50:33,758 [6-35] DEBUG SQLDataSource - Eval'd row count query: SELECT COUNT(*) FROM env WHERE ('1'='1')
=== 2015-06-17 17:50:33,758 [6-35] DEBUG SQLDriver - About to execute SQL query in 'central_aware_db_4100' using connection '1259753404'
=== 2015-06-17 17:50:33,758 [6-35] INFO  SQLDriver - Executing SQL query on 'central_aware_db_4100': SELECT COUNT(*) FROM env WHERE ('1'='1')
=== 2015-06-17 17:50:33,763 [6-35] INFO  SQLDriver - Execute of select: SELECT COUNT(*) FROM env WHERE ('1'='1') on db: central_aware_db_4100 threw exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dw_db.env' doesn't exist - assuming stale connection and retrying query.

To show why the above was wrong, I am also showing the debug log for the other operationBinding that worked well. For this one, the equivalent debug log was:

Code:

=== 2015-06-17 17:47:45,303 [6-35] DEBUG SQLDataSource - Executing row count query: SELECT COUNT(*) FROM nara_db.rs358223955 as env
            WHERE $defaultWhereClause
=== 2015-06-17 17:47:45,303 [6-35] DEBUG SQLDataSource - Eval'd row count query: SELECT COUNT(*) FROM nara_db.rs358223955 as env
            WHERE ('1'='1')
=== 2015-06-17 17:47:45,303 [6-35] DEBUG PoolableSQLConnectionFactory - Executing pingTest 'select 1 from dual' on connection 1259753404
=== 2015-06-17 17:47:45,326 [6-35] DEBUG SQLConnectionManager - Borrowed connection '1259753404'
=== 2015-06-17 17:47:45,326 [6-35] DEBUG SQLDriver - About to execute SQL query in 'central_aware_db_4100' using connection '1259753404'
=== 2015-06-17 17:47:45,326 [6-35] INFO  SQLDriver - Executing SQL query on 'central_aware_db_4100': SELECT COUNT(*) FROM nara_db.rs358223955 as env
            WHERE ('1'='1')

Our environment:

1. SmartClient Version: v10.0p_2015-02-03/PowerEdition Deployment (built 2015-02-03)

2. Browser: (not applicable)

3. Server log: (not applicable)

Viewing all articles
Browse latest Browse all 4756

Trending Articles