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 [89]

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 #

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 #

.

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 乐清网站建设 on June 20, 2009 at 04:56 PM CEST #

thanks nice...

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

thanks.

Posted by 乐清网站建设 on July 03, 2009 at 05:43 AM CEST #

It's nice, thanks for sharing

Posted by 乐清网站建设 on July 03, 2009 at 05:43 AM CEST #

Hi, this function is really great, but i have one idea<a href="http://www.allistanbultransfer.com" title="istanbul airport transfer,istanbul transfer,ataturk airport transfer" target="_blank">istanbul transfer</a>

<a href="http://www.e-istanbultours.com" title="istanbul tours,istanbul tour,istanbul trips,istanbul sightseeing,istanbul holidays" target="_blank" >istanbul tours</a>

<a href="http://www.istanbul-airport-transfer.com" title="istanbul airport transfer,ataturk airport transfer,istanbul transfer to hotels" target="_blank">ataturk airport transfer</a>
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?

Posted by ataturk airport transfer on July 17, 2009 at 11:27 AM CEST #

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
<a href="http://www.istanbul-airport-shuttle.com" title="istanbul airport shuttle,istanbul shuttle service,istanbul shuttlebus" target="_blank" >ataturk airport shuttle</a>

<a href="http://www.istanbul-hotels-transfer.com" title="istanbul transfer to hotels,istanbul airport transfer to hotels,istanbul hotels transfer">ataturk hotels transfer</a>

<a href="http://www.istanbul-hotels-shuttle.com" title="istanbul shuttle to hotels,istanbul airport shuttle to hotels,istanbul hotels shuttle,istanbul shuttlebus to trips">istanbul hotels shuttle</a>

<a href="http://www.privatetransferservice.com" title="istanbul turkish service,istanbul service,private tours in istanbul,istanbul service,istanbul private tour,istanbul private service to taksim">istanbul private transfer service</a>
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.

Posted by ataturk airport shuttle on July 17, 2009 at 11:28 AM CEST #

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.
<a href="http://www.newistanbulshuttle.com" title="istanbul shuttle,istanbul shuttle bu,istanbul shuttle service" target="_blank">shuttle istanbul</a>

<a href="http://www.istanbul-turkey-hotels.com" title="istanbul hotels,turkey hotels,istanbul turkey hotels" target="_blank">istanbul turkey hotels</a>

<a href="http://www.istanbultransfer.org" title="istanbul airport transfer,istanbul transfer,ataturk airport transfer" target="_blank">istanbul transfer</a>

<a href="http://www.allistanbulshuttle.com" title="istanbul airport shuttle,istanbul shuttle" target="_blank">istanbul shuttle bus</a>

All the best and thank you!

Posted by istanbul shuttle bus on July 17, 2009 at 11:28 AM CEST #

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.
<a href="http://www.newistanbulshuttle.com" title="istanbul airport shuttle,istanbul shuttle" target="_blank">istanbul airport shuttle</a>

<a href="http://www.newistanbultransfer.com" title="istanbul airport transfer,istanbul transfer,ataturk airport transfer" target="_blank">ataturk airport transfer</a>

<a href="http://www.istanbultravelagent.com" title="istanbul travel agent,istanbul travel agency,sultanahmet hotels">sultanahmet hotels</a>

<a href="http://www.azureturizm.com" title="istanbul airport transfer,istanbul transfer,istanbul tours,istanbul hotels,istanbul travel agency">istanbul transfer</a>

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.

Posted by istanbul airport shuttle on July 17, 2009 at 11:29 AM CEST #

Thanks..

Posted by mirc sohbet on July 27, 2009 at 04:55 AM CEST #

Very good

Posted by aşk şiirleri on July 27, 2009 at 04:56 AM CEST #

Hmm good works.

Posted by mirc sohbet on July 27, 2009 at 04:56 AM CEST #

Very good.

Posted by mirc on July 27, 2009 at 04:57 AM CEST #

aöf sınav soruları

Posted by aöf on July 27, 2009 at 08:01 AM CEST #

candost is now known as armoking_yesil

Posted by chat on August 06, 2009 at 09:34 PM CEST #

thanks admin...

Posted by mirc on August 18, 2009 at 06:31 PM CEST #

thanks admin..

Posted by türkçe mirc on August 18, 2009 at 06:31 PM CEST #

thanks admin...

Posted by mirc indir on August 18, 2009 at 06:32 PM CEST #

thanks, very infomativ

best regards

Posted by celik kapi on August 22, 2009 at 01:08 AM CEST #

realy very informativ and good. tanks very much

Posted by facebook on August 22, 2009 at 04:44 PM CEST #

Thank you By Admin

Posted by mirc on August 23, 2009 at 04:18 AM CEST #

Thanks for the perfect site :)

Posted by ceyiz on August 25, 2009 at 01:02 AM CEST #

That's awesome, but I have a project that use more thatn one database, it's not commom, but that should not be diffcult to allow, more than one database for project?

The case is that I've a commom db, that several projects use, and a commom db that store commom data, like zip location, user tables, etc.

So my commom query will be like:

SELECT myProject.client.id,commom.legal_entity.company_name FROM myProject.client INNER join commom.legal_entity ON legal_entity.id=client.id_entity WHERE client.id=N;

got it?

So if I can use commom and myProject databases, it would be great. Thanks so far.

Posted by Carlos Blaster on August 25, 2009 at 07:40 PM CEST #

very nice post thank you

Posted by chat on August 27, 2009 at 01:16 AM CEST #

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 how to grow taller on August 27, 2009 at 11:02 PM CEST #

Please let me know how to get this feature as well..

Posted by David on August 28, 2009 at 12:49 PM CEST #

Thanks you let me know netlog !

Posted by netlog on August 28, 2009 at 09:00 PM CEST #

thanks admin site sahibi :P

Posted by mırc on August 29, 2009 at 09:12 PM CEST #

howe are you :)

Posted by mirc yükle on August 29, 2009 at 09:13 PM CEST #

hayat bahane

Posted by chat on August 29, 2009 at 11:26 PM CEST #

than you

Posted by chat on September 02, 2009 at 02:35 PM CEST #

thanks

Posted by mirc on September 02, 2009 at 02:36 PM CEST #

thnks

Posted by kelebek on September 02, 2009 at 02:37 PM CEST #

thanks admin, nice sharing

Posted by seslichat on September 17, 2009 at 12:22 AM CEST #

I thank for the knowledge

Posted by kangal on September 22, 2009 at 06:37 PM CEST #

Thanks..

Posted by mirc indir on September 25, 2009 at 01:48 PM CEST #

Thank you by Admin

Posted by mirc on September 29, 2009 at 08:53 PM CEST #

thank you nice page

Posted by mirc indir on October 01, 2009 at 08:51 AM CEST #

thank you very muc
nice web hosting

Posted by Hosting on October 01, 2009 at 10:56 AM CEST #

Genius!
Thanks so much for sharing this.
this will save me lots of headaches

Posted by sports flooring on October 06, 2009 at 02:52 AM CEST #

Brilliant!
Had a few minor hick ups but it is working perfectly!

Posted by kitchen renovation Melbourne on October 06, 2009 at 03:01 AM CEST #

Very nice. Thanks..

Posted by mirc indir on October 11, 2009 at 12:32 AM CEST #

thanks for your great work.

Posted by zbv on October 15, 2009 at 11:36 PM CEST #

I couldn't find SQL code completion in the PHP editor.
Please let me know how to get this feature.

Posted by best registry cleaner on October 20, 2009 at 09:33 PM CEST #

You have to invoke the code completion (CTRL + SPACE) in a string after select. Just like is on the picture. NB 6.8 should also be able to offer the sql cc if the string starts with update.

Posted by Petr Pisl on October 21, 2009 at 12:48 PM CEST #

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 resveratrol supplements on October 26, 2009 at 01:53 PM CET #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 30, 2009 at 03:05 AM CET #

thanks for sharing.

Posted by 电磁铁 on October 30, 2009 at 12:45 PM CET #

I'm really very useful to follow a long-time see this as a blog here Thank you for your valuable information.

Posted by peynir on November 01, 2009 at 12:12 AM CET #

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 fx15 on November 02, 2009 at 11:51 AM CET #

Thanks very good idea of respect for love..

Posted by Dans on November 03, 2009 at 01:18 AM CET #

Nice Sharing Thanks

Posted by cinsel chat on November 03, 2009 at 05:08 PM CET #

Thank you very much for this useful article and the comments

Posted by arkadas on November 21, 2009 at 09:02 PM CET #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed