haul 2002/10/02 01:41:20 Modified: src/java/org/apache/cocoon/acting/modular Tag: cocoon_2_0_3_branch DatabaseAction.java Log: patch by Bobby Mitchell <[EMAIL PROTECTED]> allows to turn off preceeding table name and trailing row number for column output. Revision Changes Path No revision No revision 1.8.2.1 +25 -4 xml-cocoon2/src/java/org/apache/cocoon/acting/modular/DatabaseAction.java Index: DatabaseAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/modular/DatabaseAction.java,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -r1.8 -r1.8.2.1 --- DatabaseAction.java 25 Aug 2002 08:54:29 -0000 1.8 +++ DatabaseAction.java 2 Oct 2002 08:41:20 -0000 1.8.2.1 @@ -451,12 +451,33 @@ /** * compose name for output a long the lines of "table.column[row]" or * "table.column" if rowIndex is -1. + * If the section of the sitemap corresponding to the action contains + * <append-table-name>false</append-table-name> + * the name for output is "column[row]" + * If the section of the sitemap corresponding to the action contains + * <append-row>false</append-row> + * the name for output is "column" */ protected String getOutputName ( Configuration tableConf, Configuration columnConf, int rowIndex ) { - return ( tableConf.getAttribute("alias", tableConf.getAttribute("name", null) ) - + "." + columnConf.getAttribute("name",null) - + ( rowIndex == -1 ? "" : "[" + rowIndex + "]" ) ); + if ( rowIndex != -1 && this.settings.containsKey("append-row") && + (this.settings.get("append-row").toString().equalsIgnoreCase("false") || + this.settings.get("append-row").toString().equalsIgnoreCase("0")) ) { + rowIndex = -1; + } + if ( this.settings.containsKey("append-table-name") && + (this.settings.get("append-table-name").toString().equalsIgnoreCase("false") || + this.settings.get("append-table-name").toString().equalsIgnoreCase("0")) ) + { + return ( columnConf.getAttribute("name",null) + + ( rowIndex == -1 ? "" : "[" + rowIndex + "]" ) ); + } + else + { + return ( tableConf.getAttribute("alias", tableConf.getAttribute("name", null) ) + + "." + columnConf.getAttribute("name",null) + + ( rowIndex == -1 ? "" : "[" + rowIndex + "]" ) ); + } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]