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

CustomSql Update Failure doesn't give clue to cause

$
0
0
SmartClient Version: v9.1p_2015-02-07/PowerEdition Deployment (built 2015-02-07)

I'm as usual executing a custom SQL procedure,which fails without giving me a clue as to why or where to look.

Here is what the datasource .ds.xml looks like in parts:

Code:


<DataSource ID="BCG_Import_Block" serverType="sql" tableName="FULL_NAV_TREE"
        dropExtraFields="false" requiresAuthentication="false">
        <fields>

                <field name="PK_Fake" primaryKey="true" type="sequence" hidden="true" />
                <field name="FK_idProject" tableName="FULL_NAV_TREE" hidden="true" />
                <field name="idBlock_Props" tableName="FULL_NAV_TREE" hidden="true" />
                <field name="Instance_Id"  hidden="true" type="integer"/>
                <field name="Instance"  hidden="true" type="text"/>
                <field name="Macro" hidden="true" type="text" />
               
....... more field definitions

                  <operationBinding operationType="update" operationId="importSynthData" allowMultiUpdate="true" >
                <customSQL>
                BEGIN
        DECLARE        @return_value int
        DECLARE @PK_Fake  bigint = $values.PK_Target
 
        EXEC  @return_value = [dbo].[usp_ImportSynthRundir]
                      @Source_PK_Synth_Rundir  = $values.PK_Source,
                      @Target_PK_Synth_Rundir  = $values.PK_Target,
                      @FS_Run_Type = 'Release',
                      @FS_Run_Name  = 'Not Required',
                      @Source_idBlock_Props = 0,
                      @createLock = 0,
                      @debug = 0

      SELECT @return_value as PK_Fake               
          END
          </customSQL>
          </operationBinding>

This is what the client side call looks like:

Code:

Record synthRec = new Record();
                                synthRec.setAttribute("PK_Source",importHierResultRec.getAttributeAsLong("Orig_Synth_PK_Synth_Rundir"));
                                                                synthRec.setAttribute("PK_Target",importHierResultRec.getAttributeAsLong("Synth_PK_Synth_Rundir"));
                                                        //        synthRec.setAttribute("PK_Fake",0L);
                                                               
                                                                DataSource.get("BCG_Import_Block").updateData(synthRec, new DSCallback () {

                                                                        @Override
                                                                        public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
                                                                                //  Auto-generated method stub
                                                                                if (dsResponse.getStatus() != 0 ) {
                                                                                        SC.say("Import Data Failure: Import Synth Data failure in server");
                                                                                        return;
                                                                                }
                                                                                Record [] synthRec = dsResponse.getData();
                                                                                if (synthRec[0].getAttributeAsInt("ReturnValue") == 0) {
                                                                                        importStatusRecords[0].setAttribute(importStatusGridFieldNames[2], "Imported");
                                                                                }
                                                                                else {
                                                                                        importStatusRecords[0].setAttribute(importStatusGridFieldNames[2], "Failure. Code: " + synthRec[0].getAttributeAsString("ReturnValue"));
                                                                                }
                                                                                importStatusGrid.setData(importStatusRecords); // Update grid
                                                                       
                                                                        }
                                                                }, new DSRequest() {{setOperationId("importSynthData");}} );

Sorry the copy-n-paste seemed to expand the above code to the right.

The server logs show the following happening:

Code:

=== 2015-04-20 12:20:35,402 [l0-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
    criteria:{
    },
    values:{
        PK_Source:41320,
        PK_Target:51449
    },
    operationConfig:{
        dataSource:"BCG_Import_Block",
        repo:null,
        operationType:"update",
        textMatchStyle:"exact"
    },
    appID:"builtinApplication",
    operation:"importSynthData",
    oldValues:{
        PK_Source:41320,
        PK_Target:51449
    }
}
=== 2015-04-20 12:20:35,404 [l0-4] INFO  IDACall - Performing 1 operation(s)
=== 2015-04-20 12:20:35,404 [l0-4] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
=== 2015-04-20 12:20:35,404 [l0-4] DEBUG DeclarativeSecurity - DataSource BCG_Import_Block is not in the pre-checked list, processing...
=== 2015-04-20 12:20:35,405 [l0-4] DEBUG AppBase - [builtinApplication.importSynthData] No userTypes defined, allowing anyone access to all operations for this application
=== 2015-04-20 12:20:35,405 [l0-4] DEBUG AppBase - [builtinApplication.importSynthData] No public zero-argument method named '_importSynthData' found, performing generic datasource operation
=== 2015-04-20 12:20:35,405 [l0-4] INFO  SQLDataSource - [builtinApplication.importSynthData] Performing update operation with
        criteria: {}        values: {PK_Source:41320,PK_Target:51449}
=== 2015-04-20 12:20:35,405 [l0-4] INFO  SQLValuesClause - [builtinApplication.importSynthData] Ignored data for non-existent or included columns: [PK_Source, PK_Target]
=== 2015-04-20 12:20:35,405 [l0-4] INFO  SQLWhereClause - [builtinApplication.importSynthData] empty condition
=== 2015-04-20 12:20:35,410 [l0-4] DEBUG PoolableSQLConnectionFactory - [builtinApplication.importSynthData] DriverManager fetching connection for BEER_QA via jdbc url jdbc:sqlserver://db-qa-beer.broadcom.com:1433;DatabaseName=BEER;User=SmartGWT_UI;Password=Kepler12
=== 2015-04-20 12:20:35,410 [l0-4] DEBUG PoolableSQLConnectionFactory - [builtinApplication.importSynthData] Passing JDBC URL only to getConnection
=== 2015-04-20 12:20:35,467 [l0-4] DEBUG PoolableSQLConnectionFactory - [builtinApplication.importSynthData] makeObject() created an unpooled Connection '566980078'
=== 2015-04-20 12:20:35,467 [l0-4] DEBUG SQLConnectionManager - [builtinApplication.importSynthData] Borrowed connection '566980078'
=== 2015-04-20 12:20:35,478 [l0-4] DEBUG SQLTransaction - [builtinApplication.importSynthData] Started new BEER_QA transaction "566980078"
=== 2015-04-20 12:20:35,478 [l0-4] DEBUG SQLDriver - [builtinApplication.importSynthData] About to execute SQL update in 'BEER_QA' using connection'566980078'
=== 2015-04-20 12:20:35,478 [l0-4] INFO  SQLDriver - [builtinApplication.importSynthData] Executing SQL update on 'BEER_QA': BEGIN
        DECLARE        @return_value int
        DECLARE @PK_Fake  bigint = 51449
 
        EXEC  @return_value = [dbo].[usp_ImportSynthRundir]
                      @Source_PK_Synth_Rundir  = 41320,
                      @Target_PK_Synth_Rundir  = 51449,
                      @FS_Run_Type = 'Release',
                      @FS_Run_Name  = 'Not Required',
                      @Source_idBlock_Props = 0,
                      @createLock = 0,
                      @debug = 0

      SELECT @return_value as PK_Fake               
          END
=== 2015-04-20 12:20:47,675 [l0-4] DEBUG SQLDriver - [builtinApplication.importSynthData] FAILED to execute SQL update in 'BEER_QA' using connection'566980078'
=== 2015-04-20 12:20:47,675 [l0-4] WARN  RequestContext - dsRequest.execute() failed:
com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:417)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)

If I run this exact procedure in the SQL Server Studio it works just fine:

Code:

BEGIN
        DECLARE        @return_value int
        DECLARE @PK_Fake  bigint = 51449
 
        EXEC  @return_value = [dbo].[usp_ImportSynthRundir]
                      @Source_PK_Synth_Rundir  = 41320,
                      @Target_PK_Synth_Rundir  = 51449,
                      @FS_Run_Type = 'Release',
                      @FS_Run_Name  = 'Not Required',
                      @Source_idBlock_Props = 0,
                      @createLock = 0,
                      @debug = 0

      SELECT @return_value as PK_Fake               
END

It returns 0 indicating no errors in the procedure.

Is the problem that the Datasource, 'BCG_Import_Block' does not contain field definitions for 'PK_Source' and 'PK_Target' ?

I thought that the datasource directive 'dropExtraFields="false"' worked around that validation problem.

What is the server telling me if it says simply:

=== 2015-04-20 12:20:47,675 [l0-4] DEBUG SQLDriver - [builtinApplication.importSynthData] FAILED to execute SQL update in 'BEER_QA' using connection'566980078'

??

Viewing all articles
Browse latest Browse all 4756

Trending Articles