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 155606 - [PHP] Provide code completion also for UPDATE, INSERT and DELETE
Summary: [PHP] Provide code completion also for UPDATE, INSERT and DELETE
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 3 votes (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-16 23:02 UTC by Petr Pisl
Modified: 2009-10-20 19:04 UTC (History)
2 users (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 Petr Pisl 2008-12-16 23:02:43 UTC
This is based on a user feedback: http://blogs.sun.com/netbeansphp/entry/sql_code_completion_in_the#comment-1229425365000
Comment 1 Tomas Mysik 2008-12-17 13:17:41 UTC
IMHO it's a bug because code completion already works in SQL strings - I don't see any valid reason why we should make 
difference between SELECT and e.g. UPDATE statements. Am I missing something?

Please consider also code completion for SQL keywords themselves (SELECT, FROM, WHERE, ORDER, etc.).

Thanks a lot.
Comment 2 gawan 2009-01-28 12:55:30 UTC
Many database libraries allow to compose sql strings step by step. e.g.:

$sql = db::query('SELECT * FROM table');
if ($type) $sql->sql('WHERE type = %i' , $type);

It would be nice if every string which is started with: [SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT] will be
recognize as SQL string.

Comment 3 gawan 2009-02-05 15:46:48 UTC
Or I think up better solution

class SomeORM {

   /**
    * @param sqlstring $sql  # this mean that type of $sql param is SQL string and editor can use code competition for
this string
   function query($sql) {
     ...
   }
}

what do you think about this solution?
Comment 4 Jiri Rechtacek 2009-10-16 14:13:44 UTC
Reassigned to new owner.
Comment 5 Jiri Rechtacek 2009-10-20 15:52:53 UTC
I guess it were fixed in NB6.8M2
Comment 6 Tomas Mysik 2009-10-20 16:23:59 UTC
I found one minor issue, otherwise it's excellent! Thanks!

To reproduce the issue, open SQL file and put this code in it (I use NB sample DB):
INSERT INTO ANIMAL(WEIGHT) VA|                <-- no CC here, "VALUES" should be offered

If I don't use "(WEIGHT)" part, keyword "VALUES" is completed correctly.

The same applies for PHP SQL code completion.

Thanks a lot.

Product Version: NetBeans IDE Dev (Build 091016)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
System: Linux version 2.6.28-15-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 7 Jiri Rechtacek 2009-10-20 19:04:08 UTC
File separate issue 175042.