Do bind parameters work for you if you replace the view with a subselect?

Does this work for you?

select * from (
   select t1.*,
   (select count(*) from song_artist t2 where t1.artist_id=t2.artist_id) as CNT
   from artists
) where CNT=:PARAM

-- Darren Duncan

Cariotoglou Mike wrote:
> I don't know if this has come up before, is so please point me to the
> right direction :)
> 
> I believe that using parameterized queries with views does not work
> as expected.
> 
> consider this (more or less self-explanatory) schema:
> 
> create table artists(artist_id)
> create table songs(song_id)
> create table song_artist(song_id,artist_id)
> 
> create view VARTISTS as
>  select t1.*,
>  (select count(*) from song_artist t2 where t1.artist_id=t2.artist_id)
> as CNT
>  from artists
>  
>  The sql may be a little off as I am typing this from scratch, but you
> get the
>  idea.
>  
>  now, if I do this:
>  
>  select * from VARTISTS where CNT=10
>  
>  it works.
>  
>  This, however, always returns an empty result set :
>  
>  select * from VARTISTS where CNT=:PARAM,
>  
>  for any value I bind to :PARAM.
>  
>  is this known/documented ?

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to