haul 2002/10/02 04:24:37 Modified: src/java/org/apache/cocoon/acting/modular 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 1.9 +28 -10 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.9 diff -u -r1.8 -r1.9 --- DatabaseAction.java 25 Aug 2002 08:54:29 -0000 1.8 +++ DatabaseAction.java 2 Oct 2002 11:24:37 -0000 1.9 @@ -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 + "]" ) ); + } } @@ -538,12 +559,9 @@ set.columns[i].isSet = false; set.columns[i].isKey = isKey; set.columns[i].isAutoIncrement = false; - if ( isKey & this.honourAutoIncrement() ) { - String autoIncrement = set.columns[i].columnConf.getAttribute("autoincrement","false"); - if ( autoIncrement.equalsIgnoreCase("yes") || autoIncrement.equalsIgnoreCase("true") ) { - set.columns[i].isAutoIncrement = true; - } - } + if ( isKey & this.honourAutoIncrement() ) + set.columns[i].isAutoIncrement = set.columns[i].columnConf.getAttributeAsBoolean("autoincrement",false); + set.columns[i].modeConf = getMode( set.columns[i].columnConf, selectMode( set.columns[i].isAutoIncrement, modeTypes ) ); set.columns[i].mode = ( set.columns[i].modeConf != null ?
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]