•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,583 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,677 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1694 | Replies: 0
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
hi to everyone....
I got a problem with queries.... before i tell my problem, please look at the is code -
// employeeCode is ArrayList containing employee codes.
String query = "SELECT Name, FatherName from Employee WHERE ";
for(int i=0; i<employeeCode.size(); i++) {
if(i == 0) {
query += " (EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
} else {
query += OR EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
}
}
query += ")";
Now, this code generate query somewhat like this -
"SELECT Name FatherName FROM Employee WHERE (EmployeeCode = 1 OR EmployeeCode = 2 OR EmployeeCode = 3 ......(and so on)"
My problem is that, employeeCode may have 1000's codes. and this query will become quite lengthy. Can Database engine handle such a long query. I know at some point, it give error message saying "Query is too complex".
I use jdbcodbc database engine.
can you suggest some ohter way.
:rolleyes:
I got a problem with queries.... before i tell my problem, please look at the is code -
// employeeCode is ArrayList containing employee codes.
String query = "SELECT Name, FatherName from Employee WHERE ";
for(int i=0; i<employeeCode.size(); i++) {
if(i == 0) {
query += " (EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
} else {
query += OR EmployeeCode = "+Integer.parseInt((String)
employeeCode.get(i));
}
}
query += ")";
Now, this code generate query somewhat like this -
"SELECT Name FatherName FROM Employee WHERE (EmployeeCode = 1 OR EmployeeCode = 2 OR EmployeeCode = 3 ......(and so on)"
My problem is that, employeeCode may have 1000's codes. and this query will become quite lengthy. Can Database engine handle such a long query. I know at some point, it give error message saying "Query is too complex".
I use jdbcodbc database engine.
can you suggest some ohter way.
:rolleyes:
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Double MySQL Query (PHP)
- MySQL++ query question (C++)
- pagination problem (PHP)
- Need help with the syntax problem (PHP)
- problem with autogenerated mysql query (MySQL)
- Screen goes blank when starting programs (Viruses, Spyware and other Nasties)
- Advanced mySQL Querys (PHP)
- Index with int8 does not work without single quotes !?!? (must read) (Database Design)
Other Threads in the Java Forum
- Previous Thread: Printing in awt
- Next Thread: java price is right game help


Linear Mode