Example #1
0
        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);
        }
Example #2
0
        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 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));
     }
 }
Example #4
0
        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);
 }