Exemplo n.º 1
0
        /// <summary>
        /// Advances the reader to the next record.
        /// </summary>
        /// <returns>true if there are more rows; otherwise, false.</returns>
        /// <exception cref="AceQL.Client.Api.AceQLException">If any Exception occurs.</exception>
        public bool Read()
        {
            TestIsClosed();

            if (DEBUG)
            {
                ConsoleEmul.WriteLine();
                ConsoleEmul.WriteLine("currentRowNum: " + currentRowNum);
                ConsoleEmul.WriteLine("rowCount     : " + rowsCount);
            }

            if (currentRowNum == rowsCount)
            {
                return(false);
            }

            try
            {
                currentRowNum++;
                rowParser.BuildRowNum(currentRowNum);

                valuesPerColIndex    = rowParser.GetValuesPerColIndex();
                colTypesPerColIndex  = rowParser.GetTypesPerColIndex();
                colIndexesPerColName = rowParser.GetColIndexesPerColName();

                // Build first time the Dic of (colIndex, colName) from Dic (colName, colIndex)
                if (currentRowNum == 1)
                {
                    foreach (KeyValuePair <String, int> theKeyPair in colIndexesPerColName)
                    {
                        colNamesPerColIndex.Add(theKeyPair.Value, theKeyPair.Key);
                    }
                }
            }
            catch (Exception exception)
            {
                throw new AceQLException("Error when reading.", 0, exception, (HttpStatusCode)200);
            }

            return(true);
        }