Fetch the next row from the result set and set it as current.

Calls the _loadInstance() method for the specified class, so it properly
inherits behavior from xPDOObject derivatives.
513856
protected function fetch() {
        $row = $this->stmt->fetch(\PDO::FETCH_ASSOC);
        if (is_array($row) && !empty($row)) {
            $instance = $this->xpdo->call($this->class, '_loadInstance', array(& $this->xpdo, $this->class, $this->alias, $row));
            if ($instance === null) {
                $this->fetch();
            } else {
                $this->current = $instance;
            }
        } else {
            $this->current = null;
        }
    }
1194486
def fetchone(self):
        
        row = self._session.fetchone()
        if row:
            return self._row_factory(row)
1087371
private void loadAllInstances(ZooClassProxy def, boolean subClasses, 
			MergingIterator<ZooPC> iter, boolean loadFromCache) {
		for (Node n: nodes) {
			iter.add(n.loadAllInstances(def, loadFromCache));
		}
		
		if (subClasses) {
			for (ZooClassProxy sub: def.getSubProxies()) {
				loadAllInstances(sub, true, iter, loadFromCache);
			}
		}
	}
160703
private void loadFromClasspath() {
        URL url = null;
        try {
            // this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            if (loader == null) {
                loader = RenameHandler.class.getClassLoader();
            }
            if (LOG) {
                System.err.println("Loading from classpath: " + loader);
            }
            Enumeration<URL> en = loader.getResources("META-INF/org/joda/convert/Renamed.ini");
            while (en.hasMoreElements()) {
                url = en.nextElement();
                if (LOG) {
                    System.err.println("Loading file: " + url);
                }
                List<String> lines = loadRenameFile(url);
                parseRenameFile(lines, url);
            }
        } catch (Exception ex) {
            if (LOG) {
                ex.printStackTrace(System.err);
            }
            throw new IllegalStateException("Unable to load Renamed.ini: " + url + ": " + ex.getMessage(), ex);
        }
    }
734778
public static Object loadInstance(Class clazz, Object defaultValue) {
	try {
	    return clazz.newInstance();
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    return defaultValue;
	}
    }
330644
LoadClass getClassByID(long classObjectID) {
        long[] offset = new long[] { startOffset };

        while (offset[0] < endOffset) {
            long start = offset[0];
            long classID = readLoadClassID(offset);

            if (classID == classObjectID) {
                return new LoadClass(this, start);
            }
        }

        return null;
    }
1249280
public <TT> TT fetch(Class<TT> anotherClazz) {
        return r.query(anotherClazz).fetch(this);
    }
183167
def next(self):
        """"""
        # I'm pretty sure this is the completely wrong way to go about this, but
        # oh well, this works.
        if not hasattr(self, '_iter'):
            self._iter = self.readrow_as_dict()
        return self._iter.next()
1124139
@Override
  public boolean next() throws SFException
  {
    logger.debug("next called");

    List<Object> nextRowList;
    try
    {
      // call the fixed view next row method
      nextRowList = fixedView.getNextRow();
    }
    catch (Exception ex)
    {
      throw (SFException) IncidentUtil.generateIncidentV2WithException(
          session,
          new SFException(ErrorCode.INTERNAL_ERROR,
                          IncidentUtil.oneLiner("Error getting next row from " +
                                                "fixed view:", ex)),
          null,
          null);
    }

    row++;

    if (nextRowList == null)
    {
      logger.debug("end of result");
      return false;
    }

    if (nextRow == null)
    {
      nextRow = new Object[nextRowList.size()];
    }
    nextRow = nextRowList.toArray(nextRow);

    return true;
  }
9709
@Override
    public Object getObject() throws RemoteObjectInstanceException {
        Object object;

        ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

            @Override
            public ClassLoader run() {
                return Thread.currentThread().getContextClassLoader();
            }

        });

        try {
            Class<?> interfaceToNarrowTo = Class.forName(interfaceNameToNarrowTo, false, tccl);
            object = PortableRemoteObject.narrow(remoteObject, interfaceToNarrowTo);
        } catch (ClassNotFoundException ex) {
            throw new RemoteObjectInstanceException("Failed to find class " + interfaceNameToNarrowTo + " from classloader: " + tccl, ex);
        } catch (ClassCastException ex) {
            throw new RemoteObjectInstanceException("Unable to narrow remote object to " + interfaceNameToNarrowTo, ex);
        }

        return object;
    }
1194017
<T> Class<T> loadClass(String name) throws ClassNotFoundException {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        if (null == cl) {
            cl = ToHelper.class.getClassLoader();
        }
        return (Class<T>) cl.loadClass(name);
    }
875913
public Object next() {
        try {
            if (!_primed) {
                _primed = _rs.next();
                if (!_primed) {
                    throw new NoSuchElementException();
                }
            }
            // reset upon consumption
            _primed = false;
            return _rowMapper.mapRowToReturnType();
        } catch (SQLException e) {
            // Since Iterator interface is locked, all we can do
            // is put the real exception inside an expected one.
            NoSuchElementException xNoSuch = new NoSuchElementException("ResultSet exception: " + e);
            xNoSuch.initCause(e);
            throw xNoSuch;
        }
    }
65967
private QueryParameters readResultSetRow(int row) throws SQLException {
        int currentRow = getCurrentResultSet().getRow();
        QueryParameters result = null;

        if (currentRow == 0) {
            // before first or last
            if (getCurrentResultSet().isAfterLast() == true) {
                // positioning on last
                getCurrentResultSet().last();
            } else if (getCurrentResultSet().isBeforeFirst() == true) {
                // position on first
                getCurrentResultSet().first();
            } else {
                throw new MjdbcRuntimeException("ResultSet need to be repositioned to get row different than zero");
            }

            currentRow = getCurrentResultSet().getRow();
        }

        if (currentRow == row) {
            result = convertResultSetCurrentLine(getCurrentResultSet());
        }
        if (useRelativePositioning == true) {

            getCurrentResultSet().relative(row - currentRow);

            if (getCurrentResultSet().getRow() > 0) {
                result = convertResultSetCurrentLine(getCurrentResultSet());
            }
        } else if (currentRow < row) {
            while (getCurrentResultSet().next() == true) {
                if (getCurrentResultSet().getRow() == row) {
                    result = convertResultSetCurrentLine(getCurrentResultSet());
                }
            }
        } else {
            while (getCurrentResultSet().previous() == true) {
                if (getCurrentResultSet().getRow() == row) {
                    result = convertResultSetCurrentLine(getCurrentResultSet());
                }
            }
        }

        return result;
    }
532453
public MergingIterator<ZooPC> loadAllInstances(Class<?> cls, 
			boolean subClasses, boolean loadFromCache) {
		checkActiveRead();
		MergingIterator<ZooPC> iter = 
				new MergingIterator<ZooPC>(this, config.getFailOnClosedQueries());
        ZooClassDef def = cache.getSchema(cls, primary);
		loadAllInstances(def.getVersionProxy(), subClasses, iter, loadFromCache);
		if (loadFromCache) {
			//also add 'new' instances
			iter.add(cache.iterator(def, subClasses, ObjectState.PERSISTENT_NEW));
		}
		return iter;
	}
1166672
public function loadResult()
    {
        // Get the first row from the result set as an array.
        $row = $this->fetchArray();

        if ($row) {
            $row = $row[0];
        }

        // Free up system resources and return.
        $this->freeResult();

        return $row;
    }
625447
def fetchone(self):
        
        self._assert_valid_result_set()
        result = self.result_set.fetch_row()
        if len(result) == 0:
            return None
        else:
            return result
276389
public T fetchSingle() throws InstantiationException, IllegalAccessException, SQLException {
        if (!finished) {
            T result = primitive ? fetchSinglePrimitiveInternal() : fetchSingleInternal();
            next();
            return result;
        } else {
            throw new SQLException("Result set don't have data for single fetch.");
        }
    }