forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlStatement.cs
More file actions
71 lines (62 loc) · 2.47 KB
/
NpgsqlStatement.cs
File metadata and controls
71 lines (62 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Npgsql.BackendMessages;
namespace Npgsql
{
/// <summary>
/// Represents a single SQL statement within Npgsql.
///
/// Instances aren't constructed directly; users should construct an <see cref="NpgsqlCommand"/>
/// object and populate its <see cref="NpgsqlCommand.CommandText"/> property as in standard ADO.NET.
/// Npgsql will analyze that property and constructed instances of <see cref="NpgsqlStatement"/>
/// internally.
///
/// Users can retrieve instances from <see cref="NpgsqlDataReader.Statements"/>
/// and access information about statement execution (e.g. affected rows).
/// </summary>
public class NpgsqlStatement
{
internal NpgsqlStatement(string sql, List<NpgsqlParameter> inputParameters, string preparedStatementName = null)
{
SQL = sql;
InputParameters = inputParameters;
PreparedStatementName = preparedStatementName;
}
/// <summary>
/// The SQL text of the statement.
/// </summary>
public string SQL { get; }
/// <summary>
/// Specifies the type of query, e.g. SELECT.
/// </summary>
public StatementType StatementType { get; internal set; }
/// <summary>
/// The number of rows affected or retrieved.
/// </summary>
/// <remarks>
/// See the command tag in the CommandComplete message,
/// http://www.postgresql.org/docs/current/static/protocol-message-formats.html
/// </remarks>
public uint Rows { get; internal set; }
/// <summary>
/// For an INSERT, the object ID of the inserted row if <see cref="Rows"/> is 1 and
/// the target table has OIDs; otherwise 0.
/// </summary>
public uint OID { get; internal set; }
internal readonly List<NpgsqlParameter> InputParameters;
/// <summary>
/// The RowDescription message for this query. If null, the query does not return rows (e.g. INSERT)
/// </summary>
internal RowDescriptionMessage Description;
/// <summary>
/// For prepared statements, holds the server-side prepared statement name.
/// </summary>
internal string PreparedStatementName;
/// <summary>
/// Returns the SQL text of the statement.
/// </summary>
public override string ToString() { return SQL; }
}
}