Subject RE: [firebird-support] Re: IN clause limitation
Author Sasha Matijasic
> Hi all,
>
> Thank you for all your answers.
>

Hi, although other people have already gave you a solution I'll try to offer my 2 cents.

>
> So, if each time a user select customers to include in a report, I
> have to create a temporary table and add thousands of customer codes

No! You don't create new table for each report.
Check out the documentation on global temp tables for fb 2.1. If you can't use 2.1, it's pretty simple to implement it yourself.
Let's say that your report is something like this:

select id, name from customers

If you want to allow your users to select only certain customers you create new table, let's call it selected_customers, like this (in pseudo code):

create table selected_customers(sc_id integer, customer_id varchar(10));

sc_id is unique id for the report user wants to generate, you can use generators for that.

When your user selects customer to include them in the report, you do the following:

report_id = next value for selected_seq;
foreach(selected_id)
insert into selected_customers(sc_id, customer_id) values(:report_id, :customer_id);

Your report now looks like this:

select id, name from customers
join selected_customer sc on sc.customer_id = customers.id
where sc.sc_id = :report_id;

For cleanup, you can
delete from selected_customers where sc_id = :report_id
if you want to.

That is a description of setup and use of such system, you can easily expand it to be used throughout the application for all kinds of tables, and not only customers (if you use single integer column as primary keys, it's trivial, otherwise it's a little more work, but it's worth it)

> Is it so terrible asking for such improvement?
> Is it so dangerous?
>

I can't tell you if it's dangerous or not, but what you are asking is simply *not a desired feature*. Of course, I can't speak for others, and certainly can not speak for firebird dev team, but I'm pretty sure that's the common opinion on that question. And I would be more happy if efforts are continued in the same direction they are going now with all the really cool features in 2.5 and 3.0 branches.


Sasha