/////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// If the underlying database connection is open, fetches the number of changed rows /// resulting from the most recent query; otherwise, does nothing. /// </summary> /// <param name="changes"> /// The number of changes when true is returned. /// Undefined if false is returned. /// </param> /// <returns>Non-zero if the number of changed rows was fetched.</returns> internal bool TryGetChanges(ref int changes) { if ((_sql != null) && _sql.IsOpen()) { changes = _sql.Changes; return(true); } return(false); }
/// <summary> /// Internal collation sequence function, which wraps up the raw string pointers and executes the Compare() virtual function. /// WARNING: Must not throw exceptions. /// </summary> /// <param name="ptr">Not used</param> /// <param name="len1">Length of the string pv1</param> /// <param name="ptr1">Pointer to the first string to compare</param> /// <param name="len2">Length of the string pv2</param> /// <param name="ptr2">Pointer to the second string to compare</param> /// <returns>Returns -1 if the first string is less than the second. 0 if they are equal, or 1 if the first string is greater /// than the second. Returns 0 if an exception is caught.</returns> internal int CompareCallback(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2) { try { return(Compare(SQLiteConvert.UTF8ToString(ptr1, len1), SQLiteConvert.UTF8ToString(ptr2, len2))); /* throw */ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, String.Format(CultureInfo.CurrentCulture, "Caught exception in \"Compare\" (UTF8) method: {0}", e)); /* throw */ } } catch { // do nothing. } } // // NOTE: This must be done to prevent the core SQLite library from // using our (invalid) result. // if ((_base != null) && _base.IsOpen()) { _base.Cancel(); } return(0); }
/////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// If the underlying database connection is open, fetches the number of changed rows /// resulting from the most recent query; otherwise, does nothing. /// </summary> /// <param name="changes"> /// The number of changes when true is returned. /// Undefined if false is returned. /// </param> /// <param name="readOnly"> /// The read-only flag when true is returned. /// Undefined if false is returned. /// </param> /// <returns>Non-zero if the number of changed rows was fetched.</returns> internal bool TryGetChanges( ref int changes, ref bool readOnly ) { if ((_sql != null) && _sql.IsOpen()) { changes = _sql.Changes; readOnly = _sql.IsReadOnly(this); return(true); } return(false); }