SQLite

Check-in [02f694d5ba]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modify the new functions to make them return a standard return code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | get-trace
Files: files | file ages | folders
SHA1: 02f694d5babe5fc03a4fcec001e3d878fa58f2c8
User & Date: mistachkin 2015-05-12 23:20:23.636
Context
2015-05-12
23:28
Improve API armor integration. Fix harmless compiler warnings. (check-in: fbf29b453f user: mistachkin tags: get-trace)
23:20
Modify the new functions to make them return a standard return code. (check-in: 02f694d5ba user: mistachkin tags: get-trace)
21:27
Experimental API extension for recovering the current trace and profile callbacks on a database connection. (check-in: 9de33768ff user: drh tags: get-trace)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780

1781
1782
1783
1784
1785
1786
1787
  db->pTraceArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
/*
** Return the curren trace function and argument.
*/
void sqlite3_get_trace(
  const sqlite3 *db,
  void (**pxTrace)(void*,const char*),
  void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) ){
    (void)SQLITE_MISUSE_BKPT;
    return 0;
  }
#endif
  *pxTrace = db->xTrace;
  *ppArg = db->pTraceArg;

}
/*
** Register a profile function.  The pArg from the previously registered 
** profile function is returned.  
**
** A NULL profile function means that no profiling is executes.  A non-NULL
** profile is a pointer to a function that is invoked at the conclusion of







|






|
<




>







1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775

1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
  db->pTraceArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
/*
** Return the curren trace function and argument.
*/
int sqlite3_get_trace(
  const sqlite3 *db,
  void (**pxTrace)(void*,const char*),
  void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE_BKPT;

  }
#endif
  *pxTrace = db->xTrace;
  *ppArg = db->pTraceArg;
  return SQLITE_OK;
}
/*
** Register a profile function.  The pArg from the previously registered 
** profile function is returned.  
**
** A NULL profile function means that no profiling is executes.  A non-NULL
** profile is a pointer to a function that is invoked at the conclusion of
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825

1826
1827
1828
1829
1830
1831
1832
  db->pProfileArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
/*
** Return the curren trace function and argument.
*/
void sqlite3_get_profile(
  const sqlite3 *db,
  void (**pxProfile)(void*,const char*,sqlite3_uint64),
  void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) ){
    (void)SQLITE_MISUSE_BKPT;
    return 0;
  }
#endif
  *pxProfile = db->xProfile;
  *ppArg = db->pProfileArg;

}
#endif /* SQLITE_OMIT_TRACE */

/*
** Register a function to be invoked when a transaction commits.
** If the invoked function returns non-zero, then the commit becomes a
** rollback.







|






|
<




>







1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820

1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
  db->pProfileArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
/*
** Return the curren trace function and argument.
*/
int sqlite3_get_profile(
  const sqlite3 *db,
  void (**pxProfile)(void*,const char*,sqlite3_uint64),
  void **ppArg
){
#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE_BKPT;

  }
#endif
  *pxProfile = db->xProfile;
  *ppArg = db->pProfileArg;
  return SQLITE_OK;
}
#endif /* SQLITE_OMIT_TRACE */

/*
** Register a function to be invoked when a transaction commits.
** If the invoked function returns non-zero, then the commit becomes a
** rollback.
Changes to src/sqlite.h.in.
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
**
** All of the tracing and profile interfaces are omitted when the
** [SQLITE_OMIT_TRACE] compile-time option is used.
*/
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
void sqlite3_get_trace(const sqlite3*, void(**)(void*,const char*),void**);
void sqlite3_get_profile(const sqlite3*,
   void(**)(void*,const char*,sqlite3_uint64),void**);

/*
** CAPI3REF: Query Progress Callbacks
** METHOD: sqlite3
**
** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback







|
|







2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
**
** All of the tracing and profile interfaces are omitted when the
** [SQLITE_OMIT_TRACE] compile-time option is used.
*/
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
int sqlite3_get_trace(const sqlite3*, void(**)(void*,const char*),void**);
int sqlite3_get_profile(const sqlite3*,
   void(**)(void*,const char*,sqlite3_uint64),void**);

/*
** CAPI3REF: Query Progress Callbacks
** METHOD: sqlite3
**
** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback