/// <summary> /// Creates a stored procedure statement. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="procedureName">Procedure name.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> public PhpSqlDbProcedure(PhpDbConnection/*!*/ connection, string/*!*/ procedureName) : base("mssql statement", connection) { if (procedureName == null) throw new ArgumentNullException("procedureName"); this.procedureName = procedureName; }
/// <summary> /// Creates a stored procedure statement. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="procedureName">Procedure name.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> public PhpSqlDbProcedure(PhpDbConnection /*!*/ connection, string /*!*/ procedureName) : base("mssql statement", connection) { if (procedureName == null) { throw new ArgumentNullException("procedureName"); } this.procedureName = procedureName; }
/// <summary> /// Creates an instance of parameterized statement. /// </summary> /// <param name="resourceName">Name of the resource.</param> /// <param name="connection">Database connection resource.</param> public PhpDbStatement(string /*!*/ resourceName, PhpDbConnection /*!*/ connection) : base(resourceName) { if (connection == null) { throw new ArgumentNullException("connection"); } this.connection = connection; }
public static int GetLastAffectedRows() { PhpDbConnection last_connection = GetManager().GetLastConnection(); if (last_connection == null) { last_connection = (PhpDbConnection)Connect(); } return(GetLastAffectedRows(last_connection)); }
public static PhpResource Query(string query) { PhpDbConnection last_connection = GetManager().GetLastConnection(); if (last_connection == null) { last_connection = (PhpDbConnection)Connect(); } return(Query(query, last_connection)); }
public static PhpResource CreateProcedure(string procedureName) { PhpDbConnection last_connection = GetManager().GetLastConnection(); if (last_connection == null) { last_connection = (PhpDbConnection)Connect(); } return(CreateProcedure(procedureName, last_connection)); }
/// <summary> /// Removes specified connection from the list of active connections. /// </summary> /// <param name="connection">The connection to be removed.</param> public void RemoveConnection(PhpDbConnection /*!*/ connection) { if (connection == null) { throw new ArgumentNullException("connection"); } if (connections.Count > 0) { connections.Remove(connection); Interlocked.Decrement(ref AppConnectionCount); } }
public static bool SelectDb(string databaseName) { PhpDbConnection last_connection = GetManager().GetLastConnection(); if (last_connection == null) { last_connection = (PhpDbConnection)Connect(); if (last_connection == null) { return(false); } } return(SelectDb(databaseName, last_connection)); }
public static bool Close() { PhpDbConnection last_connection = manager.GetLastConnection(); if (last_connection == null) { return(false); } manager.RemoveConnection(last_connection); last_connection.Close(); last_connection = null; return(true); }
/// <summary> /// Creates an instance of a result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader from which to load results.</param> /// <param name="name">Resource name.</param> /// <param name="convertTypes">Whether to convert resulting values to PHP types.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> protected PhpDbResult(PhpDbConnection /*!*/ connection, IDataReader /*!*/ reader, string /*!*/ name, bool convertTypes) : base(name) { if (connection == null) { throw new ArgumentNullException("connection"); } if (reader == null) { throw new ArgumentNullException("reader"); } this.reader = reader; this.connection = connection; LoadData(convertTypes); }
/// <summary> /// Creates an instance of a result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader from which to load results.</param> /// <param name="convertTypes">Whether to convert resulting values to PHP types.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> public PhpMyDbResult(PhpDbConnection/*!*/ connection, IDataReader/*!*/ reader, bool convertTypes) : base(connection, reader, "MySQL result", convertTypes) { // no code in here }
internal void ReleaseConnection() { this.connection = null; }
/// <summary> /// Gets a query result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader to be used for result resource population.</param> /// <param name="convertTypes">Whether to convert data types to PHP ones.</param> /// <returns>Result resource holding all resulting data of the query.</returns> protected override PhpDbResult/*!*/ GetResult(PhpDbConnection/*!*/ connection, IDataReader/*!*/ reader, bool convertTypes) { return new PhpSqlDbResult(connection, reader, convertTypes); }
/// <summary> /// Removes specified connection from the list of active connections. /// </summary> /// <param name="connection">The connection to be removed.</param> public void RemoveConnection(PhpDbConnection/*!*/ connection) { if (connection == null) throw new ArgumentNullException("connection"); if (connections.Count > 0) { connections.Remove(connection); Interlocked.Decrement(ref AppConnectionCount); } }
//public new PhpMyDbConnection Connection => (PhpMyDbConnection)base.Connection; /// <summary> /// Creates an instance of a result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader from which to load results.</param> /// <param name="convertTypes">Whether to convert resulting values to PHP types.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> public PhpMyDbResult(PhpDbConnection /*!*/ connection, IDataReader /*!*/ reader, bool convertTypes) : base(connection, reader, "MySQL result", convertTypes) { // no code in here }
/// <summary> /// Creates an instance of parameterized statement. /// </summary> /// <param name="resourceName">Name of the resource.</param> /// <param name="connection">Database connection resource.</param> public PhpDbStatement(string/*!*/ resourceName, PhpDbConnection/*!*/ connection) : base(resourceName) { if (connection == null) throw new ArgumentNullException("connection"); this.connection = connection; }
/// <summary> /// Creates an instance of a result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader from which to load results.</param> /// <param name="name">Resource name.</param> /// <param name="convertTypes">Whether to convert resulting values to PHP types.</param> /// <exception cref="ArgumentNullException">Argument is a <B>null</B> reference.</exception> protected PhpDbResult(PhpDbConnection/*!*/ connection, IDataReader/*!*/ reader, string/*!*/ name, bool convertTypes) : base(name) { if (connection == null) throw new ArgumentNullException("connection"); if (reader == null) throw new ArgumentNullException("reader"); this.reader = reader; this.connection = connection; LoadData(convertTypes); }
protected override PhpDbResult GetResult(PhpDbConnection connection, IDataReader reader, bool convertTypes) { throw new NotImplementedException(); }
/// <summary> /// Gets a query result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader to be used for result resource population.</param> /// <param name="convertTypes">Whether to convert data types to PHP ones.</param> /// <returns>Result resource holding all resulting data of the query.</returns> protected abstract PhpDbResult GetResult(PhpDbConnection/*!*/ connection, IDataReader/*!*/ reader, bool convertTypes);
/// <summary> /// Gets a query result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader to be used for result resource population.</param> /// <param name="convertTypes">Whether to convert data types to PHP ones.</param> /// <returns>Result resource holding all resulting data of the query.</returns> protected override PhpDbResult /*!*/ GetResult(PhpDbConnection /*!*/ connection, IDataReader /*!*/ reader, bool convertTypes) { return(new PhpSqlDbResult(connection, reader, convertTypes)); }
/// <summary> /// Gets a query result resource. /// </summary> /// <param name="connection">Database connection.</param> /// <param name="reader">Data reader to be used for result resource population.</param> /// <param name="convertTypes">Whether to convert data types to PHP ones.</param> /// <returns>Result resource holding all resulting data of the query.</returns> protected abstract PhpDbResult GetResult(PhpDbConnection /*!*/ connection, IDataReader /*!*/ reader, bool convertTypes);