Package nexj.core.meta.persistence.sql

Examples of nexj.core.meta.persistence.sql.Column


      {
         int nCount = m_table.getColumnCount();
        
         for (int i = 0; i < nCount; ++i)
         {
            Column col = m_table.getColumn(i);

            if (!col.isNullable() && !col.isPrimary() && !col.isDenormalized())
            {
               Object value = getValue(i);

               if (value == Undefined.VALUE || value == null)
               {
View Full Code Here


            if (nValCount > 0)
            {
               buf.append(", ");
            }

            Column column = m_table.getColumn(i);

            buf.append(column.getQuotedName());
            buf.append(" = ");
            m_adapter.appendBind(buf, nValCount++);

            if (m_adapter.isCaseConverted(column))
            {
View Full Code Here

      Index pk = m_table.getPrimaryKey();
      int nValCount = 0;

      for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
      {
         Column column = pk.getIndexColumn(i).getColumn();

         if (getValue(column) == Undefined.VALUE)
         {
            if (nValCount++ > 0)
            {
               buf.append(", ");
            }

            buf.append(column.getQuotedName());
         }
      }

      boolean bCaseConverted = false;

      for (int i = 0, n = m_table.getColumnCount(); i < n; ++i)
      {
         Column column = m_table.getColumn(i);

         if (getValue(i) != Undefined.VALUE ||
            m_bDenorm && findSource(column) != null)
         {
            if (nValCount++ > 0)
            {
               buf.append(", ");
            }

            buf.append(column.getQuotedName());

            if (m_adapter.isCaseConverted(column))
            {
               buf.append(", ");
               m_adapter.appendCaseConvertedColumn(buf, column);
               bCaseConverted = true;
            }
         }
      }

      buf.append((m_bDenorm) ? ") select " : ") values (");

      if (bCaseConverted | m_bDenorm)
      {
         nValCount = 0;

         for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
         {
            Column column = pk.getIndexColumn(i).getColumn();

            if (getValue(column) == Undefined.VALUE)
            {
               if (nValCount > 0)
               {
                  buf.append(", ");
               }

               m_adapter.appendBind(buf, nBindCount + nValCount++, column);
            }
         }

         // TODO: Support more than just the primary table denorm
         Table denormTable = null;

         for (int i = 0, n = m_table.getColumnCount(); i < n; ++i)
         {
            Column column = m_table.getColumn(i);

            if (getValue(i) != Undefined.VALUE)
            {
               if (nValCount != 0 || denormTable != null)
               {
                  buf.append(", ");
               }

               m_adapter.appendBind(buf, nBindCount + nValCount++, column);

               if (m_adapter.isCaseConverted(column))
               {
                  buf.append(", ");
                  m_adapter.appendCaseConvertedBind(buf, nBindCount + nValCount++, column);
               }
            }
            else
            {
               Column srcColumn = findSource(column);

               if (srcColumn != null)
               {
                  if (nValCount != 0 || denormTable != null)
                  {
                     buf.append(", ");
                  }

                  buf.append("A.");
                  buf.append(srcColumn.getQuotedName());

                  if (m_adapter.isCaseConverted(column))
                  {
                     buf.append(", ");
                     buf.append("A.");
                     m_adapter.appendCaseConvertedColumn(buf, srcColumn);
                  }

                  denormTable = srcColumn.getTable();
               }
            }
         }

         if (m_bDenorm)
         {
            buf.append(" from ");
            buf.append(denormTable.getQuotedName());
            buf.append(" A where ");

            for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
            {
               if (i != 0)
               {
                  buf.append(" and ");
               }

               Column column = pk.getIndexColumn(i).getColumn();

               buf.append("A.");
               buf.append(column.getQuotedName());
               buf.append(" = ");

               m_adapter.appendBind(buf, nBindCount + nValCount++);
            }
         }
View Full Code Here

      {
         value = getValue(i);
        
         if (value != Undefined.VALUE)
         {
            Column column = m_table.getColumn(i);

            if (column == m_lockingColumn && m_lockValue == Undefined.VALUE)
            {
               m_lockValue = m_adapter.toBind(column, value);

               do
               {
                  value = column.getValueType().convert(Primitive.createInteger(RandUtil.getSecureRandom().nextInt()));
               }
               while (value.equals(getValue(i)));

               setInstanceValue(column, value);
            }

            value = m_adapter.toBind(column, value);

            Bind bind = m_adapter.getBind(column);

            if (m_adapter.isDebug())
            {
               m_adapter.logBindValue(nValCount, value);
            }

            bind.setValue(stmt, nValCount++, value, m_adapter);

            if (m_adapter.isCaseConverted(column))
            {
               if (m_adapter.isDebug())
               {
                  m_adapter.logBindValue(nValCount, value);
               }

               bind.setValue(stmt, nValCount++, value, m_adapter);
            }
         }
      }

      Index pk = m_table.getPrimaryKey();
      OID oid = m_instance.getOID();

      for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
      {
         Column column = pk.getIndexColumn(i).getColumn();

         value = m_adapter.toBind(column, oid.getValue(i));

         if (m_adapter.isDebug())
         {
View Full Code Here

      OID oid = m_instance.getOID();
      Object value;

      for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
      {
         Column column = pk.getIndexColumn(i).getColumn();

         if (getValue(column) == Undefined.VALUE)
         {
            value = m_adapter.toBind(column, oid.getValue(i));
  
            if (m_adapter.isDebug())
            {
               m_adapter.logBindValue(nValCount, value);
            }
  
            m_adapter.getBind(column).setValue(stmt, nValCount++, value, m_adapter);
         }
      }

      for (int i = 0, n = m_table.getColumnCount(); i < n; ++i)
      {
         value = getValue(i);
        
         if (value != Undefined.VALUE)
         {
            Column column = m_table.getColumn(i);

            value = m_adapter.toBind(column, value);

            Bind bind = m_adapter.getBind(column);

            if (m_adapter.isDebug())
            {
               m_adapter.logBindValue(nValCount, value);
            }

            bind.setValue(stmt, nValCount++, value, m_adapter);

            if (m_adapter.isCaseConverted(column))
            {
               if (m_adapter.isDebug())
               {
                  m_adapter.logBindValue(nValCount, value);
               }

               bind.setValue(stmt, nValCount++, value, m_adapter);
            }
         }
      }

      if (m_bDenorm)
      {
         for (int i = 0, n = pk.getIndexColumnCount(); i < n; ++i)
         {
            Column column = pk.getIndexColumn(i).getColumn();
  
            value = m_adapter.toBind(column, oid.getValue(i));
  
            if (m_adapter.isDebug())
            {
View Full Code Here

         if (i > 0)
         {
            buf.append(" and ");
         }

         Column column = pk.getIndexColumn(i).getColumn();

         buf.append(column.getQuotedName());
         buf.append(" = ");
         m_adapter.appendBind(buf, i);
      }
     
      if (m_lockingColumn != null)
View Full Code Here

      int nCount = pk.getIndexColumnCount();
      Object value;

      for (int i = 0; i < nCount; ++i)
      {
         Column column = pk.getIndexColumn(i).getColumn();

         value = m_adapter.toBind(column, getValue(column));
        
         if (m_adapter.isDebug())
         {
View Full Code Here

      int nCount = pk.getIndexColumnCount();
      Object[] values = null;

      for (int i = 0; i < nCount; ++i)
      {
         Column column = pk.getIndexColumn(i).getColumn();
         Object value = m_valueArray[column.getOrdinal()];
        
         if (value == Undefined.VALUE)
         {
            if (oldOID == null)
            {
View Full Code Here

      if (instance == null)
      {
         for (int i = 0; i < nCount; ++i)
         {
            Column column = index.getIndexColumn(i).getColumn();

            if (!column.isPrimary() ||
                !(srcKey instanceof Index) ||
                ((Index)srcKey).getIndexColumn(i).getColumn() != column)
            {
               setInstanceValue(column, null);
            }
View Full Code Here

      {
         Object value = m_instance.getValueDirect(lockAttribute.getOrdinal());

         if (value != Undefined.VALUE)
         {
            Column column = ((RelationalPrimitiveMapping)relMapping
               .getAttributeMapping(lockAttribute)).getColumn();
           
            value = column.getValueType().convert(value);
            setLockingColumn(column);
            setValue(column, value);
         }
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.persistence.sql.Column

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.