| Summary: | Default SQLDataSource binding name is not a valid name | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Joseph Vincens <jvincens> |
| Component: | EDT | Assignee: | Zhi Zhu <zhuzhi> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | chenzhh, jspadea |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Joseph Vincens
Justin made a point in 358659, if the user wants to use @Resource{bindingKey="mm nn%@/"}, then mm nn%@/ as a name it is legal. So the default name we generate should be a valid identifier, but the user should be able to override it with any text they choose.
the binding name is got from name of defined database connection, why not invalid, can you give an example for this? The name of the connection usually contains spaces, for example the default for Derby is "New Derby". Since the default binding key used by your code is based on the variable name, we should default the SQL binding name to a value that can be used as a variable name.
Given a database connection: "New Derby". Set the binding name to "NewDerby". User can then code as follows to make use of the default binding key:
NewDerby sqldatasource{@Resource};
The user can still change the binding name to whatever they want in the DD editor, after the binding has been created. No validation should be added to the binding name. The following is perfectly legal: "1abc- 1234$%"
ds sqldatasource(@Resource{bindingKey = "1abc- 1234$%"}};
So to summarize, the only thing that should be changed is when determining the default binding name (either through the New Binding wizard or the New Record wizard that creates a record from a database connection) we should strip out any characters that aren't valid in a variable name.
thanks for Justin's comment, fix it verified I just created a binding for DB2 and the name created was: NewDB2ForLinux,UNIX,AndWindows This is not a valid identifier. Fixed BindingSQLDatabaseConfiguration to use the same check for each character as what validation allows. My DB2 binding name now becomes "NewDB2forLinuxUNIXandWindows". verified |