Class SqlStatement
SQL statement.
public sealed record SqlStatement : IEquatable<SqlStatement>
- Inheritance
-
SqlStatement
- Implements
- Inherited Members
Constructors
SqlStatement(string, TimeSpan?, string?, int?, IReadOnlyDictionary<string, object?>?, string?, long?)
Initializes a new instance of the SqlStatement class.
public SqlStatement(string query, TimeSpan? timeout = null, string? schema = null, int? pageSize = null, IReadOnlyDictionary<string, object?>? properties = null, string? timeZoneId = null, long? memoryQuotaBlockSize = null)
Parameters
querystringQuery text.
timeoutTimeSpan?Timeout.
schemastringSchema.
pageSizeint?Page size.
propertiesIReadOnlyDictionary<string, object>Properties.
timeZoneIdstringTime zone id in TZDB format. Examples:
"America/New_York","UTC+3".Affects time-related SQL functions (e.g.
CURRENT_TIME) and string literal conversions (e.g.TIMESTAMP WITH LOCAL TIME ZONE '1992-01-18 02:30:00.123').Defaults to system time zone: Tzdb.GetSystemDefault().Id.
Can be obtained using NodaTime with Id from Tzdb provider.
Note that Id from the standard library is OS-dependent and is not compatible with TZDB on Windows.
For more information, see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html#of(java.lang.String).
memoryQuotaBlockSizelong?Memory quota block size in bytes.
nullto use the system default.
Fields
DefaultPageSize
Default number of rows per data page.
public const int DefaultPageSize = 1024
Field Value
DefaultSchema
Default SQL schema name.
public const string DefaultSchema = "PUBLIC"
Field Value
DefaultTimeout
Default query timeout (zero means no timeout).
public static readonly TimeSpan DefaultTimeout
Field Value
Properties
MemoryQuotaBlockSize
Gets the memory quota block size in bytes. Limits the amount of memory a single SQL query can allocate in one block.
null to use the system default.
public long? MemoryQuotaBlockSize { get; init; }
Property Value
- long?
PageSize
Gets the number of rows per data page.
public int PageSize { get; init; }
Property Value
Properties
Gets the property bag.
public IReadOnlyDictionary<string, object?> Properties { get; init; }
Property Value
Query
Gets the query text.
[StringSyntax("Sql")]
public string Query { get; init; }
Property Value
Schema
Gets the SQL schema name.
public string Schema { get; init; }
Property Value
TimeZoneId
Gets the time zone id in TZDB format.
Examples: "America/New_York", "UTC+3".
Affects time-related SQL functions (e.g. CURRENT_TIME)
and string literal conversions (e.g. TIMESTAMP WITH LOCAL TIME ZONE '1992-01-18 02:30:00.123').
Defaults to system time zone: Tzdb.GetSystemDefault().Id.
Can be obtained using NodaTime with Id from Tzdb provider.
Note that Id from the standard library is OS-dependent and is not compatible with TZDB on Windows.
For more information, see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html#of(java.lang.String).
public string TimeZoneId { get; init; }
Property Value
Timeout
Gets the query timeout (zero means no timeout).
public TimeSpan Timeout { get; init; }
Property Value
Methods
ToSqlStatement(string)
Converts a query string to an instance of SqlStatement.
public static SqlStatement ToSqlStatement(string query)
Parameters
querystringQuery string.
Returns
- SqlStatement
Statement.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
implicit operator SqlStatement(string)
Converts a query string to an instance of SqlStatement.
public static implicit operator SqlStatement(string query)
Parameters
querystringQuery string.
Returns
- SqlStatement
Statement.