Loads all objects from the specified table that match the supplied
query.
10827
protected <T> ArrayList<T> loadAll (final Table<T> table,
                                        final String query)
        throws PersistenceException
    {
        return execute(new Operation<ArrayList<T>>() {
            public ArrayList<T> invoke (
                Connection conn, DatabaseLiaison liaison)
                throws SQLException, PersistenceException
            {
                return table.select(conn, query).toArrayList();
            }
        });
    }
200227
def load_keys(database, parameters):
    """"""
    keys = []
    with database.snapshot() as snapshot:
        results = snapshot.execute_sql(
            'SELECT u.id FROM %s u' % parameters['table'])

    for row in results:
        keys.append(row[0])

    return keys
554395
void recompileDependentObjects(Table table) {

        OrderedHashSet set     = getReferencingObjects(table.getName());
        Session        session = database.sessionManager.getSysSession();

        for (int i = 0; i < set.size(); i++) {
            HsqlName name = (HsqlName) set.get(i);

            switch (name.type) {

                case SchemaObject.VIEW :
                case SchemaObject.CONSTRAINT :
                case SchemaObject.ASSERTION :
                    SchemaObject object = getSchemaObject(name);

                    object.compile(session);
                    break;
            }
        }

        HsqlArrayList list = getAllTables();

        for (int i = 0; i < list.size(); i++) {
            Table t = (Table) list.get(i);

            t.updateConstraintPath();
        }
    }
644469
function get_objects($sql, $class_name = 'stdClass', array $params = null, $index = null)
	{
		$result = array();
		$recset = $this->query($sql, MYSQLI_USE_RESULT);
		if (isset($index))
		{
			if (is_null($params))
				while ($obj = $recset->fetch_object($class_name))
					$result[$obj->$index] = $obj;
			else
				while ($obj = $recset->fetch_object($class_name, $params))
					$result[$obj->$index] = $obj;
		}
		else
		{
			if (is_null($params))
				while ($obj = $recset->fetch_object($class_name))
					$result[] = $obj;
			else
				while ($obj = $recset->fetch_object($class_name, $params))
					$result[] = $obj;
		}
		$recset->free_result();
		return $result;
	}
1009244
public function loadObjectList($params=array()) {

		$this->openConnection();
		
		$ret = NULL;
		
		try {

			$stat = $this->handler->prepare($this->query);
			$stat->execute((array)$params);
			$ret = $stat->fetchAll(\PDO::FETCH_OBJ);
			
			// logger
			$this->logParamQuery($this->query, count($ret), $params);

		} catch (\PDOException $e) {

			$this->handleException($e, $params);
		
		}
		
		$stat->closeCursor();

		return $ret;
		
	}
87825
public static function load($query, $fields = null)
    {
        //
        static::applySchema();

        //
        if (is_array($query)) {
            return static::loadByQuery($query, $fields);
        }

        //
        $key = static::getPrimaryKey();

        //
        return $key
             ? static::loadByPrimaryKey($query, $fields)
             : static::loadByMainField($query, $fields);
    }
1292784
def find_all(self, cls):
        """"""
        final_results = []
        table = self.get_class_table(cls)
        for db_result in table.scan():
            obj = cls.from_data(db_result['value'])
            final_results.append(obj)

        return final_results
736166
public final void loadSqlTables() throws Exception {
    for (Class<?> clazz : this.mngSettings.getClasses()) {
      TableSql tableSql = new TableSql();
      makeTableSqlFromXml(tableSql, clazz);
      this.tablesMap.put(clazz.getSimpleName(), tableSql);
    }
    for (Class<?> clazz : this.mngSettings.getClasses()) {
      TableSql tableSql = this.tablesMap.get(clazz.getSimpleName());
      StringBuffer sbIdNamesUc = new StringBuffer("");
      for (int i = 0; i < tableSql.getIdColumnsNames().length; i++) {
        if (i > 0) {
          sbIdNamesUc.append(",");
        }
        sbIdNamesUc.append(tableSql.getIdColumnsNames()[i].toUpperCase());
      }
      Field[] fields = getUtlReflection().retrieveFields(clazz);
      for (Field field : fields) {
        FieldSql fieldSql = tableSql.getFieldsMap().get(field.getName());
        if (fieldSql != null) { //if persistable or composite (foreign CID)
          String fldTypeSmpNm = field.getType().getSimpleName();
          try {
            TableSql tableSqlForeign = this.tablesMap.get(fldTypeSmpNm);
            if (tableSqlForeign != null) {
              //if it's foreign entity according entities list ORDER
              //make sure ORDER of entities!!!
              fieldSql.setForeignEntity(fldTypeSmpNm);
              String isNullableStr = this.mngSettings
                .lazFldSts(clazz, field.getName()).get("isNullable");
              if (fieldSql.getDefinition() != null // FK composite ID
                && !Boolean.valueOf(isNullableStr)
                  && !fieldSql.getDefinition().contains("not null")) {
                fieldSql.setDefinition(fieldSql.getDefinition() + " not null");
              }
              //FK:
              StringBuffer sbForeignIdNamesUc = new StringBuffer("");
              for (int i = 0; i < tableSqlForeign.getIdColumnsNames()
                .length; i++) {
                if (i > 0) {
                  sbForeignIdNamesUc.append(",");
                }
                sbForeignIdNamesUc.append(tableSqlForeign
                  .getIdColumnsNames()[i].toUpperCase());
              }
              String fkNames;
              if (tableSqlForeign.getIdColumnsNames().length > 1) {
                // composite FK:
                fkNames = sbForeignIdNamesUc.toString();
                // check if it is also primary key:
                boolean isAlsoPk = true;
                if (tableSql.getIdColumnsNames().length
                  == tableSqlForeign.getIdColumnsNames().length) {
                  for (int i = 0; i < tableSql.getIdColumnsNames()
                    .length; i++) {
                    if (!tableSqlForeign.getIdColumnsNames()[0]
                      .equals(tableSql.getIdColumnsNames()[0])) {
                      isAlsoPk = false;
                      break;
                    }
                  }
                }
                if (isAlsoPk) {
                  fieldSql.setTypeField(ETypeField.COMPOSITE_FK_PK);
                } else {
                  fieldSql.setTypeField(ETypeField.COMPOSITE_FK);
                }
                for (String cIdNm : tableSqlForeign.getIdColumnsNames()) {
                  FieldSql fldCid = new FieldSql();
                  fldCid.setTypeField(ETypeField.DERIVED_FROM_COMPOSITE);
                  if (!Boolean.valueOf(isNullableStr)
                      && !tableSqlForeign.getFieldsMap()
                        .get(cIdNm).getDefinition().contains("not null")) {
                    fldCid.setDefinition(tableSqlForeign.getFieldsMap()
                      .get(cIdNm).getDefinition() + " not null");
                  } else if (Boolean.valueOf(isNullableStr)
                      && fldCid.getDefinition().contains("not null")) {
                    fldCid.setDefinition(tableSqlForeign.getFieldsMap()
                      .get(cIdNm).getDefinition().replace(" not null", ""));
                  } else {
                    fldCid.setDefinition(tableSqlForeign.getFieldsMap()
                      .get(cIdNm).getDefinition());
                  }
                  fldCid.setForeignEntity(tableSqlForeign.getFieldsMap()
                    .get(cIdNm).getForeignEntity());
                  tableSql.getFieldsMap().put(cIdNm, fldCid);
                }
              } else {
                fkNames = field.getName().toUpperCase();
                if (fieldSql.getDefinition() == null) {
                  throw new ExceptionWithCode(ExceptionWithCode
                    .CONFIGURATION_MISTAKE,
                      "Where is no definition FID class/name: "
                        + clazz.getSimpleName() + "/" + field.getName());
                }
              }
              int hc = fldTypeSmpNm.hashCode();
              String hashCfesn;
              if (hc < 0) {
                hc = -hc;
                hashCfesn = "M" + hc;
              } else {
                hashCfesn = String.valueOf(hc);
              }

              String constraintFk = "constraint fk"
                + clazz.getSimpleName()
                + hashCfesn + field.getName()
                + " foreign key (" + fkNames
                + ") references " + fldTypeSmpNm.toUpperCase()
                + " (" + sbForeignIdNamesUc + ")";
              String constraint = tableSql.getConstraint();
              if (constraint != null) {
                constraint += ",\n" + constraintFk;
              } else {
                constraint = constraintFk;
              }
              tableSql.setConstraint(constraint);
            }
            //if field is PK, make sure NOT NULL:
            if (sbIdNamesUc.toString().contains(field.getName().toUpperCase())
                && !fieldSql.getDefinition().contains("not null")) {
              fieldSql.setDefinition(fieldSql.getDefinition()
                + " not null");
            }
          } catch (Exception e) {
            this.logger.error(null, ASrvOrm.class, "Error on load SQL tables:"
              + " class/field/fieldSql/tableSql - " + clazz.getSimpleName()
                + "/" + field.getName() + "/" + fieldSql + "/" + tableSql);
            throw e;
          }
        }
      }
      try {
        for (String colIdNm : tableSql.getIdColumnsNames()) {
          if (tableSql.getFieldsMap().get(colIdNm) == null) {
          throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
            "Where is no column ID class/name: " + clazz.getSimpleName()
              + "/" + colIdNm);
          }
        }
        //PK if complex (composite or foreign entity):
        if (tableSql.getIdColumnsNames().length > 1 || tableSql.getFieldsMap()
          .get(tableSql.getIdColumnsNames()[0]).getForeignEntity() != null) {
          String constraintPk = "constraint pk"
            + clazz.getSimpleName() + tableSql.getIdColumnsNames()[0]
              + " primary key (" + sbIdNamesUc + ")";
          if (tableSql.getConstraint() == null) {
            tableSql.setConstraint(constraintPk);
          } else {
            tableSql.setConstraint(constraintPk
              + ",\n" + tableSql.getConstraint());
          }
        }
        String constraintAdd = this.mngSettings.lazClsSts(clazz)
          .get("constraintAdd");
        if (constraintAdd != null) {
          if (tableSql.getConstraint() == null) {
            tableSql.setConstraint(constraintAdd);
          } else {
            tableSql.setConstraint(tableSql.getConstraint()
              + ",\n" + constraintAdd);
          }
        }
      } catch (Exception e) {
        this.logger.error(null, ASrvOrm.class, "Error on load SQL tables:"
          + " class/tableSql - " + clazz.getSimpleName() + "/" + tableSql);
        throw e;
      }
    }
  }
1302894
final private function loadFromDb($key) {
		
		// inherited class
		$class = get_called_class();
		
		// build the SQL where line
		$where = ' WHERE ' . implode(' AND ', $this->getSqlKeyConditions());
		
		// load the requested record
		$query = 'SELECT * FROM `' . $class::TABLE_NAME . '`' . $where . ' LIMIT 1';
		$this->db->setQuery($query);
		$obj = $this->db->loadObject($key);

		// if db record exists, will populate the object properties
		if (is_object($obj)) {
			
			$this->populate($obj);
			$this->loadedFromDb = TRUE;

		} else {
			
			$this->loadedFromDb = FALSE;
			
		}
		
	}
708415
private List<?> getResultList(Query query) {
        // TODO : use lazy fetch here?
        if (projection != null) {
            List<?> results = query.getResultList();
            List<Object> rv = new ArrayList<Object>(results.size());
            for (Object o : results) {
                if (o != null) {
                    Object[] arr;
                    if (!o.getClass().isArray()) {
                        arr = new Object[]{o};
                    } else {
                        arr = (Object[]) o;
                    }
                    if (projection.getArgs().size() < arr.length) {
                        Object[] shortened = new Object[projection.getArgs().size()];
                        System.arraycopy(arr, 0, shortened, 0, shortened.length);
                        arr = shortened;
                    }
                    rv.add(projection.newInstance(arr));
                } else {
                    rv.add(null);
                }
            }
            return rv;
        } else {
            return query.getResultList();
        }
    }
125634
def read(query)
      return [] unless query.valid?
      query.model.load(adapter.read(query), query)
    end
191354
protected function load(Select $query) : array
    {
        $rows = $this->connection->load($query);

        return $this->mapper->loadAll($this->loadingContext, $rows->getRows());
    }
174675
def select_all(self, table, limit=MAX_ROWS_PER_QUERY, execute=True):
        """"""
        # Determine if a row per query limit should be set
        num_rows = self.count_rows(table)
        if num_rows > limit:
            return self._select_batched(table, '*', num_rows, limit, execute=execute)
        else:
            return self.select(table, '*', execute=execute)
920959
def load(self, *relations):
        
        if len(self.items) > 0:
            query = self.first().new_query().with_(*relations)

            self._set_items(query.eager_load_relations(self.items))

        return self
1357974
@Override
	public void load(UnitDaoFactory unitDaoFactory) {
		for (String query : queries) {
			unitDaoFactory.getUnitDao().execute(query);
		}
	}
1238972
def get_tables_for_query(query):
    
    from django.db.models.sql.where import WhereNode, SubqueryConstraint
    from django.db.models.query import QuerySet
    tables = set([v[0] for v in getattr(query,'alias_map',{}).values()])

    def get_sub_query_tables(node):
        query = node.query_object
        if not hasattr(query, 'field_names'):
            query = query.values(*node.targets)
        else:
            query = query._clone()
        query = query.query
        return set(v[0] for v in getattr(query, 'alias_map',{}).values())

    def get_tables(node, tables):
        if isinstance(node, SubqueryConstraint):
            return get_sub_query_tables(node)
        for child in node.children:
            if isinstance(child, WhereNode):  # and child.children:
                tables |= set(get_tables(child, tables))
            elif not hasattr(child, '__iter__'):
                continue
            else:
                for item in (c for c in child if isinstance(c, QuerySet)):
                    tables |= get_tables_for_query(item.query)
        return tables

    if query.where and query.where.children:
        where_nodes = [c for c in query.where.children if isinstance(c, (WhereNode, SubqueryConstraint))]
        for node in where_nodes:
            tables |= get_tables(node, tables)

    return list(tables)
939047
@Transactional(readOnly = true)
    public Object load(Object key) {
        List<T> results = getJdbcTemplate().query(
                getSelectSql(), getRowMapper(), getPrimaryKeyComponents(key));
        return results.size() == 0 ? null : results.get(0);
    }