flags.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2018 PingCAP, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. package model
  14. // Flags are used by tipb.SelectRequest.Flags to handle execution mode, like how to handle truncate error.
  15. const (
  16. // FlagIgnoreTruncate indicates if truncate error should be ignored.
  17. // Read-only statements should ignore truncate error, write statements should not ignore truncate error.
  18. FlagIgnoreTruncate uint64 = 1
  19. // FlagTruncateAsWarning indicates if truncate error should be returned as warning.
  20. // This flag only matters if FlagIgnoreTruncate is not set, in strict sql mode, truncate error should
  21. // be returned as error, in non-strict sql mode, truncate error should be saved as warning.
  22. FlagTruncateAsWarning = 1 << 1
  23. // FlagPadCharToFullLength indicates if sql_mode 'PAD_CHAR_TO_FULL_LENGTH' is set.
  24. FlagPadCharToFullLength = 1 << 2
  25. // FlagInInsertStmt indicates if this is a INSERT statement.
  26. FlagInInsertStmt = 1 << 3
  27. // FlagInUpdateOrDeleteStmt indicates if this is a UPDATE statement or a DELETE statement.
  28. FlagInUpdateOrDeleteStmt = 1 << 4
  29. // FlagInSelectStmt indicates if this is a SELECT statement.
  30. FlagInSelectStmt = 1 << 5
  31. // FlagOverflowAsWarning indicates if overflow error should be returned as warning.
  32. // In strict sql mode, overflow error should be returned as error,
  33. // in non-strict sql mode, overflow error should be saved as warning.
  34. FlagOverflowAsWarning = 1 << 6
  35. // FlagIgnoreZeroInDate indicates if ZeroInDate error should be ignored.
  36. // Read-only statements should ignore ZeroInDate error.
  37. // Write statements should not ignore ZeroInDate error in strict sql mode.
  38. FlagIgnoreZeroInDate = 1 << 7
  39. // FlagDividedByZeroAsWarning indicates if DividedByZero should be returned as warning.
  40. FlagDividedByZeroAsWarning = 1 << 8
  41. // FlagInSetOprStmt indicates if this is a UNION/EXCEPT/INTERSECT statement.
  42. FlagInSetOprStmt = 1 << 9
  43. // FlagInLoadDataStmt indicates if this is a LOAD DATA statement.
  44. FlagInLoadDataStmt = 1 << 10
  45. )