Package org.apache.derby.iapi.sql.depend

Examples of org.apache.derby.iapi.sql.depend.Dependent


      {
        if (ei >= list.size())
          continue;
        Dependency dependency = (Dependency) list.get(ei);

        Dependent dep = dependency.getDependent();

        if (affectedCols != null)
        {
          TableDescriptor td = (TableDescriptor) dependency.getProvider();
          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
              ViewDescriptor vd = (ViewDescriptor) dep;
              SchemaDescriptor compSchema;
              compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
              CompilerContext newCC = lcc.pushCompilerContext(compSchema);
              Parser  pa = newCC.getParser();

              // Since this is always nested inside another SQL
              // statement, so topLevel flag should be false
              CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
                        vd.getViewText());

              // need a current dependent for bind
              newCC.setCurrentDependent(dep);
              cvn.bindStatement();
              ProviderInfo[] providerInfos = cvn.getProviderInfo();
              lcc.popCompilerContext(newCC);

              boolean    interferent = false;
              for (int i = 0; i < providerInfos.length; i++)
              {
                Provider provider = null;
                  provider = (Provider) providerInfos[i].
                          getDependableFinder().
                          getDependable(dd,
                          providerInfos[i].getObjectId());
                if (provider instanceof TableDescriptor)
                {
                  TableDescriptor tab = (TableDescriptor)provider;
                  FormatableBitSet colMap = tab.getReferencedColumnMap();
                  if (colMap == null)
                    continue;
                  // if later on an error is raised such as in
                  // case of interference, this dependency line
                  // upgrade will not happen due to rollback
                  tab.setReferencedColumnMap(null);
                  dropDependency(lcc, vd, tab);
                  tab.setReferencedColumnMap(colMap);
                  addDependency(vd, tab, lcc.getContextManager());

                  if (tab.getObjectID().equals(td.getObjectID()))
                  {
                    System.arraycopy(affectedCols.getByteArray(), 0,
                      subsetCols.getByteArray(), 0,
                      affectedCols.getLengthInBytes());
                    subsetCols.and(colMap);
                    if (subsetCols.anySetBit() != -1)
                    {
                      interferent = true;
                      ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
                    }
                  }
                }  // if provider instanceof TableDescriptor
              // for providerInfos
              if (! interferent)
                continue;
            // if dep instanceof ViewDescriptor
            else
              ((TableDescriptor) p).setReferencedColumnMap(null);
          // if providingCols == null
          else
          {
            System.arraycopy(affectedCols.getByteArray(), 0, subsetCols.getByteArray(), 0, affectedCols.getLengthInBytes());
            subsetCols.and(providingCols);
            if (subsetCols.anySetBit() == -1)
              continue;
            ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
          }
        }

        // generate a list of invalidations that fail.
        try {
          dep.prepareToInvalidate(p, action, lcc);
        } catch (StandardException sqle) {

          if (noInvalidate == null) {
            noInvalidate = sqle;
          } else {
            try {
              sqle.initCause(noInvalidate);
              noInvalidate = sqle;
            } catch (IllegalStateException ise) {
              // We weren't able to chain the exceptions. That's
              // OK, since we always have the first exception we
              // caught. Just skip the current exception.
            }
          }
        }
        if (noInvalidate == null) {

          if (affectedCols != null)
            ((TableDescriptor) p).setReferencedColumnMap(affectedCols);

          // REVISIT: future impl will want to mark the individual
          // dependency as invalid as well as the dependent...
          dep.makeInvalid(action, lcc);
        }
      }

      if (noInvalidate != null)
        throw noInvalidate;
View Full Code Here


       * so that the call gets an enumerations of Dependencys.
       */
      for (ListIterator depsIterator = storedList.listIterator();
         depsIterator.hasNext(); )
      {
        Dependent       tempD;
        Provider        tempP;
        DependableFinder  finder = null;

        DependencyDescriptor depDesc = (DependencyDescriptor) depsIterator.next();

View Full Code Here

      {
        if (ei >= list.size())
          continue;
        Dependency dependency = (Dependency) list.get(ei);

        Dependent dep = dependency.getDependent();

        if (affectedCols != null)
        {
          TableDescriptor td = (TableDescriptor) dependency.getProvider();
          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
              ViewDescriptor vd = (ViewDescriptor) dep;
              DataDictionary dd = getDataDictionary();
              SchemaDescriptor compSchema;
              compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
              CompilerContext newCC = lcc.pushCompilerContext(compSchema);
              Parser  pa = newCC.getParser();
              LanguageConnectionFactory  lcf = lcc.getLanguageConnectionFactory();

              // Since this is always nested inside another SQL
              // statement, so topLevel flag should be false
              CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
                        vd.getViewText());

              // need a current dependent for bind
              newCC.setCurrentDependent(dep);
              cvn = (CreateViewNode) cvn.bind();
              ProviderInfo[] providerInfos = cvn.getProviderInfo();
              lcc.popCompilerContext(newCC);

              boolean    interferent = false;
              for (int i = 0; i < providerInfos.length; i++)
              {
                Provider provider = null;
                try
                {
                  provider = (Provider) providerInfos[i].
                          getDependableFinder().
                          getDependable(
                          providerInfos[i].getObjectId());
                }
                catch(java.sql.SQLException te)
                {
                  if (SanityManager.DEBUG)
                  {
                    SanityManager.THROWASSERT("unexpected java.sql.SQLException - " + te);
                  }
                }
                if (provider instanceof TableDescriptor)
                {
                  TableDescriptor tab = (TableDescriptor)provider;
                  FormatableBitSet colMap = tab.getReferencedColumnMap();
                  if (colMap == null)
                    continue;
                  // if later on an error is raised such as in
                  // case of interference, this dependency line
                  // upgrade will not happen due to rollback
                  tab.setReferencedColumnMap(null);
                  dropDependency(lcc, vd, tab);
                  tab.setReferencedColumnMap(colMap);
                  addDependency(vd, tab, lcc.getContextManager());

                  if (tab.getObjectID().equals(td.getObjectID()))
                  {
                    System.arraycopy(affectedCols.getByteArray(), 0,
                      subsetCols.getByteArray(), 0,
                      affectedCols.getLengthInBytes());
                    subsetCols.and(colMap);
                    if (subsetCols.anySetBit() != -1)
                    {
                      interferent = true;
                      ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
                    }
                  }
                }  // if provider instanceof TableDescriptor
              // for providerInfos
              if (! interferent)
                continue;
            // if dep instanceof ViewDescriptor
            else
              ((TableDescriptor) p).setReferencedColumnMap(null);
          // if providingCols == null
          else
          {
            System.arraycopy(affectedCols.getByteArray(), 0, subsetCols.getByteArray(), 0, affectedCols.getLengthInBytes());
            subsetCols.and(providingCols);
            if (subsetCols.anySetBit() == -1)
              continue;
            ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
          }
        }

        // generate a list of invalidations that fail.
        try {
          dep.prepareToInvalidate(p, action, lcc);
        } catch (StandardException sqle) {

          if (noInvalidate != null)
            sqle.setNestedException(noInvalidate);

          noInvalidate = sqle;
        }
        if (noInvalidate == null) {

          if (affectedCols != null)
            ((TableDescriptor) p).setReferencedColumnMap(affectedCols);

          // REVISIT: future impl will want to mark the individual
          // dependency as invalid as well as the dependent...
          dep.makeInvalid(action, lcc);
        }
      }

      if (noInvalidate != null)
        throw noInvalidate;
View Full Code Here

       * so that the call gets an enumerations of Dependencys.
       */
      for (ListIterator depsIterator = storedList.listIterator();
         depsIterator.hasNext(); )
      {
        Dependent       tempD;
        Provider        tempP;
        DependableFinder  finder = null;

        DependencyDescriptor depDesc = (DependencyDescriptor) depsIterator.next();

View Full Code Here

      {
        if (ei >= list.size())
          continue;
        Dependency dependency = (Dependency) list.get(ei);

        Dependent dep = dependency.getDependent();

        if (affectedCols != null)
        {
          TableDescriptor td = (TableDescriptor) dependency.getProvider();
          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
              ViewDescriptor vd = (ViewDescriptor) dep;
              SchemaDescriptor compSchema;
              compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
              CompilerContext newCC = lcc.pushCompilerContext(compSchema);
              Parser  pa = newCC.getParser();

              // Since this is always nested inside another SQL
              // statement, so topLevel flag should be false
              CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
                        vd.getViewText());

              // need a current dependent for bind
              newCC.setCurrentDependent(dep);
              cvn.bindStatement();
              ProviderInfo[] providerInfos = cvn.getProviderInfo();
              lcc.popCompilerContext(newCC);

              boolean    interferent = false;
              for (int i = 0; i < providerInfos.length; i++)
              {
                Provider provider = null;
                  provider = (Provider) providerInfos[i].
                          getDependableFinder().
                          getDependable(dd,
                          providerInfos[i].getObjectId());
                if (provider instanceof TableDescriptor)
                {
                  TableDescriptor tab = (TableDescriptor)provider;
                  FormatableBitSet colMap = tab.getReferencedColumnMap();
                  if (colMap == null)
                    continue;
                  // if later on an error is raised such as in
                  // case of interference, this dependency line
                  // upgrade will not happen due to rollback
                  tab.setReferencedColumnMap(null);
                  dropDependency(lcc, vd, tab);
                  tab.setReferencedColumnMap(colMap);
                  addDependency(vd, tab, lcc.getContextManager());

                  if (tab.getObjectID().equals(td.getObjectID()))
                  {
                    System.arraycopy(affectedCols.getByteArray(), 0,
                      subsetCols.getByteArray(), 0,
                      affectedCols.getLengthInBytes());
                    subsetCols.and(colMap);
                    if (subsetCols.anySetBit() != -1)
                    {
                      interferent = true;
                      ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
                    }
                  }
                }  // if provider instanceof TableDescriptor
              // for providerInfos
              if (! interferent)
                continue;
            // if dep instanceof ViewDescriptor
            else
              ((TableDescriptor) p).setReferencedColumnMap(null);
          // if providingCols == null
          else
          {
            System.arraycopy(affectedCols.getByteArray(), 0, subsetCols.getByteArray(), 0, affectedCols.getLengthInBytes());
            subsetCols.and(providingCols);
            if (subsetCols.anySetBit() == -1)
              continue;
            ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
          }
        }

        // generate a list of invalidations that fail.
        try {
          dep.prepareToInvalidate(p, action, lcc);
        } catch (StandardException sqle) {

          if (noInvalidate == null) {
            noInvalidate = sqle;
          } else {
            try {
              sqle.initCause(noInvalidate);
              noInvalidate = sqle;
            } catch (IllegalStateException ise) {
              // We weren't able to chain the exceptions. That's
              // OK, since we always have the first exception we
              // caught. Just skip the current exception.
            }
          }
        }
        if (noInvalidate == null) {

          if (affectedCols != null)
            ((TableDescriptor) p).setReferencedColumnMap(affectedCols);

          // REVISIT: future impl will want to mark the individual
          // dependency as invalid as well as the dependent...
          dep.makeInvalid(action, lcc);
        }
      }

      if (noInvalidate != null)
        throw noInvalidate;
View Full Code Here

       * so that the call gets an enumerations of Dependencys.
       */
      for (ListIterator depsIterator = storedList.listIterator();
         depsIterator.hasNext(); )
      {
        Dependent       tempD;
        Provider        tempP;
        DependableFinder  finder = null;

        DependencyDescriptor depDesc = (DependencyDescriptor) depsIterator.next();

View Full Code Here

      {
        if (ei >= list.size())
          continue;
        Dependency dependency = list.get(ei);

        Dependent dep = dependency.getDependent();

        if (affectedCols != null)
        {
          TableDescriptor td = (TableDescriptor) dependency.getProvider();
          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
                            // If the table descriptor that was passed in had a
                            // column bit map, so should the provider's table
                            // descriptor. Views that were created with a
                            // database version that predates Derby could lack
                            // a bitmap in the provider and needed to
                            // reconstruct it here by parsing and binding the
                            // original CREATE VIEW statement. However, since
                            // we don't support upgrade from pre-Derby versions,
                            // this code was removed as part of DERBY-6169.
                            if (SanityManager.DEBUG)
                            {
                                SanityManager.THROWASSERT("Expected view to " +
                                        "have referenced column bitmap");
                            }
            }  // if dep instanceof ViewDescriptor
            else
              ((TableDescriptor) p).setReferencedColumnMap(null);
          // if providingCols == null
          else
          {
                        subsetCols.copyFrom( affectedCols );
            subsetCols.and(providingCols);
            if (subsetCols.anySetBit() == -1)
              continue;
            ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
          }
        }

        // generate a list of invalidations that fail.
        try {
          dep.prepareToInvalidate(p, action, lcc);
        } catch (StandardException sqle) {

          if (noInvalidate == null) {
            noInvalidate = sqle;
          } else {
            try {
              sqle.initCause(noInvalidate);
              noInvalidate = sqle;
            } catch (IllegalStateException ise) {
              // We weren't able to chain the exceptions. That's
              // OK, since we always have the first exception we
              // caught. Just skip the current exception.
            }
          }
        }
        if (noInvalidate == null) {

          if (affectedCols != null)
            ((TableDescriptor) p).setReferencedColumnMap(affectedCols);

          // REVISIT: future impl will want to mark the individual
          // dependency as invalid as well as the dependent...
          dep.makeInvalid(action, lcc);
        }
      }

      if (noInvalidate != null)
        throw noInvalidate;
View Full Code Here

       * back into the same place in the List
       * so that the call gets an enumerations of Dependencys.
       */
            for (DependencyDescriptor depDesc : storedList)
      {
        Dependent       tempD;
        Provider        tempP;
                DependableFinder    finder = depDesc.getDependentFinder();
                tempD = (Dependent) finder.getDependable(dd, depDesc.getUUID());

                if (providerForList != null)
View Full Code Here

      {
        if (ei >= list.size())
          continue;
        Dependency dependency = (Dependency) list.get(ei);

        Dependent dep = dependency.getDependent();

        if (affectedCols != null)
        {
          TableDescriptor td = (TableDescriptor) dependency.getProvider();
          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
              ViewDescriptor vd = (ViewDescriptor) dep;
              SchemaDescriptor compSchema;
              compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
              CompilerContext newCC = lcc.pushCompilerContext(compSchema);
              Parser  pa = newCC.getParser();

              // Since this is always nested inside another SQL
              // statement, so topLevel flag should be false
              CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
                        vd.getViewText());

              // need a current dependent for bind
              newCC.setCurrentDependent(dep);
              cvn.bindStatement();
              ProviderInfo[] providerInfos = cvn.getProviderInfo();
              lcc.popCompilerContext(newCC);

              boolean    interferent = false;
              for (int i = 0; i < providerInfos.length; i++)
              {
                Provider provider = null;
                  provider = (Provider) providerInfos[i].
                          getDependableFinder().
                          getDependable(dd,
                          providerInfos[i].getObjectId());
                if (provider instanceof TableDescriptor)
                {
                  TableDescriptor tab = (TableDescriptor)provider;
                  FormatableBitSet colMap = tab.getReferencedColumnMap();
                  if (colMap == null)
                    continue;
                  // if later on an error is raised such as in
                  // case of interference, this dependency line
                  // upgrade will not happen due to rollback
                  tab.setReferencedColumnMap(null);
                  dropDependency(lcc, vd, tab);
                  tab.setReferencedColumnMap(colMap);
                  addDependency(vd, tab, lcc.getContextManager());

                  if (tab.getObjectID().equals(td.getObjectID()))
                  {
                    System.arraycopy(affectedCols.getByteArray(), 0,
                      subsetCols.getByteArray(), 0,
                      affectedCols.getLengthInBytes());
                    subsetCols.and(colMap);
                    if (subsetCols.anySetBit() != -1)
                    {
                      interferent = true;
                      ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
                    }
                  }
                }  // if provider instanceof TableDescriptor
              // for providerInfos
              if (! interferent)
                continue;
            // if dep instanceof ViewDescriptor
            else
              ((TableDescriptor) p).setReferencedColumnMap(null);
          // if providingCols == null
          else
          {
            System.arraycopy(affectedCols.getByteArray(), 0, subsetCols.getByteArray(), 0, affectedCols.getLengthInBytes());
            subsetCols.and(providingCols);
            if (subsetCols.anySetBit() == -1)
              continue;
            ((TableDescriptor) p).setReferencedColumnMap(subsetCols);
          }
        }

        // generate a list of invalidations that fail.
        try {
          dep.prepareToInvalidate(p, action, lcc);
        } catch (StandardException sqle) {

          if (noInvalidate == null) {
            noInvalidate = sqle;
          } else {
            try {
              sqle.initCause(noInvalidate);
              noInvalidate = sqle;
            } catch (IllegalStateException ise) {
              // We weren't able to chain the exceptions. That's
              // OK, since we always have the first exception we
              // caught. Just skip the current exception.
            }
          }
        }
        if (noInvalidate == null) {

          if (affectedCols != null)
            ((TableDescriptor) p).setReferencedColumnMap(affectedCols);

          // REVISIT: future impl will want to mark the individual
          // dependency as invalid as well as the dependent...
          dep.makeInvalid(action, lcc);
        }
      }

      if (noInvalidate != null)
        throw noInvalidate;
View Full Code Here

       * so that the call gets an enumerations of Dependencys.
       */
      for (ListIterator depsIterator = storedList.listIterator();
         depsIterator.hasNext(); )
      {
        Dependent       tempD;
        Provider        tempP;
        DependableFinder  finder = null;

        DependencyDescriptor depDesc = (DependencyDescriptor) depsIterator.next();

View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.depend.Dependent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.