Query.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Newtonsoft.Json;
  2. namespace InABox.DatabaseProxy
  3. {
  4. public class Credentials
  5. {
  6. private static readonly string cacheToken = Guid.NewGuid().ToString().Replace("-", "");
  7. public string CacheToken => cacheToken;
  8. public string UserID { get; set; }
  9. public string Password { get; set; }
  10. }
  11. public class Request
  12. {
  13. public Request()
  14. {
  15. Credentials = new Credentials();
  16. }
  17. public Credentials Credentials { get; set; }
  18. public string Database { get; set; }
  19. public string SQL { get; set; }
  20. public string AsJSON()
  21. {
  22. return JsonConvert.SerializeObject(this);
  23. }
  24. ~Request()
  25. {
  26. Credentials = null;
  27. }
  28. public override string ToString()
  29. {
  30. return SQL;
  31. }
  32. }
  33. public class Response
  34. {
  35. public Response()
  36. {
  37. Status = "INCOMPLETE";
  38. Data = new List<List<object>>();
  39. }
  40. public string Status { get; set; }
  41. public List<List<object>> Data { get; private set; }
  42. ~Response()
  43. {
  44. Data = null;
  45. }
  46. }
  47. }