Ejemplo n.º 1
0
        protected PXSqlMeta(SqlDbConfig config, InfoForDbConnection selectedDbInfo, Instancemodus aModus, bool constructedFromPxs)
        {
            log.Info("PXSqlMeta  this.mCNMMVersion = " + config.MetaModel + " Instancemodus aModus(=" + aModus.ToString() + "constructedFromPxs=" + constructedFromPxs.ToString());

            this.mCNMMVersion       = config.MetaModel;
            this.mSelectedDbInfo    = selectedDbInfo;
            this.mInstanceModus     = aModus;
            this.constructedFromPxs = constructedFromPxs;
        }
Ejemplo n.º 2
0
        public PXSqlMeta_24(PxsQuery mPxsObject, string preferredLang, SqlDbConfig config, InfoForDbConnection selectedDbInfo, PCAxis.Sql.Parser.Instancemodus aModus, bool useTempTables)
            : base(config, selectedDbInfo, aModus, true)

        {
            log.Debug("PXSqlMeta(PxsQuery mPxsObject, SqlDbConfig config, Instancemodus aModus");


            //disse er trukket hit for å kunne kjøre med String hovedtabellId.
            this.mMainTableId = mPxsObject.Query.TableSource;

            //TODO; denne burde kunne fjernes
            this.mPxsSubTableId = mPxsObject.Query.SubTable;
            this.mConfig        = (SqlDbConfig_24)config;

            mMetaQuery = new MetaQuery(this.mConfig, this.SelectedDbInfo, useTempTables);

            this.mPxsFile = this.rearrangePxsQuery(mPxsObject);

            SetLanguageCodesFromPxs(preferredLang);
            BuildMeta(); //
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mainTableId"></param>
 /// <param name="preferredLang">The code ("no","en",...) of the language the client wants as main language in paxiom. May be null or empty, indicating the client dont care, in which case a "random" language is choosen.</param>
 /// <param name="getAllLangs"></param>
 /// <param name="config"></param>
 /// <param name="selectedDbInfo"></param>
 /// <param name="aModus"></param>
 public PXSqlMeta_24(string mainTableId, string preferredLang, bool getAllLangs, SqlDbConfig config, InfoForDbConnection selectedDbInfo, PCAxis.Sql.Parser.Instancemodus aModus, bool useTempTables)
     : base(config, selectedDbInfo, aModus, false)
 {
     log.Info("PXSqlMeta(string mainTableId(=" + mainTableId + "), StringCollection desiredLanguages, SqlDbConfig config, Instancemodus aModus(=" + aModus.ToString() + "))");
     this.mMainTableId = mainTableId;
     this.mConfig      = (SqlDbConfig_24)config;
     mMetaQuery        = new MetaQuery(this.mConfig, this.SelectedDbInfo, useTempTables);
     SetLanguageCodesNoPxs(preferredLang, getAllLangs);
     BuildMeta();
 }
Ejemplo n.º 4
0
 public static void ApplyEliminationIfSupported(PCAxis.Paxiom.Selection[] selections, SqlDbConfig config, InfoForDbConnection dbInfo, PCAxis.Paxiom.PXMeta pxMeta)
 {
     /*
      * SqlDbConfig_24 DB = config as SqlDbConfig_24;
      *
      * if (DB != null && config.MetaModel.Equals("2.4"))
      * {
      *  PxSqlCommand mSqlCommand = new PxSqlCommand(dbInfo.DataBaseType, dbInfo.DataProvider, dbInfo.ConnectionString);
      *  string eliminationMethodC = "C";
      *
      *  foreach (var selection in selections.Where(x => x.ValueCodes.Count == 0).ToArray())
      *  {
      *      StringBuilder sqlString = new StringBuilder("");
      *      sqlString.AppendLine("SELECT DISTINCT ");
      *      sqlString.AppendLine(DB.ValueSet.EliminationCodeCol.ForSelect());
      *      sqlString.AppendLine(" FROM " + DB.ValueSet.GetNameAndAlias());
      *      sqlString.AppendLine(" INNER JOIN " + DB.SubTableVariable.GetNameAndAlias());
      *      sqlString.AppendLine(" ON " + DB.ValueSet.Alias + "." + DB.ValueSet.ValueSetCol.PureColumnName() + " = " + DB.SubTableVariable.Alias + "." + DB.SubTableVariable.ValueSetCol.PureColumnName());
      *      sqlString.AppendLine(" WHERE " + DB.SubTableVariable.MainTableCol.Is());
      *      sqlString.AppendLine(" AND " + DB.SubTableVariable.VariableCol.Is());
      *      sqlString.AppendLine(" AND " + DB.ValueSet.EliminationMethodCol.Is());
      *
      *      System.Data.Common.DbParameter[] parameters = new System.Data.Common.DbParameter[3];
      *      parameters[0] = DB.SubTableVariable.MainTableCol.GetStringParameter(pxMeta.MainTable);
      *      parameters[1] = DB.SubTableVariable.VariableCol.GetStringParameter(selection.VariableCode);
      *      parameters[2] = DB.SubTableVariable.VariableCol.GetStringParameter(eliminationMethodC);
      *
      *      var ds = mSqlCommand.ExecuteSelect(sqlString.ToString(), parameters);
      *      var dt = ds.Tables[0];
      *
      *      if(dt.Rows.Count != 1) throw new Exception("Could not resolve eliminination code");
      *
      *      var eliminationCode = (string)dt.Rows[0][0];
      *      selection.ValueCodes.Add(eliminationCode);
      *  }
      * }
      */
 }
Ejemplo n.º 5
0
 public static PXSqlMeta GetPXSqlMeta(PxsQuery mPxsObject, string preferredLang, SqlDbConfig config, InfoForDbConnection selectedDbInfo, Instancemodus aModus, bool useTempTables)
 {
     if (config.MetaModel.Equals("2.1"))
     {
         return(new Parser_21.PXSqlMeta_21(mPxsObject, preferredLang, config, selectedDbInfo, aModus));
     }
     else if (config.MetaModel.Equals("2.2"))
     {
         return(new Parser_22.PXSqlMeta_22(mPxsObject, preferredLang, config, selectedDbInfo, aModus));
     }
     else if (config.MetaModel.Equals("2.3"))
     {
         return(new Parser_23.PXSqlMeta_23(mPxsObject, preferredLang, config, selectedDbInfo, aModus));
     }
     else if (config.MetaModel.Equals("2.4"))
     {
         return(new Parser_24.PXSqlMeta_24(mPxsObject, preferredLang, config, selectedDbInfo, aModus, useTempTables));
     }
     else
     {
         log.Debug("creating Parser_21.PXSqlMeta_21, but config.MetaModel is " + config.MetaModel);
         return(new Parser_21.PXSqlMeta_21(mPxsObject, preferredLang, config, selectedDbInfo, aModus));
     }
 }