Conflicts: pom.xml src/main/java/com/iciql/Query.javapull/50/head^2
All notable changes to this project will be documented in this file. | All notable changes to this project will be documented in this file. | ||||
This project adheres to [Semantic Versioning](http://semver.org/). | This project adheres to [Semantic Versioning](http://semver.org/). | ||||
### [2.2.1] - 2021-05-02 | |||||
#### Fixed | |||||
- Fix Oracle model generation #35 | |||||
- Improve simple JOIN #36 | |||||
- Several Dependabot updates | |||||
### [2.2.0] - 2017-01-31 | ### [2.2.0] - 2017-01-31 | ||||
#### Added | #### Added | ||||
- Added bitwise AND and XOR DSL for where clauses | - Added bitwise AND and XOR DSL for where clauses | ||||
QueryConditon.smaller => QueryCondition.lessThan | QueryConditon.smaller => QueryCondition.lessThan | ||||
QueryConditon.smallEqual => QueryCondition.atMost | QueryConditon.smallEqual => QueryCondition.atMost | ||||
[unreleased]: https://github.com/gitblit/iciql/compare/release-2.2.0...HEAD | |||||
[unreleased]: https://github.com/gitblit/iciql/compare/release-2.2.1...HEAD | |||||
[2.2.1]: https://github.com/gitblit/iciql/compare/release-2.2.1...release-2.2.0 | |||||
[2.2.0]: https://github.com/gitblit/iciql/compare/release-2.2.0...release-2.1.1 | [2.2.0]: https://github.com/gitblit/iciql/compare/release-2.2.0...release-2.1.1 | ||||
[2.1.1]: https://github.com/gitblit/iciql/compare/release-2.1.0...release-2.1.1 | [2.1.1]: https://github.com/gitblit/iciql/compare/release-2.1.0...release-2.1.1 | ||||
[2.1.0]: https://github.com/gitblit/iciql/compare/release-2.0.0...release-2.1.0 | [2.1.0]: https://github.com/gitblit/iciql/compare/release-2.0.0...release-2.1.0 |
<scm> | <scm> | ||||
<connection>scm:git:git://github.com/gitblit/iciql.git</connection> | <connection>scm:git:git://github.com/gitblit/iciql.git</connection> | ||||
<developerConnection>scm:git:git@github.com/gitblit/iciql.git</developerConnection> | |||||
<developerConnection>scm:git:git@github.com:gitblit/iciql.git</developerConnection> | |||||
<url>https://github.com/gitblit/iciql</url> | <url>https://github.com/gitblit/iciql</url> | ||||
<tag>HEAD</tag> | <tag>HEAD</tag> | ||||
</scm> | </scm> | ||||
<dependency> | <dependency> | ||||
<groupId>mysql</groupId> | <groupId>mysql</groupId> | ||||
<artifactId>mysql-connector-java</artifactId> | <artifactId>mysql-connector-java</artifactId> | ||||
<version>6.0.5</version> | |||||
<version>8.0.16</version> | |||||
<type>jar</type> | <type>jar</type> | ||||
<scope>provided</scope> | <scope>provided</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>com.thoughtworks.xstream</groupId> | <groupId>com.thoughtworks.xstream</groupId> | ||||
<artifactId>xstream</artifactId> | <artifactId>xstream</artifactId> | ||||
<version>1.4.9</version> | |||||
<version>1.4.16</version> | |||||
<type>jar</type> | <type>jar</type> | ||||
<scope>provided</scope> | <scope>provided</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>junit</groupId> | <groupId>junit</groupId> | ||||
<artifactId>junit</artifactId> | <artifactId>junit</artifactId> | ||||
<version>4.11</version> | |||||
<version>4.13.1</version> | |||||
<type>jar</type> | <type>jar</type> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> |
def.appendSelectList(stat, from.getAs()); | def.appendSelectList(stat, from.getAs()); | ||||
} else { | } else { | ||||
def.appendSelectList(stat); | def.appendSelectList(stat); | ||||
} | |||||
} | |||||
appendFromWhere(stat); | appendFromWhere(stat); | ||||
ResultSet rs = stat.executeQuery(); | ResultSet rs = stat.executeQuery(); | ||||
try { | try { |
} | } | ||||
} | } | ||||
if (!col.isAutoIncrement) { | if (!col.isAutoIncrement) { | ||||
col.defaultValue = rs.getString("COLUMN_DEF"); | |||||
if(rs.getType() != ResultSet.TYPE_FORWARD_ONLY) { | |||||
col.defaultValue = rs.getString("COLUMN_DEF"); | |||||
} | |||||
} | } | ||||
columns.put(col.name.toLowerCase(), col); | columns.put(col.name.toLowerCase(), col); | ||||
} | } |
.select(new UserNote() { | .select(new UserNote() { | ||||
{ | { | ||||
userId = n.userId; | userId = n.userId; | ||||
noteId = n.noteId; | |||||
id = n.id; | |||||
text = n.text; | text = n.text; | ||||
} | } | ||||
}); | }); | ||||
assertEquals(3, notes.size()); | assertEquals(3, notes.size()); | ||||
} | } | ||||
@Test | |||||
public void testPrimitiveJoinAndSimpleSelect() throws Exception { | |||||
final UserId u = new UserId(); | |||||
final UserNote n = new UserNote(); | |||||
List<UserId> userIds = db.from(u).innerJoin(n).on(u.id).is(n.userId).where(n.text).is("D") | |||||
.select(); | |||||
assertEquals(1, userIds.size()); | |||||
assertEquals(1, userIds.get(0).id); | |||||
} | |||||
@Test | @Test | ||||
public void testJoin() throws Exception { | public void testJoin() throws Exception { | ||||
final UserId u = new UserId(); | final UserId u = new UserId(); | ||||
public static class UserNote { | public static class UserNote { | ||||
@IQColumn(autoIncrement = true, primaryKey = true) | @IQColumn(autoIncrement = true, primaryKey = true) | ||||
public int noteId; | |||||
public int id; | |||||
@IQColumn | @IQColumn | ||||
public int userId; | public int userId; |
} else if (dbName.equals("Apache Derby")) { | } else if (dbName.equals("Apache Derby")) { | ||||
// Derby uses java.sql.Timestamp not java.util.Date | // Derby uses java.sql.Timestamp not java.util.Date | ||||
// Derby uses username as schema name | // Derby uses username as schema name | ||||
assertEquals(1643, models.get(0).length()); | |||||
assertEquals(1601, models.get(0).length()); | |||||
} else if (dbName.equals("PostgreSQL")) { | } else if (dbName.equals("PostgreSQL")) { | ||||
assertEquals(1643, models.get(0).length()); | assertEquals(1643, models.get(0).length()); | ||||
} else if (dbName.equals("MySQL")) { | } else if (dbName.equals("MySQL")) { |