You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parses a SQL query with enhanced error reporting that includes detailed location information for parse errors. Returns a Promise for either the parse tree or detailed error information.
163
-
164
-
```typescript
165
-
import { parseQueryDetailed } from'libpg-query';
166
-
167
-
try {
168
-
const result =awaitparseQueryDetailed('SELECT * FROM users WHERE');
169
-
} catch (error) {
170
-
// Enhanced error with line number, position, and context information
171
-
console.log(error.message); // "Parse error: syntax error at end of input at line 1, position 26"
const result =parseQueryDetailedSync('SELECT * FROM users WHERE active = true');
183
-
// Returns: DetailedParseResult with enhanced error information if parsing fails
184
-
```
185
-
186
160
### Initialization
187
161
188
162
The library provides both async and sync methods. Async methods handle initialization automatically, while sync methods require explicit initialization.
0 commit comments