public NpgsqlParameter AddInParam(string name, bool isNullable, NpgsqlDbType dbType) { NpgsqlParameter p = NpgSqlCommandUtils.GetParam(name, isNullable, dbType, ParameterDirection.Input); this.cmd.Parameters.Add(p); return(p); }
public void AddNullInParam(string name, NpgsqlDbType dbType) { NpgsqlParameter p = NpgSqlCommandUtils.GetParam(name, true, dbType, ParameterDirection.Input); p.Value = DBNull.Value; this.cmd.Parameters.Add(p); }
public static NpgsqlCon Create(string connectionString, string schema) { try { if (string.IsNullOrEmpty(connectionString) || string.IsNullOrEmpty(schema)) { return(null); } if (!NpgSqlCommandUtils.TestConnection(connectionString)) { return(null); } } #pragma warning disable 0168 catch (Exception e) { return(null); } #pragma warning restore 0168 return(new NpgsqlCon(connectionString, schema)); }
public static void PrepareCommand(NpgsqlCommand cmd, NpgsqlParameterCollection cmdParms) { if (cmdParms != null) { bool hasRet = false; if (cmd.CommandType != CommandType.StoredProcedure) hasRet = true; NpgsqlParameter p2; foreach (NpgsqlParameter parm in cmdParms) { if (parm != null) { if (parm.Direction == ParameterDirection.ReturnValue) hasRet = true; p2 = parm.Clone(); cmd.Parameters.Add(p2); } } if (!hasRet) cmd.Parameters.Add(NpgSqlCommandUtils.GetParam("retVal", true, NpgsqlDbType.Integer, ParameterDirection.ReturnValue)); } }
public void AddOutParam(string name, bool isNullable, NpgsqlDbType dbType) { NpgsqlParameter p = NpgSqlCommandUtils.GetParam(name, isNullable, dbType, ParameterDirection.Output); this.cmd.Parameters.Add(p); }
public static NpgsqlParameter GetNullInParam(string name, NpgsqlDbType dbType) { NpgsqlParameter p = NpgSqlCommandUtils.GetParam(name, true, dbType, ParameterDirection.Input); p.Value = DBNull.Value; return p; }
public static NpgsqlParameter GetOutParam(string name, bool isNullable, NpgsqlDbType dbType) { return NpgSqlCommandUtils.GetParam(name, isNullable, dbType, ParameterDirection.Output); }