Atlassian JIRA   History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: XRP-105
Type: Task Task
Status: Resolved Resolved
Resolution: Applied
Priority: Minor Minor
Reporter: Jurgen De Moortel
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
xReporter

Problem with creating an index on a temptable

Created: 17/Feb/06 02:40 AM   Updated: 21/Feb/06 09:07 AM
Component/s: xReporter
Affects Version/s: SVN-HEAD
Fix Version/s: 1.3

File Attachments: 1. XML File temptabel_index.xml (2 kb)



 Description   
We want to create an index on a temptable .
This name of the index has to be the name of the temptable with a suffix.
(Something like tmp_[report_id]_temptablename_indexname).
When we use the temptable tag <temptable idref="temptablename"> and put the indexname behind this tag, we get the whitespace problem.

In the following svn-commit
http://svn.cocoondev.org/viewsvn/trunk/xreporter/src/java/org/outerj/xreporter/report/definition/TempTableRefSqlPart.java?rev=605&root=xreporter&view=log
the @field is added to <temptable> to survive the whitespace problem.

But this is translated in sql as tmp_[report_id]_temptablename.fieldname.
The problem is that a '.' is not a valid character in an index.

 All   Comments   Change History      Sort Order:
Comment by Jurgen De Moortel [17/Feb/06 02:41 AM]
This is an example

Comment by Marc Portier [20/Feb/06 10:29 AM]
Jurgen,
Good catch!

This is surely a use-case we overlooked there.

To get around things I would propose to add a @sub-name attribute to provide an arbitrary suffix.
Then the implementation class could just (without connecting dots) add that to the table-name.

@field could be kept for backwards compat (and more semantic editing) and stored in the same member (by prefixing with dot at config time)

@field and @sub-name should be exclusive though (using both should throw a config-exception)

Comment by Marc Portier [21/Feb/06 08:33 AM]
Changes to svn-head that implement this new behaviour are in revision 659
(see http://svn.cocoondev.org/viewsvn?rev=659&root=xreporter&view=rev)

Comment by Marc Portier [21/Feb/06 09:07 AM]
I did some additional tests and noticed how this new feature can get you into trouble:

Steps are managing the temptables and are dropping them out if the step is restarted. This will also drop associated indices.

This is good news: you can just re-create the index after re-creating the table when re-visiting the step.
However this also means that you should always create the index IN THE SAME STEP as creating the table. If not you could be retrying to create an index that already exists.

(Adding a warning to the docs about this)