This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 120229 - Prompt for values of unbound parameters in SQL query
Summary: Prompt for values of unbound parameters in SQL query
Status: NEW
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 5 votes (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks: 152817
  Show dependency tree
 
Reported: 2007-10-26 19:51 UTC by rptmaestro
Modified: 2014-03-14 00:23 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rptmaestro 2007-10-26 19:51:03 UTC
In the SQL editor, when executing a query with unbound parameters, for example

    SELECT * FROM Product WHERE product_id = ? and category = ?

or

    SELECT name FROM Product WHERE product_id = :prodId AND category = :category
    UNION
    SELECT name FROM Service WHERE product_id = :prodId AND category = :category

it would be very useful for the IDE to prompt for the parameter values. For example:

    Please supply values for the following parameters to your SQL query:
        Parameter 1: _______________
        Parameter 2: _______________

or

    Please supply values for the following parameters to your SQL query:
        Parameter "prod_id":  _______________
        Parameter "category": _______________
Comment 1 David Vancouvering 2007-11-05 00:51:12 UTC
Yes, this is a great idea, one we've been talking about.  Thanks for underscoring the value of doing something like
this.  If I understand right, this allows you to cut and paste SQL from your language editor (like Java) into the SQL
editor to test it.  Wade Chandler had similar ideas, and was proposing a tool to make this particularly easy.  Let's see
where we go with this...
Comment 2 Jiri Rechtacek 2009-10-16 14:06:49 UTC
Reassigned to new owner.
Comment 3 brettryan 2014-03-14 00:23:53 UTC
I would love to see this also. I don't include my SQL inside Java classes and instead have `.sql' resources that are read at runtime. This is very powerful for being able to test queries before packaging.

This would also be helpful for other languages which use SQL files for queries.

One slight enhancement for the proposal would be to remember the last used parameters so it does not always ask if the same unnamed parameters are used or same named parameters. It could be tricky though if the query is changed to alter the order of the parameters.