Skip to content

Commit

Permalink
add table test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreampie committed Nov 23, 2016
1 parent f5e7faf commit bed7acd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion resty-example/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ db.default.user=root
db.default.password=
db.default.dialect=mysql
db.default.showSql=true
db.default.modelPackages=cn.dreampie.resource

#c3p0\u914D\u7F6E
c3p0.default.minPoolSize=3
Expand Down
14 changes: 14 additions & 0 deletions resty-example/src/test/java/cn/dreampie/example/SqlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.sql.SQLException;
import java.sql.Types;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
Expand All @@ -32,6 +33,19 @@ public void setUp() throws Exception {
ActiveRecord.init();
}


@Test
public void testTable() {
Record recordDAO = new Record();
String tableName = "tst_" + new Date().getTime();
recordDAO.execute("CREATE TABLE " + tableName + "(id INT NOT NULL AUTO_INCREMENT,name VARCHAR(100) NOT NULL,PRIMARY KEY(id));");
Record tstDAO = new Record(new TableSetting(tableName));
Iterator iterator = tstDAO.getTableMeta().getColumnMetadata().values().iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next().toString());
}
}

@Test
public void testSql() {
Record recordDAO = new Record();
Expand Down

0 comments on commit bed7acd

Please sign in to comment.