當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseMeta.CLOB_LENGTH屬性代碼示例

本文整理匯總了Java中org.pentaho.di.core.database.DatabaseMeta.CLOB_LENGTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseMeta.CLOB_LENGTH屬性的具體用法?Java DatabaseMeta.CLOB_LENGTH怎麽用?Java DatabaseMeta.CLOB_LENGTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.pentaho.di.core.database.DatabaseMeta的用法示例。


在下文中一共展示了DatabaseMeta.CLOB_LENGTH屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFieldDefinition

@Override
public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc,
    boolean add_fieldname, boolean add_cr ) {
  String retval = "";

  String fieldname = v.getName();
  int length = v.getLength();
  int precision = v.getPrecision();

  if ( add_fieldname ) {
    retval += fieldname + " ";
  }

  int type = v.getType();
  switch ( type ) {
    case ValueMetaInterface.TYPE_DATE:
      retval += "TIMESTAMP";
      break;
    case ValueMetaInterface.TYPE_BOOLEAN:
      if ( supportsBooleanDataType() ) {
        retval += "BOOLEAN";
      } else {
        retval += "CHAR(1)";
      }
      break;
    case ValueMetaInterface.TYPE_NUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_BIGNUMBER:
      if ( fieldname.equalsIgnoreCase( tk ) || // Technical key
          fieldname.equalsIgnoreCase( pk ) // Primary key
      ) {
        retval += "BIGSERIAL";
      } else {
        if ( length > 0 ) {
          if ( precision > 0 || length > 18 ) {
            // Numeric(Precision, Scale): Precision = total length; Scale = decimal places
            retval += "NUMERIC(" + ( length + precision ) + ", " + precision + ")";
          } else {
            if ( length > 9 ) {
              retval += "BIGINT";
            } else {
              if ( length < 5 ) {
                retval += "SMALLINT";
              } else {
                retval += "INTEGER";
              }
            }
          }

        } else {
          retval += "DOUBLE PRECISION";
        }
      }
      break;
    case ValueMetaInterface.TYPE_STRING:
      if ( length < 1 || length >= DatabaseMeta.CLOB_LENGTH ) {
        retval += "TEXT";
      } else {
        retval += "VARCHAR(" + length + ")";
      }
      break;
    default:
      retval += " UNKNOWN";
      break;
  }

  if ( add_cr ) {
    retval += Const.CR;
  }

  return retval;
}
 
開發者ID:mattyb149,項目名稱:pdi-neo4j-query,代碼行數:72,代碼來源:Neo4jDatabaseMeta.java

示例2: getFieldDefinition

@Override
public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc,
                                  boolean add_fieldname, boolean add_cr ) {
  // TODO override for your types
  String retval = "";

  String fieldname = v.getName();
  int length = v.getLength();
  int precision = v.getPrecision();

  if ( add_fieldname ) {
    retval += fieldname + " ";
  }

  int type = v.getType();
  switch ( type ) {
    case ValueMetaInterface.TYPE_DATE:
      retval += "TIMESTAMP";
      break;
    case ValueMetaInterface.TYPE_BOOLEAN:
      if ( supportsBooleanDataType() ) {
        retval += "BOOLEAN";
      } else {
        retval += "CHAR(1)";
      }
      break;
    case ValueMetaInterface.TYPE_NUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_BIGNUMBER:
      if ( fieldname.equalsIgnoreCase( tk ) || // Technical key
        fieldname.equalsIgnoreCase( pk ) // Primary key
        ) {
        retval += "BIGSERIAL";
      } else {
        if ( length > 0 ) {
          if ( precision > 0 || length > 18 ) {
            // Numeric(Precision, Scale): Precision = total length; Scale = decimal places
            retval += "NUMERIC(" + ( length + precision ) + ", " + precision + ")";
          } else {
            if ( length > 9 ) {
              retval += "BIGINT";
            } else {
              if ( length < 5 ) {
                retval += "SMALLINT";
              } else {
                retval += "INTEGER";
              }
            }
          }

        } else {
          retval += "DOUBLE PRECISION";
        }
      }
      break;
    case ValueMetaInterface.TYPE_STRING:
      if ( length < 1 || length >= DatabaseMeta.CLOB_LENGTH ) {
        retval += "TEXT";
      } else {
        retval += "VARCHAR(" + length + ")";
      }
      break;
    default:
      retval += " UNKNOWN";
      break;
  }

  if ( add_cr ) {
    retval += Const.CR;
  }

  return retval;
}
 
開發者ID:mattyb149,項目名稱:pdi-presto-jdbc,代碼行數:73,代碼來源:PrestoDatabaseMeta.java

示例3: getFieldDefinition

@Override
public String getFieldDefinition ( ValueMetaInterface v, String tk, String pk, boolean use_autoinc,
                                   boolean add_fieldname, boolean add_cr ) {
  String retval = "";

  String fieldname = v.getName ();
  int length = v.getLength ();
  int precision = v.getPrecision ();

  if ( add_fieldname ) {
    retval += fieldname + " ";
  }

  int type = v.getType ();
  switch ( type ) {
    case ValueMetaInterface.TYPE_DATE:
      retval += "TIMESTAMP";
      break;
    case ValueMetaInterface.TYPE_BOOLEAN:
      if ( supportsBooleanDataType () ) {
        retval += "BOOLEAN";
      } else {
        retval += "CHAR(1)";
      }
      break;
    case ValueMetaInterface.TYPE_NUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_BIGNUMBER:
      if ( fieldname.equalsIgnoreCase ( tk ) || // Technical key
            fieldname.equalsIgnoreCase ( pk ) // Primary key
            ) {
        retval += "BIGSERIAL";
      } else {
        if ( length > 0 ) {
          if ( precision > 0 || length > 18 ) {
            // Numeric(Precision, Scale): Precision = total length; Scale = decimal places
            retval += "NUMERIC(" + (length + precision) + ", " + precision + ")";
          } else {
            if ( length > 9 ) {
              retval += "BIGINT";
            } else {
              if ( length < 5 ) {
                retval += "SMALLINT";
              } else {
                retval += "INTEGER";
              }
            }
          }

        } else {
          retval += "DOUBLE PRECISION";
        }
      }
      break;
    case ValueMetaInterface.TYPE_STRING:
      if ( length < 1 || length >= DatabaseMeta.CLOB_LENGTH ) {
        retval += "TEXT";
      } else {
        retval += "VARCHAR(" + length + ")";
      }
      break;
    default:
      retval += " UNKNOWN";
      break;
  }

  if ( add_cr ) {
    retval += Const.CR;
  }

  return retval;
}
 
開發者ID:mattyb149,項目名稱:pdi-drill-jdbc,代碼行數:72,代碼來源:DrillDatabaseMeta.java


注:本文中的org.pentaho.di.core.database.DatabaseMeta.CLOB_LENGTH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。