connection-flags.vala 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace InvercargillSql {
  2. /**
  3. * Flags for controlling database connection behavior.
  4. *
  5. * These flags are database-agnostic and map to appropriate backend-specific
  6. * values internally.
  7. *
  8. * Example usage:
  9. * ```vala
  10. * var conn = ConnectionFactory.create_and_open("sqlite:///mydb.db");
  11. *
  12. * // For read-only access, use connection string options:
  13. * var conn = ConnectionFactory.create_and_open("sqlite:///mydb.db?mode=ro");
  14. * ```
  15. */
  16. [Flags]
  17. public enum ConnectionFlags {
  18. /**
  19. * Open the database for reading only.
  20. */
  21. READ_ONLY = 1 << 0,
  22. /**
  23. * Open the database for reading and writing.
  24. */
  25. READ_WRITE = 1 << 1,
  26. /**
  27. * Create the database if it does not exist.
  28. */
  29. CREATE = 1 << 2,
  30. /**
  31. * Open an in-memory database.
  32. */
  33. MEMORY = 1 << 3,
  34. /**
  35. * Default flags: read-write with create.
  36. */
  37. DEFAULT = READ_WRITE | CREATE
  38. }
  39. }