aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <>2022-02-05 23:11:19 +0000
committerdrh <>2022-02-05 23:11:19 +0000
commit4f77c9208a6d9099aafd3406faebdf2b259a35f0 (patch)
tree44ff6938656d7eab62a79d1ce75cf5f8aa372a65 /src/printf.c
parent796588ae07590acbd57fcd1509aa4c9706149a7d (diff)
downloadsqlite-4f77c9208a6d9099aafd3406faebdf2b259a35f0.tar.gz
sqlite-4f77c9208a6d9099aafd3406faebdf2b259a35f0.zip
Enhance sqlite3_error_offset() to report the position of unresolved
identifiers. FossilOrigin-Name: 5b8d2577907abda10de29884716bacc10bff0df1451228a0ac40342dbea6d589
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c
index 9fea2d6ef..a8cfc1931 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -935,6 +935,19 @@ void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
}
/*
+** If pExpr has a byte offset for the start of a token, record that as
+** as the error offset.
+*/
+void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){
+ if( db->errByteOffset>=0 ) return;
+ while( pExpr && (ExprHasProperty(pExpr,EP_FromJoin) || pExpr->w.iOfst<=0) ){
+ pExpr = pExpr->pLeft;
+ }
+ if( pExpr==0 ) return;
+ db->errByteOffset = pExpr->w.iOfst;
+}
+
+/*
** Enlarge the memory allocation on a StrAccum object so that it is
** able to accept at least N more bytes of text.
**