获取Entity的DELETE SQL

@param bean Entity对象

@return String
10637
public String getDeletePrepareSQL(T bean) {
        if (this.tableStrategy == null) return deletePrepareSQL;
        return deletePrepareSQL.replace("${newtable}", getTable(bean));
    }
463444
public int deleteByTableName(String tableName) throws SQLException {
		DeleteBuilder<MetadataReference, Void> db = deleteBuilder();
		db.where().eq(MetadataReference.COLUMN_TABLE_NAME, tableName);
		PreparedDelete<MetadataReference> deleteQuery = db.prepare();
		int deleted = delete(deleteQuery);
		return deleted;
	}
1041456
public int delete(String sql, Object value) {
        Class<?> parameterType = value != null ? value.getClass() : null;
        String msId = msUtils.deleteDynamic(sql, parameterType);
        return sqlSession.delete(msId, value);
    }
1092023
public boolean remove(BeanId id) // d129562
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "remove (" + id + ")");

        TimeoutElement elt = null;

        elt = ivStatefulBeanList.remove(id);

        synchronized (this) {
            if (elt != null) {
                numObjects--;
                numRemoves++;

                if (numObjects == 0) { // F743-33394
                    stopAlarm();
                }
            } else {
                numNullRemoves++;
            }
        }

        boolean result = elt != null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "remove (" + result + ")");
        return result; // d129562
    }
826900
@Override
    public final void remove(final V entity) {
        final SqlParameterSource parameterSource; // Parameters source

        parameterSource = new BeanPropertySqlParameterSource(entity);

        getTemplate().update(getDeleteQueryTemplate(), parameterSource);
    }
1331941
public int delete(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
		if (mappedDelete == null) {
			mappedDelete = MappedDelete.build(dao, tableInfo);
		}
		int result = mappedDelete.delete(databaseConnection, data, objectCache);
		if (dao != null && !localIsInBatchMode.get()) {
			dao.notifyChanges();
		}
		return result;
	}
1167314
public static int delete(Connection connection, String table, String where,
			String[] args) {
		StringBuilder delete = new StringBuilder();
		delete.append("delete from ").append(CoreSQLUtils.quoteWrap(table));
		if (where != null) {
			delete.append(" where ").append(where);
		}
		String sql = delete.toString();

		PreparedStatement statement = null;

		int count = 0;
		try {
			statement = connection.prepareStatement(sql);
			setArguments(statement, args);
			count = statement.executeUpdate();
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to execute SQL delete statement: " + sql, e);
		} finally {
			closeStatement(statement, sql);
		}

		return count;
	}
1079732
public String deleteByIds(MappedStatement ms) {
        final Class<?> entityClass = getEntityClass(ms);
        StringBuilder sql = new StringBuilder();
        sql.append(SqlHelper.deleteFromTable(entityClass, tableName(entityClass)));
        Set<EntityColumn> columnList = EntityHelper.getPKColumns(entityClass);
        if (columnList.size() == 1) {
            EntityColumn column = columnList.iterator().next();
            sql.append(" where ");
            sql.append(column.getColumn());
            sql.append(" in (${_parameter})");
        } else {
            throw new MapperException("继承 deleteByIds 方法的实体类[" + entityClass.getCanonicalName() + "]中必须只有一个带有 @Id 注解的字段");
        }
        return sql.toString();
    }
1281400
protected function getDeleteStatement(): string
    {
        $statement = '';
        if (!$this->isDelete()) {
            return $statement;
        }

        // delete语句
        $statement .= $this->getDeleteString();

        // from语句
        if ($this->builder->getFrom()) {
            $statement .= ' ' . $this->getFromString();
        }

        // where语句
        if ($this->builder->getWhere()) {
            $statement .= ' ' . $this->getWhereString();
        }

        // orderBy语句
        if ($this->builder->getOrderBy()) {
            $statement .= ' ' . $this->getOrderByString();
        }

        // limit语句
        if ($this->builder->getLimit()) {
            $statement .= ' ' . $this->getLimitString();
        }

        return $statement;
    }
875093
public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException {
		CompiledStatement compiledStatement = preparedDelete.compile(databaseConnection, StatementType.DELETE);
		try {
			int result = compiledStatement.runUpdate();
			if (dao != null && !localIsInBatchMode.get()) {
				dao.notifyChanges();
			}
			return result;
		} finally {
			IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
		}
	}
1348467
@SuppressWarnings("unchecked")
	public static <T> T handleRow(int columnCount, ResultSetMetaData meta, ResultSet rs, Class<T> beanClass) throws SQLException {
		Assert.notNull(beanClass, "Bean Class must be not null !");
		
		if(beanClass.isArray()) {
			//返回数组
			final Class<?> componentType = beanClass.getComponentType();
			final Object[] result = ArrayUtil.newArray(componentType, columnCount);
			for(int i = 0,j = 1; i < columnCount; i++, j++) {
				result[i] = getColumnValue(rs, j, meta.getColumnType(j), componentType);
			}
			return (T) result;
		} else if(Iterable.class.isAssignableFrom(beanClass)) {
			//集合
			final Object[] objRow = handleRow(columnCount, meta, rs, Object[].class);
			return Convert.convert(beanClass, objRow);
		} else if(beanClass.isAssignableFrom(Entity.class)) {
			//Entity的父类都可按照Entity返回
			return (T) handleRow(columnCount, meta, rs);
		} else if(String.class == beanClass) {
			//字符串
			final Object[] objRow = handleRow(columnCount, meta, rs, Object[].class);
			return (T) StrUtil.join(", ", objRow);
		}
		
		//普通bean
		final T bean = ReflectUtil.newInstanceIfPossible(beanClass);
		//忽略字段大小写
		final Map<String, PropDesc> propMap = BeanUtil.getBeanDesc(beanClass).getPropMap(true);
		String columnLabel;
		PropDesc pd;
		Method setter = null;
		Object value = null;
		for (int i = 1; i <= columnCount; i++) {
			columnLabel = meta.getColumnLabel(i);
			//驼峰命名风格
			pd = propMap.get(StrUtil.toCamelCase(columnLabel));
			setter = (null == pd) ? null : pd.getSetter();
			if(null != setter) {
				value = getColumnValue(rs, columnLabel,  meta.getColumnType(i), TypeUtil.getFirstParamType(setter));
				ReflectUtil.invokeWithCheck(bean, setter, new Object[] {value});
			}
		}
		return bean;
	}
1038154
public function delete()
    {

        //没有设置条件不能删除
        if ($this->condition->count() < 1) {
            throw new BaseException(QueryException::DELETE_NOT_WHERE);
        }
        $whereStr       = (string)$this->condition->compile();
        $whereArguments = $this->condition->arguments();
        $sql            = "DELETE FROM {$this->getFrom()} WHERE ".$whereStr;
        return $this->connection->executeUpdate($sql, $whereArguments);
    }
158043
public String getTable(T bean) {
        if (tableStrategy == null) return table;
        String t = tableStrategy.getTable(table, bean);
        return t == null || t.isEmpty() ? table : t;
    }
11633
public void remove(BeanId beanId)
    {
        final String fileName = getPortableFilename(beanId);
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "remove: key=" + beanId + ", file=" + fileName); //d248470

        try
        {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() // 126586
            {
                public Void run()
                                throws Exception
                {
                    File theFile = getStatefulBeanFile(fileName, true);
                    if (isTraceOn && tc.isDebugEnabled()) //d152600
                        Tr.debug(tc, "deleting file: " + theFile.getName() + ", path: " + theFile.getPath());

                    boolean deleted = theFile.delete(); //d152600

                    if (isTraceOn && tc.isDebugEnabled()) //d152600
                        Tr.debug(tc, "File.delete returned: " + deleted);
                    return null;
                }
            });
        } catch (PrivilegedActionException ex)
        {
            FFDCFilter.processException(ex.getException(), CLASS_NAME + ".remove", "150", this);
            if (isTraceOn && tc.isEventEnabled())
                Tr.event(tc, "Failed to remove session bean state", new Object[] { beanId, ex });
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "remove");
    }
631415
public int deleteByTableName(String tableName) throws SQLException {
		DeleteBuilder<DataColumns, TableColumnKey> db = deleteBuilder();
		db.where().eq(DataColumns.COLUMN_TABLE_NAME, tableName);
		PreparedDelete<DataColumns> deleteQuery = db.prepare();
		int deleted = delete(deleteQuery);
		return deleted;
	}
1106755
public String getQueryDollarPrepareSQL(T bean) {
        if (this.tableStrategy == null) return queryDollarPrepareSQL;
        return queryDollarPrepareSQL.replace("${newtable}", getTable(bean));
    }
838007
public String getUpdatePrepareSQL(T bean) {
        if (this.tableStrategy == null) return updatePrepareSQL;
        return updatePrepareSQL.replace("${newtable}", getTable(bean));
    }