当前位置: 首页>>代码示例>>Java>>正文


Java FieldType.getGeneratedIdSequence方法代码示例

本文整理汇总了Java中com.j256.ormlite.field.FieldType.getGeneratedIdSequence方法的典型用法代码示例。如果您正苦于以下问题:Java FieldType.getGeneratedIdSequence方法的具体用法?Java FieldType.getGeneratedIdSequence怎么用?Java FieldType.getGeneratedIdSequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.j256.ormlite.field.FieldType的用法示例。


在下文中一共展示了FieldType.getGeneratedIdSequence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildQueryNextSequence

import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
private static String buildQueryNextSequence(DatabaseType paramDatabaseType, FieldType paramFieldType)
{
  if (paramFieldType == null)
    return null;
  String str = paramFieldType.getGeneratedIdSequence();
  if (str == null)
    return null;
  StringBuilder localStringBuilder = new StringBuilder(64);
  paramDatabaseType.appendSelectNextValFromSequence(localStringBuilder, str);
  return localStringBuilder.toString();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:12,代码来源:MappedCreate.java

示例2: configureGeneratedIdSequence

import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
@Override
protected void configureGeneratedIdSequence(StringBuilder sb, FieldType fieldType, List<String> statementsBefore,
                                            List<String> additionalArgs, List<String> queriesAfter) {
    String sequenceName = fieldType.getGeneratedIdSequence();
    // added existence check
    // !! this check will only detect if there is a something with the given name present,
    // even though the object in question might not be a SEQUENCE
    StringBuilder seqSb = new StringBuilder();
    seqSb.append("do $$\nBEGIN\n");
    seqSb.append("IF NOT EXISTS (SELECT 0 FROM pg_class where relname = '");
    seqSb.append(sequenceName);
    seqSb.append("' )\n" +
            "THEN\n" +
            "CREATE SEQUENCE ");
    appendEscapedEntityName(seqSb, sequenceName);
    seqSb.append(";\nEND IF;\nEND\n$$");

    statementsBefore.add(seqSb.toString());

    sb.append("DEFAULT NEXTVAL(");
    // postgres needed this special escaping for NEXTVAL('"sequence-name"')
    sb.append('\'').append('\"').append(sequenceName).append('\"').append('\'');
    sb.append(") ");
    // could also be the type serial for auto-generated sequences
    // 8.2 also have the returning insert statement

    configureId(sb, fieldType, statementsBefore, additionalArgs, queriesAfter);
}
 
开发者ID:Neutrinet,项目名称:ISP-ng,代码行数:29,代码来源:PostgreSQLType.java


注:本文中的com.j256.ormlite.field.FieldType.getGeneratedIdSequence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。