You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8 KiB

  1. using Apewer;
  2. using System;
  3. namespace Apewer.Source
  4. {
  5. /// <summary>数据库引擎的执行结果。</summary>
  6. public class Execute : IExecute
  7. {
  8. private bool _success = false;
  9. private int _rows = 0;
  10. private string _error = "";
  11. private string _message = "";
  12. private Exception _exception = new Exception();
  13. /// <summary>语句执行成功。</summary>
  14. public bool Success
  15. {
  16. get { return _success; }
  17. set { _success = value; }
  18. }
  19. /// <summary>执行失败时的异常。</summary>
  20. public Exception Exception
  21. {
  22. get { return _exception; }
  23. set { _exception = value; }
  24. }
  25. /// <summary>受影响的行数。</summary>
  26. public int Rows
  27. {
  28. get { return _rows; }
  29. set { _rows = value; }
  30. }
  31. /// <summary>错误信息。</summary>
  32. public string Error
  33. {
  34. get
  35. {
  36. if (!string.IsNullOrEmpty(_error))
  37. {
  38. return _error;
  39. }
  40. else
  41. {
  42. if (_exception != null)
  43. {
  44. try
  45. {
  46. return _exception.Message;
  47. }
  48. catch
  49. {
  50. return _exception.GetType().FullName;
  51. }
  52. }
  53. }
  54. return "";
  55. }
  56. set { _error = value ?? ""; }
  57. }
  58. /// <summary>消息。</summary>
  59. public string Message
  60. {
  61. get { return _message ?? ""; }
  62. set { _message = value ?? ""; }
  63. }
  64. }
  65. }