Re: Search function - Mailing list pgsql-novice

From Derrick Betts
Subject Re: Search function
Date
Msg-id 00a001c577ab$2772b8f0$0202a8c0@main
Whole thread Raw
In response to Search function  (Keith Worthington <KeithW@NarrowPathInc.com>)
Responses Re: Search function
List pgsql-novice
I have built search functions for web pages that build the SQL string
dynamically and return the result from a function through a result set.  For
example, your form may have three input fields with several "options" the
user can search with:  Date_To: (an input field) Date From: (an input field)
Destination: (a drop down list with airport codes).

Your SQL would look like:  "SELECT * FROM table WHERE date1 >=
Date_To_variable_from_the_form AND date2 <= Date_From_variable_from_the_form
AND destination = Destination_from_the_form.

You would then execute the statement and return the results to your
application.

Is this what you were looking for?

Derrick
----- Original Message -----
From: "Keith Worthington" <KeithW@narrowpathinc.com>
To: <pgsql-novice@postgresql.org>
Sent: Wednesday, June 22, 2005 8:55 PM
Subject: [NOVICE] Search function


> Hi All,
>
> I am working on an application that has a search dialog.  The dialog is
> automatically populated with all of the available fields.  It gets the
> field names from the views that were used on the form that the search
> dialog was launched from.
>
> The issue that is slowly getting unmanageable is handling the different
> data types.  If it is a date do this, if it is a string do that and if it
> is a boolean do something else.
>
> I would like to remove this complexity from the application.
>
> I am hoping that there is a way given the view/column names that I can
> either
> 1) dynamically build the WHERE clause
> 2) dynamically build the whole query
> 3) dynamically build the whole query, run it and return the results
>
> Has anyone tried something like this before?
>
> --
> Kind Regards,
> Keith
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
>


pgsql-novice by date:

Previous
From: Keith Worthington
Date:
Subject: Search function
Next
From: Prashant
Date:
Subject: UNSUBSCRIB pgsql-novice