Query.

@param db
the db
@param conditions
the conditions
@param type
the type
@param listener
the listener
5484
static void query(SQLiteDatabase db, String conditions, QueryType type, OnResultListener listener) {
		String query = String.format(
				"SELECT name, sql FROM sqlite_master WHERE type='%s'and name!='sqlite_sequence' and name!='android_metadata'%s",
				type.toString().toLowerCase(), StringUtils.hasText(conditions) ? " AND " + conditions : "");
		try (Cursor cursor = db.rawQuery(query, null)) {
			if (cursor.moveToFirst()) {
				int index0 = cursor.getColumnIndex("name");
				int index1 = cursor.getColumnIndex("sql");
				do {
					listener.onRow(db, cursor.getString(index0), cursor.getString(index1));
				} while (cursor.moveToNext());
			}
		}
	}
1196239
private List<Condition> conditionsOf(JsonNode conditionNodes) {

        List<Condition> conditionList = new LinkedList<Condition>();
        Iterator<Map.Entry<String, JsonNode>> mapOfConditions = conditionNodes
                .fields();

        Entry<String, JsonNode> condition;
        while (mapOfConditions.hasNext()) {
            condition = mapOfConditions.next();
            convertConditionRecord(conditionList, condition.getKey(),
                    condition.getValue());
        }

        return conditionList;
    }
945921
public <T> List<T> query(String sql, Class<T> beanClass, Object... params) throws SQLException {
		return query(sql, new BeanListHandler<T>(beanClass), params);
	}
1169161
public boolean setDbType(String dbType) {
        boolean result = false;
        if (dbTypes.contains(dbType)) {
            setSelectedDbType(dbType);
            result = true;
        }
        return result;
    }
1011167
def get(cls, database, conditions=""):
        
        assert isinstance(database, Database), "database must be database.Database class instance"
        assert isinstance(conditions, string_types), "conditions must be a string"
        if conditions:
            conditions += " AND"
        field_names = ','.join(cls.fields())
        return database.select("SELECT %s FROM %s WHERE %s database='%s'" %
                               (field_names,  cls.table_name(), conditions, database.db_name), model_class=cls)
181658
public void validate(Query<? extends Entity> query, EntityType entityType) {
    query.getRules().forEach(queryRule -> validateQueryRule(queryRule, entityType));
  }
248534
@Override
    public <T> Query<T> createQuery(Class<T> entityType, String eql) {
        Assert.notNull(entityType, "entityType must not null");
        Assert.hasText(eql, "eql must has text");
        return ebeanServer.createQuery(entityType, eql);
    }
488938
public List<Object> querySingleRowResults(String sql, String[] args) {
		return db.querySingleRowResults(sql, args);
	}
1289495
def db_query(self, query, args=None):
        
        if args is None:
            self.cursor.execute(query)
        else:
            self.cursor.execute(query, args)
252098
public static void setJdbcType(String typeName, int typeIndex, JdbcType type)
    {
        setJdbcTypeByName(typeName, type);
        setJdbcTypeByTypesIndex(typeIndex, type);
    }
1219037
public <T> List<T> querySingleRowTypedResults(String sql, String[] args) {
		return db.querySingleRowTypedResults(sql, args);
	}
877842
private SQLQuery query(Class<?>... entity) {
		SQLQuery q = session.createSQLQuery(sql);
		if (entity.length == 1) {
			q.addEntity(entity[0]);
		}
		for (Map.Entry<String, Type> scalar : scalars.entrySet()) {
			q.addScalar(scalar.getKey(), scalar.getValue());
		}
		for (int i = 0; i < positionedParameters.length; i++) {
			q.setParameter(i, positionedParameters[i]);
		}
		for (Map.Entry<String, Object> entry : namedParameters.entrySet()) {
			Object value = entry.getValue();
			if (Types.isArray(value)) {
				Object[] parameter = (Object[]) value;
				if (parameter.length == 0) {
					throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey()));
				}
				q.setParameterList(entry.getKey(), parameter);
			} else if (Types.isCollection(value)) {
				Collection<?> parameter = (Collection<?>) value;
				if (parameter.isEmpty()) {
					throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey()));
				}
				q.setParameterList(entry.getKey(), parameter);
			} else {
				q.setParameter(entry.getKey(), value);
			}
		}
		if (offset > 0) {
			q.setFirstResult(offset);
		}
		if (rowsCount > 0) {
			q.setMaxResults(rowsCount);
		}
		return q;
	}
342458
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) {
        SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity);
        listeners.start(context);
        return context;
    }
289287
@Override
    protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
    {
        Connection conn = getConnection();
        try
        {
            // if entity is embeddable...call cql translator to get cql string!
            // use thrift client to execute cql query.

            if (isCql3Enabled(entityMetadata))
            {
                cqlClient.persist(entityMetadata, entity, conn.getClient(), rlHolders,
                        getTtlValues().get(entityMetadata.getTableName()));
            }
            else
            {
                Map<ByteBuffer, Map<String, List<Mutation>>> mutationMap = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
                prepareMutation(entityMetadata, entity, id, rlHolders, mutationMap);
                // Write Mutation map to database
                conn.getClient().batch_mutate(mutationMap, getConsistencyLevel());

                mutationMap.clear();
                mutationMap = null;
            }

        }
        catch (InvalidRequestException e)
        {
            log.error("Error while persisting record, Caused by: .", e);
            throw new KunderaException(e);
        }
        catch (TException e)
        {
            log.error("Error while persisting record, Caused by: .", e);
            throw new KunderaException(e);
        }
        catch (UnsupportedEncodingException e)
        {
            log.error("Error while persisting record, Caused by: .", e);
            throw new KunderaException(e);
        }
        finally
        {
            releaseConnection(conn);

            if (isTtlPerRequest())
            {
                getTtlValues().clear();
            }
        }
    }
1296161
@Override
	public <T> QueryRequest<List<T>> query(String fql, Class<T> type)
	{
		return this.getBatchForQuery().query(fql, type);
	}
527897
public <S> List<S> queryList(Class<S> type, String sql, List<Object> params) {
        return this.queryList(type, sql, params.toArray());
    }
1226626
public <T> T querySingleTypedResult(String sql, String[] args) {
		@SuppressWarnings("unchecked")
		T result = (T) querySingleResult(sql, args);
		return result;
	}