001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import lucee.runtime.exp.TagNotSupported; 022import lucee.runtime.ext.tag.TagImpl; 023 024/** 025* Used in a cfgrid, cfgridupdate allows you to perform updates to data sources directly from edited 026* grid data. The cfgridupdate tag provides a direct interface with your data source. 027* The cfgridupdate tag applies delete row actions first, then INSERT row actions, and then UPDATE row 028* actions. If an error is encountered, row processing stops. 029* 030* 031* 032**/ 033public final class GridUpdate extends TagImpl { 034 035 private String password; 036 private String datasource; 037 private String providerdsn; 038 private boolean keyonly; 039 private String tablename; 040 private String connectstring; 041 private String dbtype; 042 private String grid; 043 private String dbname; 044 private String username; 045 private String dbserver; 046 private String tableowner; 047 private String provider; 048 private String tablequalifier; 049 050 051 /** 052 * constructor for the tag class 053 **/ 054 public GridUpdate() throws TagNotSupported { 055 throw new TagNotSupported("GridUpdate"); 056 } 057 058 059 /** set the value password 060 * If specified, password overrides the password value specified in the ODBC setup. 061 * @param password value to set 062 **/ 063 public void setPassword(String password) { 064 this.password=password; 065 } 066 067 /** set the value datasource 068 * The name of the data source for the update action. 069 * @param datasource value to set 070 **/ 071 public void setDatasource(String datasource) { 072 this.datasource=datasource; 073 } 074 075 /** set the value providerdsn 076 * Data source name for the COM provider (OLE-DB only). 077 * @param providerdsn value to set 078 **/ 079 public void setProviderdsn(String providerdsn) { 080 this.providerdsn=providerdsn; 081 } 082 083 /** set the value keyonly 084 * Yes or No. Yes specifies that in the update action, the WHERE criteria is confined to the key 085 * values. No specifies that in addition to the key values, the original values of any changed fields 086 * are included in the WHERE criteria. Default is Yes. 087 * @param keyonly value to set 088 **/ 089 public void setKeyonly(boolean keyonly) { 090 this.keyonly=keyonly; 091 } 092 093 /** set the value tablename 094 * The name of the table to update. 095 * @param tablename value to set 096 **/ 097 public void setTablename(String tablename) { 098 this.tablename=tablename; 099 } 100 101 public void setConnectstring(String connectstring) { 102 this.connectstring=connectstring; 103 } 104 105 /** set the value dbtype 106 * The database driver type 107 * @param dbtype value to set 108 **/ 109 public void setDbtype(String dbtype) { 110 this.dbtype=dbtype; 111 } 112 113 /** set the value grid 114 * The name of the cfgrid form element that is the source for the update action. 115 * @param grid value to set 116 **/ 117 public void setGrid(String grid) { 118 this.grid=grid; 119 } 120 121 /** set the value dbname 122 * The database name (Sybase System 11 driver and SQLOLEDB provider only). If specified, 123 * dbName overrides the default database specified in the data source. 124 * @param dbname value to set 125 **/ 126 public void setDbname(String dbname) { 127 this.dbname=dbname; 128 } 129 130 /** set the value username 131 * If specified, username overrides the username value specified in the ODBC setup. 132 * @param username value to set 133 **/ 134 public void setUsername(String username) { 135 this.username=username; 136 } 137 138 /** set the value dbserver 139 * For native database drivers and the SQLOLEDB provider, specifies the name of the database 140 * server computer. If specified, dbServer overrides the server specified in the data source. 141 * @param dbserver value to set 142 **/ 143 public void setDbserver(String dbserver) { 144 this.dbserver=dbserver; 145 } 146 147 /** set the value tableowner 148 * For data sources that support table ownership (such as SQL Server, Oracle, and Sybase SQL 149 * Anywhere), use this field to specify the owner of the table. 150 * @param tableowner value to set 151 **/ 152 public void setTableowner(String tableowner) { 153 this.tableowner=tableowner; 154 } 155 156 /** set the value provider 157 * COM provider (OLE-DB only). 158 * @param provider value to set 159 **/ 160 public void setProvider(String provider) { 161 this.provider=provider; 162 } 163 164 /** set the value tablequalifier 165 * For data sources that support table qualifiers, use this field to specify the qualifier for the 166 * table. The purpose of table qualifiers varies across drivers. For SQL Server and Oracle, the qualifier 167 * refers to the name of the database that contains the table. For the Intersolv dBase driver, the qualifier 168 * refers to the directory where the DBF files are located. 169 * @param tablequalifier value to set 170 **/ 171 public void setTablequalifier(String tablequalifier) { 172 this.tablequalifier=tablequalifier; 173 } 174 175 176 @Override 177 public int doStartTag() { 178 return SKIP_BODY; 179 } 180 181 @Override 182 public int doEndTag() { 183 return EVAL_PAGE; 184 } 185 186 @Override 187 public void release() { 188 super.release(); 189 password=""; 190 datasource=""; 191 providerdsn=""; 192 keyonly=false; 193 tablename=""; 194 connectstring=""; 195 dbtype=""; 196 grid=""; 197 dbname=""; 198 username=""; 199 dbserver=""; 200 tableowner=""; 201 provider=""; 202 tablequalifier=""; 203 } 204}