public void NullSafeSet(IDbCommand cmd, object value, int index) { string cmdText = cmd.CommandText; int s = cmdText.IndexOf(DbFunc + '('); if (s < 0) { if (cmdText.StartsWith("INSERT")) { cmdText = cmdText.Replace(", ROWID", ""); cmdText = cmdText.Replace( string.Format(":p{0}, :p{1}", index, index + 1), string.Format("{0}(:p{1}, :p{2})", DbFunc, index, index + 1)); } else //update { cmdText = cmdText.Replace( string.Format(":p{0}, ROWID = :p{1}", index, index + 1), string.Format("{0}(:p{1}, :p{2})", DbFunc, index, index + 1)); } cmd.CommandText = cmdText; } if (value == null) { ((IDataParameter)cmd.Parameters[index]).Value = DBNull.Value; ((IDataParameter)cmd.Parameters[index + 1]).Value = DBNull.Value; } else { BFileType bf = value as BFileType; ((IDataParameter)cmd.Parameters[index]).Value = bf.DirName; ((IDataParameter)cmd.Parameters[index + 1]).Value = bf.FileName; } }
public object NullSafeGet(IDataReader rs, string[] names, object owner) { byte[] bin = (byte[])NHibernateUtil.BinaryBlob.NullSafeGet(rs, names[0]); if (bin != null) { BFileType bf = new BFileType(); bf.Binary = bin; return(bf); } return(null); }
public object DeepCopy(object value) { if (value == null) { return(null); } BFileType valueBFile = (BFileType)value; return(new BFileType( valueBFile.DirName, valueBFile.FileName, valueBFile.Binary)); }
public object NullSafeGet(IDataReader rs, string[] names, object owner) { byte[] bin = (byte[]) NHibernateUtil.BinaryBlob.NullSafeGet(rs, names[0]); if (bin != null) { BFileType bf = new BFileType(); bf.Binary = bin; return bf; } return null; }