Exemple #1
0
 public void AddCheckedPost(string postId)
 {
     try
     {
         SQLCmd_AddCheckedPost.Parameters["@postID"].Value = postId;
         SQLCmd_AddCheckedPost.ExecuteNonQuery();
     }
     catch (SQLiteException ex) when(ex.ResultCode == SQLiteErrorCode.Constraint)
     {
         throw new InvalidOperationException($"the post {postId} already exists in the database");
     }
 }
Exemple #2
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    SQLCmd_AddBotComment.Dispose();
                    SQLCmd_AddCheckedComment.Dispose();
                    SQLCmd_DoesBotCommentExist.Dispose();
                    SQLCmd_GetBotComment.Dispose();
                    SQLCmd_HasCommentBeenChecked.Dispose();
                    SQLCmd_HasPostBeenChecked.Dispose();
                    SQLCmd_AddCheckedPost.Dispose();
                    SQLCmd_UpdateBotComment.Dispose();
                    dbConnection.Dispose();
                    // TODO: dispose managed state (managed objects).
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }