Comments (10)
Have the same issue.
The problem occurs only if you use and/or condition. If there is only one codition, it does not fail.
I tried to add tablePrefix into createSqlSelectCountStar but then it fail on single condition query.
from greendao.
Here is the patch:
diff --git a/DaoCore/src/de/greenrobot/dao/internal/SqlUtils.java b/DaoCore/src/de/greenrobot/dao/internal/SqlUtils.java
index 365f949..42d2f2c 100644
--- a/DaoCore/src/de/greenrobot/dao/internal/SqlUtils.java
+++ b/DaoCore/src/de/greenrobot/dao/internal/SqlUtils.java
@@ -106,9 +106,9 @@ public class SqlUtils {
}
/** Creates SELECT COUNT(*) with a trailing space. */
- public static String createSqlSelectCountStar(String tablename) {
+ public static String createSqlSelectCountStar(String tablename, String tableAlias) {
StringBuilder builder = new StringBuilder("SELECT COUNT(*) FROM ");
- return builder.append(tablename).append(' ').toString();
+ return builder.append(tablename).append(' ').append(tableAlias).append(' ').toString();
}
public static String createSqlDelete(String tablename, String[] columns) {
diff --git a/DaoCore/src/de/greenrobot/dao/query/QueryBuilder.java b/DaoCore/src/de/greenrobot/dao/query/QueryBuilder.java
index 2fcea5e..2a4ca2e 100644
--- a/DaoCore/src/de/greenrobot/dao/query/QueryBuilder.java
+++ b/DaoCore/src/de/greenrobot/dao/query/QueryBuilder.java
@@ -326,9 +326,9 @@ public class QueryBuilder<T> {
*/
public CountQuery<T> buildCount() {
String tablename = dao.getTablename();
- String baseSql = SqlUtils.createSqlSelectCountStar(tablename);
+ String baseSql = SqlUtils.createSqlSelectCountStar(tablename, tablePrefix);
StringBuilder builder = new StringBuilder(baseSql);
- appendWhereClause(builder, tablename);
+ appendWhereClause(builder, tablePrefix);
String sql = builder.toString();
if (LOG_SQL) {
from greendao.
This also happens to me.
from greendao.
+1, please merge this in and re-release
from greendao.
Seems an unsupported project... Moving to ormlite..
from greendao.
@greenrobot, are you still around?
from greendao.
Of course. Like we blogged a month ago, we're currently busy with project work, but are preparing to accept community contribution: http://greendao-orm.com/2013/07/09/community-contributions/
from greendao.
I'm not sure @czsergey wants to sign that for a simple patch. If you really would like that done, though, I can do it and submit the "official" pull request.
from greendao.
Don't worry about signing, I'll fix it during the next days.
from greendao.
fixed in 97c75b9. Watch for 1.3.2 release...
from greendao.
Related Issues (20)
- Is there any plan for supporting gradle 7.0? HOT 2
- open software HOT 1
- incompatible gradle-6.5-bin.zip HOT 1
- Blocker issue in Sonarqube HOT 2
- Openharmony application HOT 1
- 一对多的关系表映射问题 HOT 3
- disk image is malformed (Sqlite code 11 SQLITE_CORRUPT) HOT 1
- How to do data filling, such as populating data from a database in assets into an app HOT 1
- Read this first! Check out our new database
- kotlin version problem HOT 1
- Can I use greenDao in multiple libraries? ------ Look forward to your reply HOT 1
- 什么时候支持协程 HOT 1
- Will a new version be released in the future when a bug occurs in the project? HOT 1
- DaoGenerator.getConfiguration Exception HOT 2
- Lambda 表达式报错 HOT 2
- The project encountered errors after updating Gradle Version 7.6.1 to Gradle Version 8.0+ HOT 40
- when use ’group by‘ ,the result is not expected HOT 1
- Unable to load class 'org.greenrobot.greendao.codemodifier.FormattingOptions'.
- DaoMaster class error HOT 1
- error: cannot find symbol db.execSQL("CREATE TABLE " + constraint + "\ symbol: method makeConcatWithConstants(Lookup,String,MethodType,String) location: interface StringConcatFactory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from greendao.