Example #1
0
        public static void update(ref FileInf m)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update up7_files set");
            sql.Append(" f_pathSvr=@f_pathSvr");
            sql.Append(",f_pathRel=@f_pathRel");
            sql.Append(",f_md5=@f_md5");
            sql.Append(",f_lenLoc=@f_lenLoc");
            sql.Append(",f_sizeLoc=@f_sizeLoc");
            sql.Append(",f_blockCount=@f_blockCount");
            sql.Append(",f_blockSize=@f_blockSize");
            sql.Append(",f_blockPath=@f_blockPath");
            sql.Append(",f_lenSvr=@f_lenSvr");
            sql.Append(",f_pid=@f_pid");
            sql.Append(",f_perSvr=@f_perSvr");
            sql.Append(",f_deleted=@f_deleted");
            sql.Append(",f_pidRoot=@f_pidRoot");
            sql.Append(",f_fdTask=@f_fdTask");
            sql.Append(",f_fdChild=@f_fdChild");
            sql.Append(",f_uid=@f_uid");
            sql.Append(",f_nameLoc=@f_nameLoc");
            sql.Append(",f_nameSvr=@f_nameSvr");
            sql.Append(",f_pathLoc=@f_pathLoc");
            sql.Append(" where f_id=@f_id ");

            DbHelper db  = new DbHelper();
            var      cmd = db.GetCommand(sql.ToString());

            db.AddString(ref cmd, "@f_pathSvr", m.pathSvr, 512);
            db.AddString(ref cmd, "@f_pathRel", m.pathRel, 512);
            db.AddString(ref cmd, "@f_md5", m.md5, 40);
            db.AddInt64(ref cmd, "@f_lenLoc", m.lenLoc);
            db.AddString(ref cmd, "@f_sizeLoc", m.sizeLoc, 15);
            db.AddInt(ref cmd, "@f_blockCount", m.blockCount);
            db.AddInt(ref cmd, "@f_blockSize", m.blockSize);
            db.AddString(ref cmd, "@f_blockPath", m.blockPath, 2000);
            db.AddInt64(ref cmd, "@f_lenSvr", m.lenSvr);
            db.AddString(ref cmd, "@f_pid", m.pid, 32);
            db.AddString(ref cmd, "@f_perSvr", m.perSvr, 6);
            db.AddBool(ref cmd, "@f_deleted", m.deleted);
            db.AddString(ref cmd, "@f_pidRoot", m.pidRoot, 32);
            db.AddBool(ref cmd, "@f_fdTask", m.fdTask);
            db.AddBool(ref cmd, "@f_fdChild", m.f_fdChild);
            db.AddInt(ref cmd, "@f_uid", m.uid);
            db.AddString(ref cmd, "@f_nameLoc", m.nameLoc, 255);
            db.AddString(ref cmd, "@f_nameSvr", m.nameSvr, 255);
            db.AddString(ref cmd, "@f_pathLoc", m.pathLoc, 512);
            db.AddString(ref cmd, "@f_id", m.id, 32);
            db.ExecuteNonQuery(ref cmd);
        }
Example #2
0
        /// <summary>
        /// 添加一条数据
        /// </summary>
        public static void add(ref FileInf f)
        {
            string sql = @"
                insert into up7_files(
                 f_id
                ,f_fdTask
                ,f_uid
                ,f_nameLoc
                ,f_nameSvr
                ,f_pathLoc
                ,f_pathSvr
                ,f_pathRel
                ,f_blockCount
                ,f_blockSize
                ,f_blockPath
                ,f_lenLoc
                ,f_sizeLoc
                ) values (
                 @f_id
                ,@f_fdTask
                ,@f_uid
                ,@f_nameLoc
                ,@f_nameSvr
                ,@f_pathLoc
                ,@f_pathSvr
                ,@f_pathRel
                ,@f_blockCount
                ,@f_blockSize
                ,@f_blockPath
                ,@f_lenLoc
                ,@f_sizeLoc
                ) ";

            DbHelper  db  = new DbHelper();
            DbCommand cmd = db.GetCommand(sql);

            db.AddString(ref cmd, "@f_id", f.id, 36);
            db.AddBool(ref cmd, "@f_fdTask", f.fdTask);
            db.AddInt(ref cmd, "@f_uid", f.uid);
            db.AddString(ref cmd, "@f_nameLoc", f.nameLoc, 255);
            db.AddString(ref cmd, "@f_nameSvr", f.nameSvr, 255);
            db.AddString(ref cmd, "@f_pathLoc", f.pathLoc, 512);
            db.AddString(ref cmd, "@f_pathSvr", f.pathSvr, 512);
            db.AddString(ref cmd, "@f_pathRel", f.pathRel, 512);
            db.AddInt(ref cmd, "@f_blockCount", f.blockCount);
            db.AddInt(ref cmd, "@f_blockSize", f.blockSize);
            db.AddString(ref cmd, "@f_blockPath", f.blockPath, 512);
            db.AddInt64(ref cmd, "@f_lenLoc", f.lenLoc);
            db.AddString(ref cmd, "@f_sizeLoc", f.sizeLoc, 15);

            db.ExecuteNonQuery(cmd);
        }