Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SerialClob


          for (Map.Entry<String, String> entry : record.getProperties().entrySet()) {
            String value = entry.getValue();
            Clob clobValue = null;
            if (value != null) {
              try {
                clobValue = new ClobType(new SerialClob(value.toCharArray()));
              } catch (SQLException e) {
                throw new TeiidProcessingException(e);
              }
            }
            rows.add(Arrays.asList(entry.getKey(), entry.getValue(), record.getUUID(), oid++, clobValue));
          }
        }
        break;
      default:
        for (Schema schema : getVisibleSchemas(vdb, metadata)) {
          for (Table table : schema.getTables().values()) {
            switch (sysTable) {
            case TABLES:
              rows.add(Arrays.asList(vdbName, schema.getName(), table.getName(), table.getTableType().toString(), table.getNameInSource(),
                  table.isPhysical(), table.supportsUpdate(), table.getUUID(), table.getCardinality(), table.getAnnotation(), table.isSystem(), table.isMaterialized(), oid++));
              break;
            case COLUMNS:
              for (Column column : table.getColumns()) {
                Datatype dt = column.getDatatype();
                rows.add(Arrays.asList(vdbName, schema.getName(), table.getName(), column.getName(), column.getPosition(), column.getNameInSource(),
                    dt!=null?dt.getRuntimeTypeName():null, column.getScale(), column.getLength(), column.isFixedLength(), column.isSelectable(), column.isUpdatable(),
                    column.isCaseSensitive(), column.isSigned(), column.isCurrency(), column.isAutoIncremented(), column.getNullType().toString(), column.getMinimumValue(),
                    column.getMaximumValue(), column.getDistinctValues(), column.getNullValues(), column.getSearchType().toString(), column.getFormat(),
                    column.getDefaultValue(), dt!=null?dt.getJavaClassName():null, column.getPrecision(),
                    column.getCharOctetLength(), column.getRadix(), column.getUUID(), column.getAnnotation(), oid++));
              }
              break;
            case KEYS:
              for (KeyRecord key : table.getAllKeys()) {
                rows.add(Arrays.asList(vdbName, table.getParent().getName(), table.getName(), key.getName(), key.getAnnotation(), key.getNameInSource(), key.getType().toString(),
                    false, (key instanceof ForeignKey)?((ForeignKey)key).getUniqueKeyID():null, key.getUUID(), oid++));
              }
              break;
            case KEYCOLUMNS:
              for (KeyRecord key : table.getAllKeys()) {
                int postition = 1;
                for (Column column : key.getColumns()) {
                  rows.add(Arrays.asList(vdbName, schema.getName(), table.getName(), column.getName(), key.getName(), key.getType().toString(),
                      (key instanceof ForeignKey)?((ForeignKey)key).getUniqueKeyID():null, key.getUUID(), postition++, oid++));
                }
              }
              break;
            case REFERENCEKEYCOLUMNS:
              for (ForeignKey key : table.getForeignKeys()) {
                short postition = 0;
                for (Column column : key.getColumns()) {
                  Table pkTable = key.getPrimaryKey().getParent();
                  rows.add(Arrays.asList(vdbName, pkTable.getParent().getName(), pkTable.getName(), key.getPrimaryKey().getColumns().get(postition).getName(), vdbName, schema.getName(), table.getName(), column.getName(),
                      ++postition, DatabaseMetaData.importedKeyNoAction, DatabaseMetaData.importedKeyNoAction, key.getName(), key.getPrimaryKey().getName(), DatabaseMetaData.importedKeyInitiallyDeferred));
                }
              }
              break;
            }
          }
        }
        break;
      }
    } else {         
      StoredProcedure proc = (StoredProcedure)command;   
      if (StringUtil.startsWithIgnoreCase(proc.getProcedureCallableName(), CoreConstants.SYSTEM_ADMIN_MODEL)) {
        final SystemAdminProcs sysProc = SystemAdminProcs.valueOf(proc.getProcedureCallableName().substring(CoreConstants.SYSTEM_ADMIN_MODEL.length() + 1).toUpperCase());
        switch (sysProc) {
        case SETPROPERTY:
          try {
            String uuid = (String)((Constant)proc.getParameter(2).getExpression()).getValue();
            String key = (String)((Constant)proc.getParameter(3).getExpression()).getValue();
            Clob value = (Clob)((Constant)proc.getParameter(4).getExpression()).getValue();
            String strVal = null;
            String result = null;
            if (value != null) {
              if (value.length() > MAX_VALUE_LENGTH) {
                throw new TeiidProcessingException(QueryPlugin.Util.getString("DataTierManagerImpl.max_value_length", MAX_VALUE_LENGTH)); //$NON-NLS-1$
              }
              strVal = ObjectConverterUtil.convertToString(value.getCharacterStream());
            }
            AbstractMetadataRecord target = getByUuid(metadata, uuid);
            if (target == null) {
              throw new TeiidProcessingException(QueryPlugin.Util.getString("DataTierManagerImpl.unknown_uuid", uuid)); //$NON-NLS-1$
            }
            if (this.metadataRepository != null) {
              this.metadataRepository.setProperty(vdbName, vdbVersion, target, key, strVal);
            }
            result = target.setProperty(key, strVal);
            if (eventDistributor != null) {
              eventDistributor.setProperty(vdbName, vdbVersion, uuid, key, strVal);
            }
            if (result == null) {
              rows.add(Arrays.asList((Clob)null));
            } else {
              rows.add(Arrays.asList(new ClobType(new SerialClob(result.toCharArray()))));
            }
            return new CollectionTupleSource(rows.iterator());
          } catch (SQLException e) {
            throw new TeiidProcessingException(e);
          } catch (IOException e) {
View Full Code Here


  private void helpTestJson(String json, String rootName, String expected)
      throws SQLException, TeiidComponentException,
      TeiidProcessingException, SerialException, IOException {
    CommandContext cc = new CommandContext();
    cc.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
    SQLXML xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialClob(json.toCharArray()));
    assertEquals(expected, xml.getString());
    xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-8"))));
    assertEquals(expected, xml.getString());
    xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-32BE"))));
    assertEquals(expected, xml.getString());
View Full Code Here

     
        FakeDataManager dataManager = new FakeDataManager();
        sampleData1(dataManager);
       
        char[] data = new char[5000];
        processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
    }
View Full Code Here

                        }
                    }

                    break;
                case 13:
                    entity.dangerousSetNoCheckButFast(curField, new SerialClob(rs.getClob(ind)));
                    break;
                case 14:
                case 15:
                    entity.dangerousSetNoCheckButFast(curField, rs.getObject(ind));
                    break;
View Full Code Here

            throw new SQLException();
        }
        if (params == null) {
            throw new SQLException();
        }
        params.put(Integer.valueOf(parameterIndex - 1), new SerialClob(x));
    }
View Full Code Here

public class SerialNClobFactory implements SerialLocatorFactory<NClob>
{
  @Override
  public NClob createSerial(NClob clob) throws SQLException
  {
    return Proxies.createProxy(NClob.class, new SimpleInvocationHandler(new SerialClob(clob)));
  }
View Full Code Here

public class SerialClobFactory implements SerialLocatorFactory<Clob>
{
  @Override
  public Clob createSerial(Clob clob) throws SQLException
  {
    return new SerialClob(clob);
  }
View Full Code Here

  @Test
  public void testGetString() {
    char[] expectedChar = new char[] { 'a', 'b', 'c' };
    try {
      Clob clob = new SerialClob(expectedChar);
      String actualString = JPAEntityParser.getString(clob);

      assertEquals(new String(expectedChar), actualString);

    } catch (SerialException e) {
View Full Code Here

  }

  @Override
  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
    try {
      return new SerialClob(characterData);
    } catch (SerialException e) {
      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    } catch (SQLException e) {
      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }
View Full Code Here

                        }
                    }

                    break;
                case 13:
                    entity.dangerousSetNoCheckButFast(curField, new SerialClob(rs.getClob(ind)));
                    break;
                case 14:
                case 15:
                    entity.dangerousSetNoCheckButFast(curField, rs.getObject(ind));
                    break;
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SerialClob

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.