Ejemplo n.º 1
0
 /// <summary>
 /// 结构是否存在自增长字段id
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 internal bool HasAutoIncrementID(Type t)
 {
     try
     {
         string    cmdStr = SqliteTabelCmdStrTool.GetAutoIncrement(t);
         DataTable dt     = OperateQuery(cmdStr);
         return(dt.Rows[0][0].ToString().Contains("INTEGER PRIMARY KEY AUTOINCREMENT"));
     }
     catch (SqliteException e)
     {
         LogOperator.AddWarnningRecord("执行查询结构是否存在自增长字段id时异常", e.Message);
         return(false);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 是否有主键id
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 internal bool HasIdPK(Type t)
 {
     try
     {
         string    cmdStr = SqliteTabelCmdStrTool.GetAutoIncrement(t);
         DataTable dt     = OperateQuery(cmdStr);
         if (dt.Rows.Count > 0 && dt.Columns.Count > 0)
         {
             return(dt.Rows[0][0].ToString().ToUpper().Contains("ID INTEGER PRIMARY KEY"));
         }
         {
             return(false);
         }
     }
     catch (SqliteException e)
     {
         LogOperator.AddWarnningRecord("执行查询结构是否存在自增长字段id时异常", e.Message);
         return(false);
     }
 }