Schema name overwrite

Posts   
 
    
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 10:00:41   

LLBLGEN 3.1 Release date:17-Jun-2011 .NET Framework 2.0 Oracle 9i/10g (MSORACLE)

I have two schema's one BCLUB1868 and another DEMOERP.

I was using BCLUB1868 during initial stage of development. Now I would like to use DEMOERP.

I was able to successfully use schema name overwrite by referencing the manual.

But Stored Proc used in BCLUB1868 is not working with DEMOERP even if schema name overwrite is used. However views are working fine in DEMOERP.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 10:15:32   

What do you mean by is not working? Is the wrong schema name been used, or SPs are not reachable?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 10:18:06   

Walaa wrote:

What do you mean by is not working? Is the wrong schema name been used, or SPs are not reachable?

Means It is refering to SP in BCLUB1868 and NOT DEMOERP. Definitely schema name is not wrong since views and entities are working correctly. Problem is only referring to SP's.

I think because LLBLGEN generates like this "\"BCLUB1868\".\"SP_ROOMRESERVATIONREPORT\"", "SPRoomreservationreport")?

In this case, will schema overwrite in config will work ?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 11:42:26   

In this case, will schema overwrite in config will work ?

It should work.

How exactly are you overwriting the schema, when calling a sp?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 11:43:37   

Walaa wrote:

In this case, will schema overwrite in config will work ?

It should work.

How exactly are you overwriting the schema, when calling a sp?

when calling SP?

I have only done this in .config file what am i supposed to do while calling SP?

<configSections> <section name="oracleSchemaNameOverwrites" type="System.Configuration.NameValueSectionHandler" /> </configSections>

<oracleSchemaNameOverwrites> <add key="BCLUB1868" value="DEMOERP" /> </oracleSchemaNameOverwrites>

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 11:51:15   

Which config file?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 11:53:21   

Walaa wrote:

Which config file?

app.config of my startup project which loads the forms

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 11:54:48   

Yeah I know, which one, I mean inside which project?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 11:55:48   

Walaa wrote:

Yeah I know, which one, I mean inside which project?

I have only one app.config ! which is in my startup project

You mean to say i need to add this in DBSpecific project also ?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 11:57:13   

No, this should be added in the config file used by your application.

Some people make the mistake to add these tags in the generated config file, not in the executable application's config file.

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 12:00:09   

Walaa wrote:

No, this should be added in the config file used by your application.

Some people make the mistake to add these tags in the generated config file, not in the executable application's config file.

It is in my executable app.config

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Jun-2011 12:07:20   

Ok so other questions are.

1- Whe you say:

I was able to successfully use schema name overwrite by referencing the manual.

So you mean you have used the same configuration file, and you could correctly fetch entities from the required schema.

2- Could you be making some XML tagging mistake as in here: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16439

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 12:13:25   

Walaa wrote:

Ok so other questions are.

1- Whe you say:

I was able to successfully use schema name overwrite by referencing the manual.

So you mean you have used the same configuration file, and you could correctly fetch entities from the required schema.

2- Could you be making some XML tagging mistake as in here: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16439

Yes I have used same config file and could correctly fetch entities from the required schema. There is no other app.config present in any projects. I do not see any XML tag errors.

I have attached config file

Attachments
Filename File size Added on Approval
app.config 2,788 29-Jun-2011 12:13.46 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 29-Jun-2011 13:22:59   

This should work for procs too. We'll look into it.

Frans Bouma | Lead developer LLBLGen Pro
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 29-Jun-2011 14:12:12   

Otis wrote:

This should work for procs too. We'll look into it.

But not working Otis. Will await your response

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 30-Jun-2011 10:58:12   

It's a bug, the name of the target table schema is stored without "" and therefore it goes OK for entity fetches, but the stored proc name has the schema wrapped in "", and there it goes wrong. It works for per-call schema overwrites (the one you can set with an object on the adapter) but not for overwrites defined in the config file (which are global) as it doesn't strip the "" from the schema name of the proc.

Workaround is:

<oracleSchemaNameOverwrites>
    <add key="BCLUB1868" value="DEMOERP" />
    <add key='"BCLUB1868"' value="DEMOERP" />
</oracleSchemaNameOverwrites>

We're working on a fix, I'll attach a fixed Oracle DQE when we're done.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 30-Jun-2011 11:03:29   

See attached DQE for the fix.

Attachments
Filename File size Added on Approval
SD.LLBLGen.Pro.DQE.OracleMS.NET20.dll 28,160 30-Jun-2011 11:03.35 Approved
Frans Bouma | Lead developer LLBLGen Pro
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 30-Jun-2011 12:05:25   

Otis wrote:

See attached DQE for the fix.

Work around works fine but attached DQE fix behave the same as it was earlier. I mean SP does not work.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 30-Jun-2011 13:53:40   

shekar wrote:

Otis wrote:

See attached DQE for the fix.

Work around works fine but attached DQE fix behave the same as it was earlier. I mean SP does not work.

Are you sure you use the new DQE dll? (please check whether you have the DQE in the GAC. If so, remove it). If you copied the dll into the llblgen pro installation folder, make sure you do that as administrator.

The DLL has as file version 3.1.11.630, so right-click on the dll in windows explorer -> properties -> version tab. This should reveal the above number, not 3.1.11.207. Check this in the bin folder of your application, so the dll that's used at runtime is the right one.

Frans Bouma | Lead developer LLBLGen Pro
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 30-Jun-2011 14:43:00   

Otis wrote:

shekar wrote:

Otis wrote:

See attached DQE for the fix.

Work around works fine but attached DQE fix behave the same as it was earlier. I mean SP does not work.

Are you sure you use the new DQE dll? (please check whether you have the DQE in the GAC. If so, remove it). If you copied the dll into the llblgen pro installation folder, make sure you do that as administrator.

The DLL has as file version 3.1.11.630, so right-click on the dll in windows explorer -> properties -> version tab. This should reveal the above number, not 3.1.11.207. Check this in the bin folder of your application, so the dll that's used at runtime is the right one.

I do not use GAC. Version name is 3.1.11.630 which was copied to LLBLGEN installation folder. Yes I am the administrator of the PC. Even the app bin folder DLL version is 3.1.11.630

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 30-Jun-2011 17:28:56   

You're right! flushed

What happened was this: - I created a test project on SCOTT - Altered the 'SCOTT' schema to be 'HR' in the procs - worked with the code, fixed it - Wondered why it didn't occur for entities - Added an entity, regenerated the code, but forgot (!) to change SCOTT into HR again - tests passed (of course).

Will re-investigate. Sorry for this inconvenience!

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 30-Jun-2011 17:52:21   

Well... I re-tested it, but it still works properly:

procs:


/// <summary>Creates the call object for the call 'Getdeptno' to stored procedure 'PR_GETDEPTNO'.</summary>
/// <param name="dataAccessProvider">The data access provider.</param>
/// <param name="pEmpno">Input parameter</param>
/// <param name="oDeptno">Output parameter</param>
/// <returns>Ready to use StoredProcedureCall object</returns>
private static StoredProcedureCall CreateGetdeptnoCall(IDataAccessCore dataAccessProvider, System.Decimal pEmpno, System.Decimal oDeptno)
{
    return new StoredProcedureCall(dataAccessProvider, "\"HR\".\"PR_GETDEPTNO\"", "Getdeptno")
                    .AddParameter("P_EMPNO", "Number", 0, ParameterDirection.Input, true, 38, 38, pEmpno)
                    .AddParameter("O_DEPTNO", "Number", 0, ParameterDirection.Output, true, 38, 38, oDeptno);
}

/// <summary>Creates the call object for the call 'PackageATestfunc' to stored procedure 'PackageA.TESTFUNC'.</summary>
/// <param name="dataAccessProvider">The data access provider.</param>
/// <param name="returnValue">ReturnValue parameter</param>
/// <param name="aparam">Input parameter</param>
/// <returns>Ready to use StoredProcedureCall object</returns>
private static StoredProcedureCall CreatePackageATestfuncCall(IDataAccessCore dataAccessProvider, System.String aparam, System.String returnValue)
{
    return new StoredProcedureCall(dataAccessProvider, "\"HR\".\"PackageA.TESTFUNC\"", "PackageATestfunc")
                    .AddParameter("RETURN_VALUE", "VarChar", 4000, ParameterDirection.ReturnValue, true, 0, 0, returnValue)
                    .AddParameter("APARAM", "VarChar", 4000, ParameterDirection.Input, true, 0, 0, aparam);
}

don't exist in HR, but in scott.


<oracleSchemaNameOverwrites>
    <add key="HR" value="SCOTT"/>
</oracleSchemaNameOverwrites>

commenting that out fails the code, having the overwriting works.

code:


string retVal = string.Empty;
ActionProcedures.PackageATestfunc("foo", ref retVal);

decimal deptno=0.0M;
ActionProcedures.Getdeptno(1.0M, ref deptno);

Succeeds..... They're properly executed on SCOTT. I verified it twice, also with the debugger...

I've attached the exact dll I'm using (which is a debug build).

Attachments
Filename File size Added on Approval
SD.LLBLGen.Pro.DQE.OracleMS.NET20.dll 28,672 30-Jun-2011 17:52.28 Approved
Frans Bouma | Lead developer LLBLGen Pro
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 01-Jul-2011 06:08:42   

Otis wrote:

Well... I re-tested it, but it still works properly:

procs:


/// <summary>Creates the call object for the call 'Getdeptno' to stored procedure 'PR_GETDEPTNO'.</summary>
/// <param name="dataAccessProvider">The data access provider.</param>
/// <param name="pEmpno">Input parameter</param>
/// <param name="oDeptno">Output parameter</param>
/// <returns>Ready to use StoredProcedureCall object</returns>
private static StoredProcedureCall CreateGetdeptnoCall(IDataAccessCore dataAccessProvider, System.Decimal pEmpno, System.Decimal oDeptno)
{
    return new StoredProcedureCall(dataAccessProvider, "\"HR\".\"PR_GETDEPTNO\"", "Getdeptno")
                    .AddParameter("P_EMPNO", "Number", 0, ParameterDirection.Input, true, 38, 38, pEmpno)
                    .AddParameter("O_DEPTNO", "Number", 0, ParameterDirection.Output, true, 38, 38, oDeptno);
}

/// <summary>Creates the call object for the call 'PackageATestfunc' to stored procedure 'PackageA.TESTFUNC'.</summary>
/// <param name="dataAccessProvider">The data access provider.</param>
/// <param name="returnValue">ReturnValue parameter</param>
/// <param name="aparam">Input parameter</param>
/// <returns>Ready to use StoredProcedureCall object</returns>
private static StoredProcedureCall CreatePackageATestfuncCall(IDataAccessCore dataAccessProvider, System.String aparam, System.String returnValue)
{
    return new StoredProcedureCall(dataAccessProvider, "\"HR\".\"PackageA.TESTFUNC\"", "PackageATestfunc")
                    .AddParameter("RETURN_VALUE", "VarChar", 4000, ParameterDirection.ReturnValue, true, 0, 0, returnValue)
                    .AddParameter("APARAM", "VarChar", 4000, ParameterDirection.Input, true, 0, 0, aparam);
}

don't exist in HR, but in scott.


<oracleSchemaNameOverwrites>
    <add key="HR" value="SCOTT"/>
</oracleSchemaNameOverwrites>

commenting that out fails the code, having the overwriting works.

code:


string retVal = string.Empty;
ActionProcedures.PackageATestfunc("foo", ref retVal);

decimal deptno=0.0M;
ActionProcedures.Getdeptno(1.0M, ref deptno);

Succeeds..... They're properly executed on SCOTT. I verified it twice, also with the debugger...

I've attached the exact dll I'm using (which is a debug build).

This dll works fine otis. Thanks for all your help