Skip site navigation (1) Skip section navigation (2)

Re: Question on NpgsqlParameter object

From: "Francisco Figueiredo Jr(dot)" <fxjrlists(at)yahoo(dot)com(dot)br>
To: Oliveiros Cristina <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: Oliveiros Cristina <oliveiros(dot)cristina(at)gmail(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Question on NpgsqlParameter object
Date: 2007-05-30 15:23:42
Message-ID: (view raw or whole thread)
Lists: pgsql-interfaces
Hash: SHA1

Oliveiros Cristina wrote:
> Howdy, Francisco.

Hi Oliveiros!

> Thank you for your fast reply.
> I'm gonna check this out.
> Actually I wasn't aware of the existence of the Npgsql mailing list,
> even though I use it exclusively to access the back end !

No problem!

> But, maybe if I am a little more specific you can tell me what I am
> (potentially) doing wrong.
> Can I use parameters to substitute a whole condition?
> For ex, is it possible to have a query like this?
> FROM t_tabela
> WHERE @condicao

Nope, you can't. Any string substitution done by Npgsql is done with quotes.

> ?
> My problems started yesterday when I started using parameters in this way.
> Before I've just used it in situations like this :
> FROM t_tabela
> WHERE variacao >= @percentagem
> and it always worked without the smallest problem.
> I wonder if it is legal to use NpgsqlParameters in the way I do now...

Yes, the correct way of using parameters is like you had before.

I think you want to get some flexible non hardcoded sql's. But I think
you would need to do that in a higher layer. Did you have a look at
NHibernate? I think you could get some more flexible queries with it.

Else, you would need to provide that in some DAO classes.
Unfortunately, Npgsql can't be used to send arbitrary conditions like
you want. :(

I hope it helps.


Francisco Figueiredo Jr.
Npgsql Lead Developer
Mono Project Contributor
MonoBrasil Project Founder Member

- --
 - Would you tell me, please, which way I ought to go from here?
 - That depends a good deal on where you want to get to.
 		-- Lewis Carroll "Alice's Adventures in Wonderland"
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


Yahoo! Mail - Sempre a melhor opção para você! 
Experimente já e veja as novidades.

In response to

pgsql-interfaces by date

Next:From: Miha D. PucDate: 2007-06-03 10:36:23
Subject: Bytea network traffic: binary vs text result format
Previous:From: Oliveiros CristinaDate: 2007-05-29 10:26:34
Subject: Re: Question on NpgsqlParameter object

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group