本文整理汇总了Java中com.j256.ormlite.db.DatabaseType.appendEscapedEntityName方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseType.appendEscapedEntityName方法的具体用法?Java DatabaseType.appendEscapedEntityName怎么用?Java DatabaseType.appendEscapedEntityName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.db.DatabaseType
的用法示例。
在下文中一共展示了DatabaseType.appendEscapedEntityName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendWhereIds
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static void appendWhereIds(DatabaseType paramDatabaseType, FieldType paramFieldType, StringBuilder paramStringBuilder, int paramInt, FieldType[] paramArrayOfFieldType)
{
paramStringBuilder.append("WHERE ");
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, paramFieldType.getColumnName());
paramStringBuilder.append(" IN (");
int i = 1;
for (int j = 0; j < paramInt; j++)
{
if (i != 0)
i = 0;
else
paramStringBuilder.append(',');
paramStringBuilder.append('?');
if (paramArrayOfFieldType != null)
paramArrayOfFieldType[j] = paramFieldType;
}
paramStringBuilder.append(") ");
}
示例2: appendSql
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public void appendSql(DatabaseType paramDatabaseType, String paramString, StringBuilder paramStringBuilder, List<ArgumentHolder> paramList)
{
if ((this.comparison == null) && (this.exists == null))
throw new IllegalStateException("Clause has not been set in NOT operation");
if (this.comparison == null)
{
paramStringBuilder.append("(NOT ");
this.exists.appendSql(paramDatabaseType, paramString, paramStringBuilder, paramList);
}
else
{
paramStringBuilder.append("(NOT ");
if (paramString != null)
{
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, paramString);
paramStringBuilder.append('.');
}
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, this.comparison.getColumnName());
paramStringBuilder.append(' ');
this.comparison.appendOperation(paramStringBuilder);
this.comparison.appendValue(paramDatabaseType, paramStringBuilder, paramList);
}
paramStringBuilder.append(") ");
}
示例3: addDropIndexStatements
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static <T, ID> void addDropIndexStatements(DatabaseType paramDatabaseType, TableInfo<T, ID> paramTableInfo, List<String> paramList)
{
HashSet localHashSet = new HashSet();
for (FieldType localFieldType : paramTableInfo.getFieldTypes())
{
String str2 = localFieldType.getIndexName();
if (str2 != null)
localHashSet.add(str2);
String str3 = localFieldType.getUniqueIndexName();
if (str3 != null)
localHashSet.add(str3);
}
StringBuilder localStringBuilder = new StringBuilder(48);
Iterator localIterator = localHashSet.iterator();
while (localIterator.hasNext())
{
String str1 = (String)localIterator.next();
logger.info("dropping index '{}' for table '{}", str1, paramTableInfo.getTableName());
localStringBuilder.append("DROP INDEX ");
paramDatabaseType.appendEscapedEntityName(localStringBuilder, str1);
paramList.add(localStringBuilder.toString());
localStringBuilder.setLength(0);
}
}
示例4: addDropTableStatements
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static <T, ID> void addDropTableStatements(DatabaseType paramDatabaseType, TableInfo<T, ID> paramTableInfo, List<String> paramList)
{
ArrayList localArrayList1 = new ArrayList();
ArrayList localArrayList2 = new ArrayList();
FieldType[] arrayOfFieldType = paramTableInfo.getFieldTypes();
int i = arrayOfFieldType.length;
for (int j = 0; j < i; j++)
paramDatabaseType.dropColumnArg(arrayOfFieldType[j], localArrayList1, localArrayList2);
StringBuilder localStringBuilder = new StringBuilder(64);
localStringBuilder.append("DROP TABLE ");
paramDatabaseType.appendEscapedEntityName(localStringBuilder, paramTableInfo.getTableName());
localStringBuilder.append(' ');
paramList.addAll(localArrayList1);
paramList.add(localStringBuilder.toString());
paramList.addAll(localArrayList2);
}
示例5: clearTable
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public static int clearTable(ConnectionSource connectionSource, String tableName) throws SQLException {
FieldType[] noFieldTypes = new FieldType[0];
DatabaseType databaseType = connectionSource.getDatabaseType();
StringBuilder sb = new StringBuilder(48);
if (databaseType.isTruncateSupported()) {
sb.append("TRUNCATE TABLE ");
} else {
sb.append("DELETE FROM ");
}
databaseType.appendEscapedEntityName(sb, tableName);
String statement = sb.toString();
Log.i("DatabaseHelper", "clearing table '" + tableName + "' with '" + statement + "'");
CompiledStatement compiledStmt = null;
DatabaseConnection connection = connectionSource.getReadWriteConnection();
try {
compiledStmt =
connection.compileStatement(statement, StatementBuilder.StatementType.EXECUTE, noFieldTypes,
DatabaseConnection.DEFAULT_RESULT_FLAGS);
return compiledStmt.runExecute();
} finally {
if (compiledStmt != null) {
compiledStmt.close();
}
connectionSource.releaseConnection(connection);
}
}
示例6: appendWhereIds
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static void appendWhereIds(DatabaseType databaseType, FieldType idField, StringBuilder sb, int numDatas,
FieldType[] fieldTypes) {
sb.append("WHERE ");
databaseType.appendEscapedEntityName(sb, idField.getColumnName());
sb.append(" IN (");
boolean first = true;
for (int i = 0; i < numDatas; i++) {
if (first) {
first = false;
} else {
sb.append(',');
}
sb.append('?');
if (fieldTypes != null) {
fieldTypes[i] = idField;
}
}
sb.append(") ");
}
示例7: appendSql
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
@Override
public void appendSql(DatabaseType databaseType, String tableName, StringBuilder sb,
List<ArgumentHolder> selectArgList) throws SQLException {
if (comparison == null && exists == null) {
throw new IllegalStateException("Clause has not been set in NOT operation");
}
// this generates: (NOT 'x' = 123 )
if (comparison == null) {
sb.append("(NOT ");
exists.appendSql(databaseType, tableName, sb, selectArgList);
} else {
sb.append("(NOT ");
if (tableName != null) {
databaseType.appendEscapedEntityName(sb, tableName);
sb.append('.');
}
databaseType.appendEscapedEntityName(sb, comparison.getColumnName());
sb.append(' ');
comparison.appendOperation(sb);
comparison.appendValue(databaseType, sb, selectArgList);
}
sb.append(") ");
}
示例8: clearTable
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static <T> int clearTable(ConnectionSource connectionSource, String tableName) throws SQLException {
DatabaseType databaseType = connectionSource.getDatabaseType();
StringBuilder sb = new StringBuilder(48);
if (databaseType.isTruncateSupported()) {
sb.append("TRUNCATE TABLE ");
} else {
sb.append("DELETE FROM ");
}
databaseType.appendEscapedEntityName(sb, tableName);
String statement = sb.toString();
logger.info("clearing table '{}' with '{}", tableName, statement);
CompiledStatement compiledStmt = null;
DatabaseConnection connection = connectionSource.getReadWriteConnection(tableName);
try {
compiledStmt = connection.compileStatement(statement, StatementType.EXECUTE, noFieldTypes,
DatabaseConnection.DEFAULT_RESULT_FLAGS, false);
return compiledStmt.runExecute();
} finally {
IOUtils.closeThrowSqlException(compiledStmt, "compiled statement");
connectionSource.releaseConnection(connection);
}
}
示例9: addDropTableStatements
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
/**
* Generate and return the list of statements to drop a database table.
*/
private static <T, ID> void addDropTableStatements(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
List<String> statements) {
List<String> statementsBefore = new ArrayList<String>();
List<String> statementsAfter = new ArrayList<String>();
for (FieldType fieldType : tableInfo.getFieldTypes()) {
databaseType.dropColumnArg(fieldType, statementsBefore, statementsAfter);
}
StringBuilder sb = new StringBuilder(64);
sb.append("DROP TABLE ");
databaseType.appendEscapedEntityName(sb, tableInfo.getTableName());
sb.append(' ');
statements.addAll(statementsBefore);
statements.add(sb.toString());
statements.addAll(statementsAfter);
}
示例10: appendFieldColumnName
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
static void appendFieldColumnName(DatabaseType paramDatabaseType, StringBuilder paramStringBuilder, FieldType paramFieldType, List<FieldType> paramList)
{
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, paramFieldType.getColumnName());
if (paramList != null)
paramList.add(paramFieldType);
paramStringBuilder.append(' ');
}
示例11: appendTableName
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
static void appendTableName(DatabaseType paramDatabaseType, StringBuilder paramStringBuilder, String paramString1, String paramString2)
{
if (paramString1 != null)
paramStringBuilder.append(paramString1);
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, paramString2);
paramStringBuilder.append(' ');
}
示例12: appendSql
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
public void appendSql(DatabaseType paramDatabaseType, String paramString, StringBuilder paramStringBuilder, List<ArgumentHolder> paramList)
{
if (paramString != null)
{
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, paramString);
paramStringBuilder.append('.');
}
paramDatabaseType.appendEscapedEntityName(paramStringBuilder, this.columnName);
paramStringBuilder.append(' ');
appendOperation(paramStringBuilder);
appendValue(paramDatabaseType, paramStringBuilder, paramList);
}
示例13: clearTable
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
private static <T> int clearTable(ConnectionSource paramConnectionSource, String paramString)
{
DatabaseType localDatabaseType = paramConnectionSource.getDatabaseType();
StringBuilder localStringBuilder = new StringBuilder(48);
if (localDatabaseType.isTruncateSupported())
localStringBuilder.append("TRUNCATE TABLE ");
else
localStringBuilder.append("DELETE FROM ");
localDatabaseType.appendEscapedEntityName(localStringBuilder, paramString);
String str = localStringBuilder.toString();
logger.info("clearing table '{}' with '{}", paramString, str);
Object localObject1 = null;
DatabaseConnection localDatabaseConnection = paramConnectionSource.getReadWriteConnection();
try
{
CompiledStatement localCompiledStatement = localDatabaseConnection.compileStatement(str, StatementBuilder.StatementType.EXECUTE, noFieldTypes);
localObject1 = localCompiledStatement;
int i = localCompiledStatement.runExecute();
return i;
}
finally
{
if (localObject1 != null)
localObject1.close();
paramConnectionSource.releaseConnection(localDatabaseConnection);
}
}
示例14: appendTableName
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
static void appendTableName(DatabaseType databaseType, StringBuilder sb, String prefix, String tableName) {
if (prefix != null) {
sb.append(prefix);
}
databaseType.appendEscapedEntityName(sb, tableName);
sb.append(' ');
}
示例15: appendFieldColumnName
import com.j256.ormlite.db.DatabaseType; //导入方法依赖的package包/类
static void appendFieldColumnName(DatabaseType databaseType, StringBuilder sb, FieldType fieldType,
List<FieldType> fieldTypeList) {
databaseType.appendEscapedEntityName(sb, fieldType.getColumnName());
if (fieldTypeList != null) {
fieldTypeList.add(fieldType);
}
sb.append(' ');
}