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?)
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)
Parameters
query
stringQuery text.
timeout
TimeSpan?Timeout.
schema
stringSchema.
pageSize
int?Page size.
properties
IReadOnlyDictionary<string, object>Properties.
timeZoneId
stringTime zone id in TZDB format. Examples:
Affects time-related SQL functions (e.g."America/New_York"
,"UTC+3"
.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).
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
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.
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"
.
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
query
stringQuery 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
query
stringQuery string.
Returns
- SqlStatement
Statement.