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 114416

Summary: Don't quote identifiers in editable SQL unless necessary
Product: db Reporter: David Vancouvering <davidvc>
Component: CodeAssignee: David Vancouvering <davidvc>
Status: RESOLVED FIXED    
Severity: blocker CC: jimdavidson, kfrank
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 115075, 115745, 115770    
Bug Blocks:    

Description David Vancouvering 2007-08-31 19:42:31 UTC
Issue 87920 removed quoting when creating database objects like tables, views, columns, indeces, etc.  

Internally, we always quote identifiers of *existing* database objects.  

However, when we generate SQL that is editable by users, it is preferable not to quote if we don't have to.

The algorithm proposed in the comments on 87920 was as follows:

- Call DatabaseMetaData.getExtraNameCharacters()

(see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getExtraNameCharacters())

'Retrieves all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _).'

- If this is supported, then add these characters to a-z, A-Z, 0-9 and _
- Then, if any of the characters in the identifier are not in the full set of supported nonquoted characters, quote the
identifier

If users ask for a user-configurable option to quote all identifiers (e.g. if the above algorithm doesn't work), this
can be added as a separate feature.
Comment 1 David Vancouvering 2007-09-17 20:29:35 UTC
I am making this issue an umbrella for all the places in the db module where we quote editable SQL.  I will create tasks
for the "View Data" and visual query editor.  

Are there other places in the db module where we generate SQL that is editable?  
Comment 2 _ jimdavidson 2007-09-21 18:00:12 UTC
Last issue under this umbrella is resolved, so David can mark as fixed unless there are outstanding items.
Comment 3 David Vancouvering 2007-10-10 17:37:07 UTC
Looks like we've got this covered.  Re-open if anyone finds any place where we're still quoting...