Generated query problem

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 21-Mar-2012 16:28:25   

I am running into a generated query problem with a DB2 database.

I am attaching the screenshots for the entity definition. The table has an identity column. The query has one extra parameter (11) compared to the ? parameter placeholders (10).

I am using the most recent version of LLBGen 3.1 but the driver is a custom driver for DataDirect provider.

            Query: INSERT INTO "WELDIVDX"."HOLD_WORKER_ASGN_RULE" ("FUNC_UNIT_CD",

"HOLD_WORKER_ID", "RFRL_RNG_HIGH_TXT", "RFRL_RNG_LOW_TXT", "WRKR_ASGN_RULE_ID", "WORKER_ID", "WRKR_LCTY_FIPS_CD", "WRKR_RFRL_OPT_CD", "WRKR_RFRL_STAT_CD", "RULE_VALID_IND" ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Parameter: @p2 : AnsiStringFixedLength. Length: 4. Precision: 0. Scale: 0. Direction: InputOutput. Value: "ENFA". Parameter: @p3 : AnsiStringFixedLength. Length: 8. Precision: 0. Scale: 0. Direction: InputOutput. Value: "HQDIS008". Parameter: @p4 : AnsiStringFixedLength. Length: 4. Precision: 0. Scale: 0. Direction: InputOutput. Value: "FZZZ". Parameter: @p5 : AnsiStringFixedLength. Length: 4. Precision: 0. Scale: 0. Direction: InputOutput. Value: "A". Parameter: @p6 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: InputOutput. Value: 11819. Parameter: @p7 : AnsiStringFixedLength. Length: 8. Precision: 0. Scale: 0. Direction: InputOutput. Value: "D1ENF006". Parameter: @p8 : AnsiStringFixedLength. Length: 10. Precision: 0. Scale: 0. Direction: InputOutput. Value: "51041". Parameter: @p9 : AnsiStringFixedLength. Length: 4. Precision: 0. Scale: 0. Direction: InputOutput. Value: "ADC". Parameter: @p10 : AnsiStringFixedLength. Length: 1. Precision: 0. Scale: 0. Direction: InputOutput. Value: "A". Parameter: @p11 : AnsiStringFixedLength. Length: 1. Precision: 0. Scale: 0. Direction: InputOutput. Value: "Y". Parameter: @p1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 0.

Attachments
Filename File size Added on Approval
EntityDefinition.png 160,804 21-Mar-2012 16:32.02 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39909
Joined: 17-Aug-2003
# Posted on: 21-Mar-2012 18:36:21   

You're also using a custom DQE I presume? Please make sure this isn't related to your DQE, as we don't have that code (nor can we support that).

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 21-Mar-2012 18:51:30   

Frans:

Yes, it is a custom DQE but I believe that the only line that was changed is line 86.

DB2SpecificCreator.SetDbProviderFactoryParameterData("DDTek.DB2", "DDTek.DB2.DB2DbType", "DB2DbType");

I'm looking at the code for that now.

jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 21-Mar-2012 19:05:24   

I think I found the problem. Does this look wrong to you? On Line 140 of the DB2 DQE, the variable is named newOutputParameter but specified as ParameterDirection.Input.

DbParameter newOutputParameter = this.Creator.CreateParameter(field, persistenceInfo, ParameterDirection.Input, 0);

jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 21-Mar-2012 19:37:03   

One more comment on this for today.

I changed Line 140 to an output parameter. That changed @p1 to an output parameter but I was still getting the error.

I commented out Lines 140-144. After that, the insert works but I don't have the Identity value after the insert. For what I am doing today, that doesn't matter but I will need that functionality later.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Mar-2012 05:37:36   

Debug your app, and pay attention to the line 150. I think that for some reason, the field meets that conditions so the field isn't inserted in the parameter list.

David Elizondo | LLBLGen Support Team