Question about Scheme Name.

Posts   
 
    
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 23-Sep-2009 05:43:00   

I'm using v2.6 & oracle db provider.

When I have generated code(adapter mode),in PersistenceInfoProvider.cs I found code as below:

base.AddElementMapping( "TQueryHistoryEntity", "liujian", @"ZYYY", "T_QUERY_HISTORY", 13 );

the @"ZYYY" is the scheme name which mapped to an user name of my db. When I execute a query,the generate sql statements like:

select ZYYY.T_QUERY_HISTORY.* from ZYYY.T_QUERY_HISTORY

but when I publish my program to my customer,and my customer use another db user name such as "AAA",even though they have same table structure, there will be an error for the sql statement: select ZYYY.T_QUERY_HISTORY.* from ZYYY.T_QUERY_HISTORY. As there isn't an user or scheme named "ZYYY" in my customer's DB,I must re-generate the code and change the scheme name to "AAA",and re-deploy my program.

If I have hunderds of customer,and all of them create different db user name(same db structure), have I to re-generate the code hunderds times and re-deploy my program hunderds times?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Sep-2009 06:52:34   

Please take a look at Schema name overwriting.

David Elizondo | LLBLGen Support Team
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 24-Sep-2009 04:03:50   

First of all,thank you for replay.

I havn't try this way,but I have another question:I think it's will work well for entity/view mapping,but if it's a procedure(retriving or action),such as:

        public static DataSet GetInvoiceInfo(System.String packcode, DataAccessAdapter adapter)
        {
            OracleRefCursor outCur = null;
            OracleParameter[] parameters = new OracleParameter[2];
            parameters[0] = ParameterCreator.Create("PACKCODE", OracleDbType.Varchar2, ParameterDirection.Input, 4000, 0, 0, packcode);
            parameters[1] = ParameterCreator.Create("OUT_CUR", OracleDbType.RefCursor, ParameterDirection.Output, 0, 0, 0, outCur);
            DataSet toReturn = new DataSet("GetInvoiceInfo");
            bool hasSucceeded = adapter.CallRetrievalStoredProcedure("ZYYY.SP_GET_INVOICE_INFO", parameters, toReturn);

            for(int i=0;i<2;i++)
            {
                if(parameters[i] != null)
                {
                    parameters[i].Dispose();
                }
            }
            return toReturn;
        }

Can the scheme name of the procedure(ZYYY.SP_GET_INVOICE_INFO) be override,too?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 24-Sep-2009 11:17:33   

Yes. "Schema NameOverwriting" takes care of this too.

xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 25-Sep-2009 10:42:14   

I think my question is solved.Thank you very much.

But another question,maybe it's not appropriate to be asked here.

I have an user interface to make my customer to configure a connect string.I want to alter CatelogNameOverwrites' or SchemeNameOverwrites' value when the user give a correct connection string.

How can I get new CatelogName/SchemeName by just a "connection string"? Find then in the connection string by split it or regular expression,etc? Or I can use a sql statement to get them?

Maybe it's a db question or program language question.

Thanks again.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 25-Sep-2009 10:48:24   

Use both Catalog Name Overwriting and Schema Name overwriting sectionin the config file, and set the new value for both of tem to an empty string "".

Then set the connection string programmatically according to the user input. And then everything in the supplied connection string will be used as is.

xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 27-Sep-2009 04:36:24   

Thanks,Resolved!