public Delete createDelete(NamedTable group, Condition where) { return new Delete(group, where); }
@Override public void visit(Delete obj) { if (obj.getParameterValues() != null) { this.exceptions.add(new TranslatorException(SimpleDBPlugin.Event.TEIID24007, SimpleDBPlugin.Util.gs(SimpleDBPlugin.Event.TEIID24007))); } visitNode(obj.getTable()); if (obj.getWhere() != null) { this.criteria = SimpleDBSQLVisitor.getSQLString(obj.getWhere()); } } }
@Override public void visit(Delete obj) { this.method = "DELETE"; //$NON-NLS-1$ this.entity = obj.getTable().getMetadataObject(); visitNode(obj.getTable()); // only pk are allowed, no other criteria not allowed obj.setWhere(buildEntityKey(obj.getWhere())); // this will build with entity keys this.uri = getEnitityURL(); if (this.uri.indexOf('(') == -1) { this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17011, this.filter.toString()))); } if (this.filter.length() > 0) { this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17009, this.filter.toString()))); } }
@Override public void execute() throws TranslatorException { DeleteVisitor dVisitor = new DeleteVisitor(getMetadata()); dVisitor.visitNode(command); execute(((Delete)command).getWhere(), dVisitor); }
@Override public void visit(Delete delete) { super.visit(delete); try { loadColumnMetadata(delete.getTable()); } catch (TranslatorException ce) { exceptions.add(ce); } }
public void testGetCriteria() throws Exception { assertNotNull(example().getWhere()); }
public void testGetGroup() throws Exception { assertNotNull(example().getTable()); }
private void executeDelete() throws TranslatorException { Condition criteria = ((Delete)command).getWhere(); // since we have the exact same processing rules for criteria // for updates and deletes, we use a common private method to do this. // note that this private method will throw a ConnectorException // for illegal criteria, which we deliberately don't catch // so it gets passed on as is. String distinguishedName = getDNFromCriteria(criteria); // just try to delete an LDAP entry using the DN // specified in the DELETE operation. If it isn't // legal, we'll get a NamingException back, whose explanation // we'll return in a ConnectorException try { ldapCtx.destroySubcontext(distinguishedName); } catch (NamingException ne) { final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.deleteFailed",distinguishedName,ne.getExplanation()); //$NON-NLS-1$ throw new TranslatorException(msg); // don't remember why I added this generic catch of Exception, // but it does no harm... } catch (Exception e) { final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.deleteFailedUnexpected",distinguishedName); //$NON-NLS-1$ throw new TranslatorException(e, msg); } }
org.teiid.language.Delete translate(Delete delete) { org.teiid.language.Delete deleteImpl = new org.teiid.language.Delete(translate(delete.getGroup()), translate(delete.getCriteria())); setBatchValues(deleteImpl); return deleteImpl; }
org.teiid.language.Delete translate(Delete delete) { org.teiid.language.Delete deleteImpl = new org.teiid.language.Delete(translate(delete.getGroup()), translate(delete.getCriteria())); setBatchValues(deleteImpl); return deleteImpl; }
org.teiid.language.Delete translate(Delete delete) { org.teiid.language.Delete deleteImpl = new org.teiid.language.Delete(translate(delete.getGroup()), translate(delete.getCriteria())); setBatchValues(deleteImpl); return deleteImpl; }