com.healthmarketscience.sqlbuilder.dbspec.basic.DbSpec Java Examples
The following examples show how to use
com.healthmarketscience.sqlbuilder.dbspec.basic.DbSpec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlBuilderTest.java From sqlbuilder with Apache License 2.0 | 5 votes |
public void testCustomPrefix() throws Exception { DbTable table = new DbSpec("pre_").addDefaultSchema().addTable("NewTable"); table.addColumn("col1"); table.addColumn("col2"); String sqlStr = new SelectQuery().addAllTableColumns(table) .validate().toString(); checkResult(sqlStr, "SELECT pre_0.* FROM NewTable pre_0"); }
Example #2
Source File: PhysicalSchema.java From olaper with MIT License | 4 votes |
public DbSpec getDbSpec() { return dbSpec; }
Example #3
Source File: BaseSqlTestCase.java From sqlbuilder with Apache License 2.0 | 4 votes |
@Override protected void setUp() throws Exception { _spec = new DbSpec(); _schema1 = _spec.addSchema("Schema1"); _defSchema = _spec.addDefaultSchema(); _table1 = _schema1.addTable("Table1"); _table1_col1 = _table1.addColumn("col1", "VARCHAR", 213); _table1_col2 = _table1.addColumn("col2", "NUMBER", 7); _table1_col3 = _table1.addColumn("col3", Types.DECIMAL, 4, 8); _defTable1 = _defSchema.addTable("Table1"); _defTable1_col_id = _defTable1.addColumn("col_id", "NUMBER", null); _defTable1_col2 = _defTable1.addColumn("col2", Types.VARCHAR, 64).setDefaultValue("blah"); _defTable1_col3 = _defTable1.addColumn("col3", Types.DATE, null, null); _defTable2 = _defSchema.addTable("Table2"); _defTable2_col_id = _defTable2.addColumn("col_id", "NUMBER", null); _defTable2_col_id.notNull(); _defTable2_col_id.primaryKey("col_id_pk"); _defTable2_col4 = _defTable2.addColumn("col4", "VARCHAR", 64); _defTable2_col5 = _defTable2.addColumn("col5", "DATE", null, null); _defTable2.foreignKey("t2_fk", new String[]{"col4","col5"}, null, "Table1", new String[]{"col2", "col3"}); _defTable2.checkCondition("neq_cond", BinaryCondition.notEqualTo( _defTable2_col4, _defTable2_col5)); _idJoin = _spec.addJoin(null, "Table1", null, "Table2", "col_id"); _table1.addColumn("col4", Types.VARCHAR, 255); _defTable1.addColumn("altCol4", Types.VARCHAR, 255); _col4Join = _spec.addJoin("Schema1", "Table1", null, "Table1", new String[]{"col4"}, new String[]{"altCol4"}); _defTable3 = _defSchema.addTable("DefTable3"); _defTable3_col_id = _defTable3.addColumn("col_id", "NUMBER", null); _defTable3_col_id.references("t2_id_fk", _table1, _table1_col2); }