Return a query using native SQL.

@param sql native SQL.
@return the created Query using native SQL.
430290
@Override
    public <T> Query<T> createSqlQuery(Class<T> entityType, String sql) {
        Assert.notNull(entityType, "entityType must not null");
        Assert.hasText(sql, "sql must has text");
        RawSqlBuilder rawSqlBuilder = RawSqlBuilder.parse(sql);
        return ebeanServer.find(entityType).setRawSql(rawSqlBuilder.create());
    }
929655
public static @NotNull SqlQuery namedQuery(@NotNull @SQL String sql, @NotNull Object bean) {
        return namedQuery(sql, VariableResolver.forBean(bean));
    }
26423
public static SqlBuilder sql(final String queryStr) {
    SqlBuilder sqlQuery = new SqlBuilder();
    sqlQuery.statement = queryStr;
    return sqlQuery;
  }
326157
public String subQuery(String sql) {
    if (options.maxQuerySizeToLog > 0 && sql.length() > options.maxQuerySizeToLog - 3) {
      return sql.substring(0, options.maxQuerySizeToLog - 3) + "...";
    }
    return sql;
  }
411028
public <S> S queryOne(Class<S> type, String sql, List<Object> params) {
        if (Anima.of().isUseSQLLimit()) {
            sql += " LIMIT 1";
        }
        List<S> list = queryList(type, sql, params);
        return AnimaUtils.isNotEmpty(list) ? list.get(0) : null;
    }
1105062
@SuppressWarnings("ConstantConditions")
  public static String nativeSql(String sql, boolean noBackslashEscapes) throws SQLException {
    if (!sql.contains("{")) {
      return sql;
    }

    StringBuilder escapeSequenceBuf = new StringBuilder();
    StringBuilder sqlBuffer = new StringBuilder();

    char[] charArray = sql.toCharArray();
    char lastChar = 0;
    boolean inQuote = false;
    char quoteChar = 0;
    boolean inComment = false;
    boolean isSlashSlashComment = false;
    int inEscapeSeq = 0;

    for (int i = 0; i < charArray.length; i++) {
      char car = charArray[i];
      if (lastChar == '\\' && !noBackslashEscapes) {
        sqlBuffer.append(car);
        continue;
      }

      switch (car) {
        case '\'':
        case '"':
        case '`':
          if (!inComment) {
            if (inQuote) {
              if (quoteChar == car) {
                inQuote = false;
              }
            } else {
              inQuote = true;
              quoteChar = car;
            }
          }
          break;

        case '*':
          if (!inQuote && !inComment && lastChar == '/') {
            inComment = true;
            isSlashSlashComment = false;
          }
          break;
        case '/':
        case '-':
          if (!inQuote) {
            if (inComment) {
              if (lastChar == '*' && !isSlashSlashComment) {
                inComment = false;
              } else if (lastChar == car && isSlashSlashComment) {
                inComment = false;
              }
            } else {
              if (lastChar == car) {
                inComment = true;
                isSlashSlashComment = true;
              } else if (lastChar == '*') {
                inComment = true;
                isSlashSlashComment = false;
              }
            }
          }
          break;
        case 'S':
          // skip SQL_xxx and SQL_TSI_xxx in functions
          // This would convert e.g SQL_INTEGER => INTEGER, SQL_TSI_HOUR=>HOUR

          if (!inQuote && !inComment && inEscapeSeq > 0
              && i + 4 < charArray.length && charArray[i + 1] == 'Q'
              && charArray[i + 2] == 'L' && charArray[i + 3] == 'L'
              && charArray[i + 4] == '_') {

            if (i + 8 < charArray.length
                && charArray[i + 5] == 'T'
                && charArray[i + 6] == 'S'
                && charArray[i + 7] == 'I'
                && charArray[i + 8] == '_') {
              i += 8;
              continue;
            }
            i += 4;
            continue;
          }
          break;
        case '\n':
          if (inComment && isSlashSlashComment) {
            // slash-slash and dash-dash comments ends with the end of line
            inComment = false;
          }
          break;
        case '{':
          if (!inQuote && !inComment) {
            inEscapeSeq++;
          }
          break;

        case '}':
          if (!inQuote && !inComment) {
            inEscapeSeq--;
            if (inEscapeSeq == 0) {
              escapeSequenceBuf.append(car);
              sqlBuffer.append(resolveEscapes(escapeSequenceBuf.toString(), noBackslashEscapes));
              escapeSequenceBuf.setLength(0);
              continue;
            }
          }
          break;

        default:
          break;

      }
      lastChar = car;
      if (inEscapeSeq > 0) {
        escapeSequenceBuf.append(car);
      } else {
        sqlBuffer.append(car);
      }
    }
    if (inEscapeSeq > 0) {
      throw new SQLException(
          "Invalid escape sequence , missing closing '}' character in '" + sqlBuffer);
    }
    return sqlBuffer.toString();
  }
72631
def query(self, sql):
        '''
        
        '''
        try:
            self.connect()
            with self.con.cursor() as cursor:
                cursor.execute(sql)
                self.con.commit()
                res = cursor.fetchall()
                return res
        except Exception as e:
            print(e)
            return -1
        finally:
            self.close()
758075
@Override
    public boolean execute( String sql ) throws SQLException {
        notClosed();
        warning = null;
        moreResults = 0;
        try {
            // Convert the supplied SQL into JCR-SQL2 ...
            String jcrSql2 = connection.nativeSQL(sql);
            // Create the query ...
            final QueryResult jcrResults = getJcrRepositoryDelegate().execute(jcrSql2, this.sqlLanguage);
            results = new JcrResultSet(this, jcrResults, null);
            moreResults = 1;
        } catch (RepositoryException e) {
            throw new SQLException(e.getLocalizedMessage(), e);
        }
        return true; // always a ResultSet
    }
612871
def query(self, sql: str, args: tuple = None):
        """"""

        with self._cursor() as cursor:
            log.debug('Running SQL: ' + str((sql, args)))
            cursor.execute(sql, args)
            return cursor.fetchall()
641661
def querySQL(self, sql, args=()):
        
        if self.debug:
            result = timeinto(self.queryTimes, self._queryandfetch, sql, args)
        else:
            result = self._queryandfetch(sql, args)
        return result
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;
        }
    }
1344333
public final Query build(DB db) {
    return new Query(CallInfo.create(), db, toSQL(), queryArgs); 
  }
150208
public List<Object> querySingleColumnResults(String sql, String[] args,
			int column) {
		return db.querySingleColumnResults(sql, args, column);
	}
894618
final public function query (string $sql)
	{
		static::$lastQuery 	= $sql;
		$result 			= mysqli_query($this->connection, $sql);
		$this->confirmQuery($result);
		return $result;
	}
945921
public <T> List<T> query(String sql, Class<T> beanClass, Object... params) throws SQLException {
		return query(sql, new BeanListHandler<T>(beanClass), params);
	}
479787
public <T> List<T> selectList(String sql, Class<T> resultType) {
        String msId;
        if (resultType == null) {
            msId = msUtils.select(sql);
        } else {
            msId = msUtils.select(sql, resultType);
        }
        return sqlSession.selectList(msId);
    }
81881
@Override
  public ResultSet executeQuery(String sql) throws SQLException
  {
    raiseSQLExceptionIfStatementIsClosed();
    return executeQueryInternal(sql, null);
  }