SQL code completion in the PHP editor
By Petr on Dec 16, 2008
The feature, which I want to introduce today, offers code completion for SQL select statements in the PHP editor. The SQL code completion is offered when the edited string starts with select SQL keyword.
On the first picture you can see that the SQL code completion offers only one item Select Database Connection ... . It's because is not clear which db connection should be used.
When you select the item, a simple dialog for selecting a database connection is opened. The dialog offers connections, which are already registered in the Services tab or you can create new connection.
After selecting the connection the SQL code completion offers all tables from selected db connection.
The code completion offers columns if there known tables that are used in the select statement. As you can see from the last picture, the code completion is able also to work with table aliases.
The selected database connection is persisted per project. So every project can use different connection. Unfortunately there is missing an UI for changing the connection. But if you want to play with this, you can easily delete the line with auxiliary.org-netbeans-modules-php-editor.dbconn property in nbproject/private/private.properties file. I hope that this will be implemented and will be available in Milestone 2.
The feature wasn't tested properly yet. If you will play with this and run into a bug, please enter it in our Issuezilla.