Skip to content

Commit

Permalink
position reset on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
mShan0 committed Jul 15, 2022
1 parent a9abf2f commit 9687fd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/token/colmetadata-token-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ function readColumnName(parser: Parser, options: ParserOptions, index: number, m

function readColumn(parser: Parser, options: ParserOptions, index: number, callback: (column: ColumnMetadata) => void) {
let metadata!: Metadata;
const offset = parser.position;
try {
metadata = metadataParse(parser, options);
} catch (err) {
if (err instanceof NotEnoughDataError) {
return parser.suspend(() => {
parser.position = offset;
readColumn(parser, options, index, callback);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/token/returnvalue-token-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function returnParser(parser: Parser, options: ParserOptions, callback: (token:

function readValue(parser: Parser, options: ParserOptions, paramOrdinal: number, paramName: string, originalPosition: number, callback: (token: ReturnValueToken) => void) {
let metadata!: Metadata;
parser.position = originalPosition;
try {
metadata = metadataParse(parser, options);
} catch (err) {
Expand Down

0 comments on commit 9687fd7

Please sign in to comment.