using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Npgsql.BackendMessages;
namespace Npgsql
{
///
/// Represents a single SQL statement within Npgsql.
///
/// Instances aren't constructed directly; users should construct an
/// object and populate its property as in standard ADO.NET.
/// Npgsql will analyze that property and constructed instances of
/// internally.
///
/// Users can retrieve instances from
/// and access information about statement execution (e.g. affected rows).
///
public class NpgsqlStatement
{
internal NpgsqlStatement(string sql, List inputParameters, string preparedStatementName = null)
{
SQL = sql;
InputParameters = inputParameters;
PreparedStatementName = preparedStatementName;
}
///
/// The SQL text of the statement.
///
public string SQL { get; private set; }
///
/// Specifies the type of query, e.g. SELECT.
///
public StatementType StatementType { get; internal set; }
///
/// The number of rows affected or retrieved.
///
///
/// See the command tag in the CommandComplete message,
/// http://www.postgresql.org/docs/current/static/protocol-message-formats.html
///
public uint Rows { get; internal set; }
///
/// For an INSERT, the object ID of the inserted row if is 1 and
/// the target table has OIDs; otherwise 0.
///
public uint OID { get; internal set; }
internal readonly List InputParameters;
///
/// The RowDescription message for this query. If null, the query does not return rows (e.g. INSERT)
///
internal RowDescriptionMessage Description;
///
/// For prepared statements, holds the server-side prepared statement name.
///
internal string PreparedStatementName;
///
/// Returns the SQL text of the statement.
///
public override string ToString() { return SQL; }
}
}