use of com.ctrip.platform.dal.daogen.enums.CurrentLanguage in project dal by ctripcorp.
the class GenTaskBySqlBuilderResource method buildPagingSQL.
@POST
@Path("buildPagingSQL")
public // dbset
Status buildPagingSQL(// dbset
@FormParam("db_name") String db_set_name, // C#风格或者Java风格
@FormParam("sql_style") String sql_style, @FormParam("sql_content") String sql_content) {
Status status = Status.OK();
try {
DatabaseSetEntry databaseSetEntry = BeanGetter.getDaoOfDatabaseSet().getMasterDatabaseSetEntryByDatabaseSetName(db_set_name);
CurrentLanguage lang = "java".equals(sql_style) ? CurrentLanguage.Java : CurrentLanguage.CSharp;
String pagingSQL = SqlBuilder.pagingQuerySql(sql_content, DbUtils.getDatabaseCategory(databaseSetEntry.getConnectionString()), lang);
status.setInfo(pagingSQL);
} catch (Throwable e) {
LoggerManager.getInstance().error(e);
status = Status.ERROR();
status.setInfo(e.getMessage());
return status;
}
return status;
}
use of com.ctrip.platform.dal.daogen.enums.CurrentLanguage in project dal by ctripcorp.
the class GenTaskByFreeSqlResource method buildPagingSQL.
@POST
@Path("buildPagingSQL")
public // dbset// name
Status buildPagingSQL(// dbset// name
@FormParam("db_name") String db_set_name, // C#风格或者Java风格
@FormParam("sql_style") String sql_style, @FormParam("sql_content") String sql_content) {
try {
Status status = Status.OK();
DatabaseSetEntry databaseSetEntry = BeanGetter.getDaoOfDatabaseSet().getMasterDatabaseSetEntryByDatabaseSetName(db_set_name);
CurrentLanguage lang = (sql_content.contains("@") || "csharp".equals(sql_style)) ? CurrentLanguage.CSharp : CurrentLanguage.Java;
String pagingSQL = SqlBuilder.pagingQuerySql(sql_content, DbUtils.getDatabaseCategory(databaseSetEntry.getConnectionString()), lang);
status.setInfo(pagingSQL);
return status;
} catch (Throwable e) {
LoggerManager.getInstance().error(e);
Status status = Status.ERROR();
status.setInfo(e.getMessage());
return status;
}
}
Aggregations