ToQueryText problem

Posts   
 
    
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 25-Aug-2005 08:10:14   

Hi

I am using the ToQueryText method, but it returns the query with the parameters' names. Can I get my query with the real values, meaning "SELECT * FROM T1 WHERE F1 = 1" and not "SELECT * FROM T1 WHERE F1 = :param"?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Aug-2005 10:00:46   

orenpeled wrote:

Hi

I am using the ToQueryText method, but it returns the query with the parameters' names. Can I get my query with the real values, meaning "SELECT * FROM T1 WHERE F1 = 1" and not "SELECT * FROM T1 WHERE F1 = :param"?

Where exactly do you use ToQueryText (it's in multiple classes, so a bit of context would be nice wink ) ?

Frans Bouma | Lead developer LLBLGen Pro
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 25-Aug-2005 14:31:47   

flushed

I'm using it in the PredicateExpression class, in order to enable myself concatenate other conditions that I cannot add with LLBLGen.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Aug-2005 20:34:00   

orenpeled wrote:

flushed

I'm using it in the PredicateExpression class, in order to enable myself concatenate other conditions that I cannot add with LLBLGen.

Ok, but how are you using it? simple_smile Could you please paste some code, so I can tell you where the parameter is created, and thus where you have to change it?

(though concatenating values into the query string isn't recommended, a parameter is better. Can't you use the parameter?)

Frans Bouma | Lead developer LLBLGen Pro
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 31-Aug-2005 15:28:49   

Sorry...

The code is below, it's a method I added to the DataAccessAdapter class:

public String GetQuery(PredicateExpression pe) { InsertPersistenceInfoObjects(pe); pe.DatabaseSpecificCreator = new OracleSpecificCreator(); Int32 uniqueMarker = 0; String queryText = pe.ToQueryText(ref uniqueMarker);

return(queryText);

}

  1. Now, as I said (or meant...), when I call this method with a PredicateExpression that I already have, I get a select statement that does not contain the actual values (in the WHERE clause) - something like "SELECT * FROM T1 WHERE F1 = :param", and this is no good for me.

  2. What I need to do next, is to concatenate more conditions to the WHERE clause, and I think that I will have to do it with string-concatenating because it involves non-LLBLGen entities, meaning tables without generated classes.

Hope I was clear enough this time... simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Sep-2005 10:07:25   

orenpeled wrote:

Sorry...

The code is below, it's a method I added to the DataAccessAdapter class:

public String GetQuery(PredicateExpression pe) { InsertPersistenceInfoObjects(pe); pe.DatabaseSpecificCreator = new OracleSpecificCreator(); Int32 uniqueMarker = 0; String queryText = pe.ToQueryText(ref uniqueMarker);

return(queryText);

}

  1. Now, as I said (or meant...), when I call this method with a PredicateExpression that I already have, I get a select statement that does not contain the actual values (in the WHERE clause) - something like "SELECT * FROM T1 WHERE F1 = :param", and this is no good for me.

True, it will use parameters, not fieldnames.

  1. What I need to do next, is to concatenate more conditions to the WHERE clause, and I think that I will have to do it with string-concatenating because it involves non-LLBLGen entities, meaning tables without generated classes. Hope I was clear enough this time... simple_smile

You could derive your own class from Predicate, like the FieldCompareValuePredicate class is also derived from that class (please check the sourcecode of the ORMSupportClasses library). That class can have a normal ToQueryText override which concatenates the values into the query, not using parameters.

Frans Bouma | Lead developer LLBLGen Pro