This method builds the SQL query string to perform a delete query.
@param null
@return string The SQL query string for delete operation.
@throws This method does not throw an error
196266
protected function buildDelete()
	{
		//initialize $where and $limit container vars to empty strings
		$where = $limit = '';

		//define the string formating template
		$template = "DELETE FROM %s %s %s";

		//get the where clause variable
		$queryWhere = $this->wheres;

		//check if where clause is empty
		if ( ! empty($queryWhere) ) 
		{
			//convert where clause array to string
			$joined = join(" AND ", $queryWhere);

			//compose the where string
			$where = "WHERE {$joined}";

		}

		//get the limit clause variable
		$queryLimit = $this->limits;

		//check if limit clause is empty
		if ( ! empty($queryLimit) ) 
		{
			//get the offset value
			$limitOffset = $this->offset;

			//compose the limit clause string
			$limit = "LIMIT {$queryLimit} {$limitOffset}";

		}

		//return the formated query string
		return sprintf($template, $this->froms, $where, $limit);

	}
165357
public static <T> String getCustomDeleteSQL(Class<T> clazz, String postSql) {
		StringBuilder sql = new StringBuilder();
		
		Table table = DOInfoReader.getTable(clazz);
		
		sql.append("DELETE FROM ");
		sql.append(getTableName(table));
		
		sql.append(autoSetSoftDeleted(postSql, clazz));
		
		return sql.toString();
	}
1079845
protected String createQueryString() {
		assert !this.hasBinaryAttachments;
		
		if (this.params.isEmpty())
			return "";
		
		StringBuilder bld = null;
		
		for (Map.Entry<String, Object> param: this.params.entrySet()) {
			if (bld == null)
				bld = new StringBuilder();
			else
				bld.append('&');
			
			bld.append(StringUtils.urlEncode(param.getKey()));
			bld.append('=');
			bld.append(StringUtils.urlEncode(param.getValue().toString()));
		}
		
		return bld.toString();
	}
569573
@NotNull
    public T queryNN() throws SQLException {
        T res = null;
        try (ResultSet r = statement.executeQuery()) {
            if (r.next()) {
                res = resultMapper.map(r);
            }
            Objects.requireNonNull(res);
            return res;
        }
    }
1217245
def _delete_null_columns(self):
        
        ds = DeleteStatement(self.column_family_name)
        deleted_fields = False
        for _, v in self.instance._values.items():
            col = v.column
            if v.deleted:
                ds.add_field(col.db_field_name)
                deleted_fields = True
            elif isinstance(col, Map):
                uc = MapDeleteClause(col.db_field_name, v.value, v.previous_value)
                if uc.get_context_size() > 0:
                    ds.add_field(uc)
                    deleted_fields = True

        if deleted_fields:
            for name, col in self.model._primary_keys.items():
                ds.add_where_clause(WhereClause(
                    col.db_field_name,
                    EqualsOperator(),
                    col.to_database(getattr(self.instance, name))
                ))
            self._execute(ds)
560490
@Nullable
	public static String firstString(PreparedStatement stmt) throws SQLException {
		ResultSet rs = stmt.executeQuery();
		String s = rs.next() ? rs.getString(1) : null;
		stmt.close();
		return s;
	}
1322711
public function getDeleteQuery()
    {
        $sql = 'DELETE FROM ' . $this->getTable();
        if ($this->where) {
            $sql .= "\nWHERE " . $this->getWhere();
        }
        if ($this->limit) {
            $sql .= "\nLIMIT " . $this->getLimit();
        }

        return $sql;
    }
847410
public int delete(String sql) {
        String msId = msUtils.delete(sql);
        return sqlSession.delete(msId);
    }
108259
public int delete() throws SQLException {
		checkForDao();
		@SuppressWarnings("unchecked")
		T t = (T) this;
		return dao.delete(t);
	}
843069
private String createQueryString() {
        QueryChunk[] chunks = query.getChunks();
		if ((chunks == null) || (chunks.length == 0)) {
			// no query chunks
			return "";
		}

		StringBuffer sb = new StringBuffer();
        QueryChunk chunk = null;
        int position = 1;
        for (int i = 0; i < chunks.length; i++) {
			chunk = chunks[i];
			//System.out.println("chunk = " + chunk);
			switch (chunk.getType()) {
				case QueryChunk.PARAMETER_TYPE: {
                    position++;
                    String paramName = chunk.getText();
					QueryParameter param = parameters.get(paramName);					
					if (QueryParameter.MULTIPLE_SELECTION.equals(param.getSelection())) {
						if (QueryUtil.isProcedureCall(query.getText())) {		
							sb.append("?");
						} else {
							Object[] paramValue = (Object[]) parameterValues.get(paramName);						
							sb.append('(');
							for (int j = 0; j < paramValue.length; j++) {
								if (j > 0) {
									sb.append(',');
								}
								sb.append('?');
							}
							sb.append(')');
						}
					} else {
						sb.append("?");
					}
					break;
				}
				case QueryChunk.TEXT_TYPE:
                    if (chunk.getText().contains("?")) {
                        outputParameterPosition = position;                        
                    }
                default: {
					sb.append(chunk.getText());
					break;
				}
			}
		}        
        return sb.toString();
	}
929963
public function buildQuery($query = null)
    {
        if (null === $query) {
            $query = $this->query;
        }

        $sql = "SELECT ";
        if (isset($query['distinct']) && $query['distinct']) {
            $sql .= 'DISTINCT ';
        }
        $sql .= isset($query['select']) ? $query['select'] : '*';

        if (!isset($query['from'])) {
            return false;
        }

        $sql .= "\nFROM " . $query['from'];
        if (isset($query['join'])) {
            $sql .= "\n" . (is_array($query['join']) ? implode("\n", $query['join']) : $query['join']);
        }
        if (isset($query['where']) && $query['where'] !== '') {
            $sql .= "\nWHERE " . $query['where'];
        }
        if (isset($query['group'])) {
            $sql .= "\nGROUP BY " . $query['group'];
            if (isset($query['having'])) {
                $sql .= "\nHAVING " . $query['having'];
            }
        }
        if (isset($query['order'])) {
            $sql .= "\n ORDER BY " . $query['order'];
        }
        $limit = isset($query['limit']) ? $query['limit'] : 0;
        $offset = isset($query['offset']) ? $query['offset'] : 0;
        $sql = $this->db->buildLimitOffset($sql, $limit, $offset);

        if (isset($query['union'])) {
            $sql .= "\n" . (is_array($query['union']) ? implode("\n", $query['union']) : $query['union']);
        }

        return $sql;
    }
1244763
public function delete($sql = null, $parameters = array()) {
        DB::addQueryLog($sql, $parameters);
        return $this->getEngine()->delete($sql, $parameters);
    }
147607
def delete(sql_params = "", *bindvars)
      delete_sql = "DELETE FROM \"#{@schema_name}\".\"#{@table_name}\" "
      case sql_params
      when String
        delete_sql << sql_params
      when Hash
        raise ArgumentError, "Cannot specify bind variables when passing WHERE conditions as Hash" unless bindvars.empty?
        where_sqls = []
        sql_params.each do |k, v|
          where_sqls << "#{k} = :#{k}"
          bindvars << v
        end
        delete_sql << "WHERE " << where_sqls.join(" AND ") unless where_sqls.empty?
      else
        raise ArgumentError, "Only String or Hash can be provided as SQL condition argument"
      end
      @schema.execute(delete_sql, *bindvars)
    end
81881
@Override
  public ResultSet executeQuery(String sql) throws SQLException
  {
    raiseSQLExceptionIfStatementIsClosed();
    return executeQueryInternal(sql, null);
  }
135972
protected String getQueryString() {
        if (bindings.size() == 0)
            return queryString;
        String qry = queryString;
        int b = qry.indexOf('{');
        String select = qry.substring(0, b);
        String where = qry.substring(b);
        for (String name : bindings.getBindingNames()) {
            String replacement = getReplacement(bindings.getValue(name));
            if (replacement != null) {
                String pattern = "[\\?\\$]" + name + "(?=\\W)";
                select = select.replaceAll(pattern, "");
                where = where.replaceAll(pattern, replacement);
            }
        }
        return select + where;
    }
920985
final public function delete() {
	
		if (!$this->getId()) return FALSE;
		
		// trigger a custom function before deletion
		$this->beforeDelete();
		
		$class = get_called_class();
		
		// build the SQL where line
		$where = ' WHERE ' . implode(' AND ', $this->getSqlKeyConditions());
		
		$query = 'DELETE FROM `' . $class::TABLE_NAME . '`' . $where . ' LIMIT 1';
		$res = $this->db->exec($query, $this->getSqlKeyValues());
		
		// list properties to not remove
		$activeRecordsProperties = array('db', 'loadedFromDb', 'typeList', 'errors');
		
		// unset all properties
		foreach ($this as $key => $value) {
			if (!in_array($key, $activeRecordsProperties)) {
				unset($this->$key);
			}
		}
		
		$this->loadedFromDb = FALSE;
		
		// trigger a custom function after deletion
		$this->afterDelete();

		return (bool)$res;
		
	}
610781
public @Nullable String build() {
    StringBuilder queryString = new StringBuilder();

    for (NameValuePair param : params) {
      if (queryString.length() > 0) {
        queryString.append(PARAM_SEPARATOR);
      }
      queryString.append(Escape.urlEncode(param.getName()));
      queryString.append(VALUE_SEPARATOR);
      queryString.append(Escape.urlEncode(param.getValue()));
    }

    if (queryString.length() > 0) {
      return queryString.toString();
    }
    else {
      return null;
    }
  }