SQL code completion in the PHP editor

Posted by Petr Pisl on Dec 16 2008, 09:09:05 AM CET

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.


Category: Features | Permalink | Comments [45]

Trackback URL: http://blogs.sun.com/netbeansphp/entry/sql_code_completion_in_the
Comments:

My god, this is genius, I would have never thought about something like this.

Thanks again Petr!

Posted by soso on December 16, 2008 at 09:54 AM CET #

nice

Posted by Tom on December 16, 2008 at 10:20 AM CET #

Simply brilliant !

Posted by Ben on December 16, 2008 at 10:23 AM CET #

WOW ! That is great.
Maybe connection should be selected in project properties or/and saved there ?

Posted by Shadzik on December 16, 2008 at 10:26 AM CET #

whoaa
at last :D
Thanks...keep the good work

Posted by john on December 16, 2008 at 11:03 AM CET #

And competition for UPDATE, DELETE, INSERT INTO, ... will be also?

Posted by gawan on December 16, 2008 at 12:02 PM CET #

to Shadzik: I have enter new defect against the db support - http://www.netbeans.org/issues/show_bug.cgi?id=155605

to Gawan: The feature is not implemented by our (php team). It's a contribution from database team. I have entered new enhancement - http://www.netbeans.org/issues/show_bug.cgi?id=155606

Regards,
Petr

Posted by Petr on December 17, 2008 at 12:03 AM CET #

This are great but I have a simple question: How can I test all this new features?

Posted by Reynier Perez Mira on December 17, 2008 at 12:57 AM CET #

Great.!
Hey, Petr, You give me surprise again.!
And I know every some time, You always give it..
Thanks a lot.!

Posted by 124.74.203.205 on December 17, 2008 at 03:12 AM CET #

Bravo!
This is a much anticipated piece of work.
How will you license it?

Regards

Posted by Shlomi Noach on December 17, 2008 at 07:23 AM CET #

To Reynier:
>How can I test all this new features?
Download a development or nightly build and play with the build. You can use also the --userdir switch. More is explain here: http://blogs.sun.com/netbeansphp/entry/userdir . There is also link where you can download the nightly builds.

To Shlomi:
>How will you license it?
It's open source and it has the same license as NetBeans. http://www.netbeans.org/cddl-gplv2.html.

Regards,
Petr

Posted by Petr on December 18, 2008 at 12:09 AM CET #

I am late on this...Wow, another awesome feature added in trunk...

Kudos to Developers :D

Posted by N, Varun on December 18, 2008 at 05:30 PM CET #

This is too good to be true ... :-)

On an unrelated matter, any chance of restoring jMaki - the jMaki Ajax plugin installation attempt fails with:
Warning - could not install some modules: jMaki Ajax support - The module named org.netbeans.modules.editor.deprecated.pre61completion/0 was needed and not found.

All the best and thank you!

Posted by Navid on December 26, 2008 at 08:08 PM CET #

Hi, this function is really great, but i have one idea to improve. I dont know if it's possible but what when you add mysql functions to column select or where select? I think for example functions as NOW(), UNIX_TIMESTAMP(), CONCAT()... Great would be when in list will own created functions too. It's function which was created with CREATE FUNCTION...
It's possible? Or do you have it in plan?

PS: I'm so sorry for my english... :) But i hope that you understand me...

Posted by SendiMyrkr on January 24, 2009 at 10:27 PM CET #

To SendiMyrkr,

it shouldn't be hard to add it. It's not in the current plan and implementing this "just" depends on the resources:).

Regards,
Petr

Posted by Petr on January 25, 2009 at 09:36 PM CET #

Hi,
Excellent work. How long before this is available through IDE updates?

Cheers
Andy

Posted by Andy on January 26, 2009 at 05:38 PM CET #

Last week's news,

Posted by travesti on March 07, 2009 at 11:05 PM CET #

Last week's news,

Posted by travesti on March 07, 2009 at 11:08 PM CET #

A new screencast is now available on NetBeans TV

Posted by seo on March 07, 2009 at 11:31 PM CET #

thanks very nice

Posted by mirc on March 07, 2009 at 11:42 PM CET #

This is too good to be true ... :-)

Posted by muhabbet on March 07, 2009 at 11:43 PM CET #

Hi I'm new of netbeans and I found it great product.
But in the 6.5.1 I did not find this improvement.
What's wrong?
Thank's

Posted by Roberto on March 17, 2009 at 11:46 PM CET #

what improvement?

Posted by bea on March 31, 2009 at 07:27 AM CEST #

Wow, another awesome feature added in trunk...

Posted by chat on April 02, 2009 at 10:38 PM CEST #

Awesome, and exists some tool for Java Editor, where i se the code for this plugin??

Posted by Arturo on April 09, 2009 at 01:47 AM CEST #

NetBeans is a Awesome tool. I am using this for PHP development.
Currently I have installed NetBeans 6.5.1 version and I couldn't find SQL code completion in the PHP editor.
Please let me know how to get this feature.

Posted by Nagendra B.R on April 21, 2009 at 09:53 PM CEST #

> This is too good to be true ... :-)

:)))

is it works in M3?

Posted by alexey_baranov on April 24, 2009 at 11:05 PM CEST #

Thank You

Posted by Emo Resimleri on May 01, 2009 at 06:03 PM CEST #

Thank You

Posted by Travesti on May 01, 2009 at 06:05 PM CEST #

.

Posted by 75.119.244.2 on May 03, 2009 at 05:59 AM CEST #

muy bueno lo de sql!!!, lo probare... Netbeans cada vez esta llegando a la perfeccion ...

Posted by LP on May 13, 2009 at 08:36 PM CEST #

i m new with netbeans, the feathers are realy unbeliveable, and specially the above sql code completion.
Amazeing yarr!!!

Posted by Jawwad Ahmed on June 02, 2009 at 08:42 AM CEST #

thanks

Posted by mırc on June 16, 2009 at 10:16 AM CEST #

thanks you

Posted by mirc on June 16, 2009 at 12:40 PM CEST #

thanks you admin

Posted by mirc indir on June 16, 2009 at 12:41 PM CEST #

very nice post thank you

Posted by Mirc on June 16, 2009 at 02:00 PM CEST #

It's nice, I am learning, thank you

Posted by HD LCD monitor on June 17, 2009 at 04:36 AM CEST #

thanks.

Posted by TV studio film lighting on June 17, 2009 at 04:37 AM CEST #

Thanks a lot. keep it up.

Posted by HD video camera battery on June 18, 2009 at 09:24 AM CEST #

Currently I have installed NetBeans 6.5.1 version and I couldn't find SQL code completion in the PHP editor.
Please let me know how to get this feature.

Posted by rosa on June 18, 2009 at 01:10 PM CEST #

cool, <a href="http://internet-online.org/tv/">online tv</a> and <a href="http://internet-online.org/tv/">watch tv online</a> at <a href="http://internet-online.org/tv/">free online tv</a> site.

Posted by online tv on June 19, 2009 at 07:08 AM CEST #

Thanks.

Posted by porno izle on June 29, 2009 at 12:18 AM CEST #

thank you...

Posted by kabin on July 01, 2009 at 10:06 AM CEST #

thanks nice...

Posted by kabin on July 01, 2009 at 10:07 AM CEST #

thanks nice...

Posted by Aşk Büyüsü on July 01, 2009 at 11:00 AM CEST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed