예제 #1
0
 public NoSqlCommand(string sqlText, DbBase dbBase)
 {
     try
     {
         if (string.IsNullOrEmpty(sqlText))
         {
             return;
         }
         sourceSql = sqlText;
         ss        = SqlSyntax.Analyze(sqlText);
     }
     catch (Exception err)
     {
         Log.WriteLogToTxt(err);
     }
     if (ss.IsSelect || ss.IsUpdate || ss.IsDelete || ss.IsInsert)
     {
         MDataRow row = new MDataRow();
         if (TableSchema.FillTableSchema(ref row, ref dbBase, ss.TableName, ss.TableName))
         {
             row.Conn = dbBase.conn;
             action   = new NoSqlAction(ref row, ss.TableName, dbBase.Con.DataSource, dbBase.dalType);
         }
     }
     else
     {
         Log.WriteLogToTxt("NoSql Grammar Error Or No Support : " + sqlText);
     }
 }
예제 #2
0
 private static string GetBaseKey(AopInfo para, string tableName)
 {
     if (string.IsNullOrEmpty(tableName))
     {
         if (para.MAction != null)
         {
             foreach (MCellStruct ms in para.MAction.Data.Columns)
             {
                 if (!string.IsNullOrEmpty(ms.TableName))
                 {
                     tableName = ms.TableName;
                     break;
                 }
             }
             if (string.IsNullOrEmpty(tableName))
             {
                 if (para.TableName.Contains(" "))
                 {
                     tableName = "View_" + TableInfo.GetHashKey(para.TableName);
                 }
                 else
                 {
                     tableName = para.TableName;
                 }
                 //if (para.MAction.Data.Columns.isViewOwner)
                 //{
                 //    tableName = "ActionV" + Math.Abs(para.TableName.GetHashCode());
                 //}
             }
         }
         else
         {
             if (!para.IsProc)
             {
                 tableName = SqlSyntax.Analyze(para.ProcName).TableName;
             }
             else
             {
                 tableName = "Proc_" + para.ProcName;
             }
         }
     }
     return(GetBaseKey(tableName, para.ConnectionString));
 }