Aaron
Posts: 145
|
| Posted: 02/05/2007, 1:20 PM |
|
I just upgraded to 3.1.1.0 today and republished my project. I didn't make any code changes. Now some db queries are not working at all. I've turned on debugging for mysql and have found completely incorrect sql statements in the generated code. No where in my code have I asked for it to run a select count statement but this is where the errors are.
I've checked my old (backed up project before upgrading) and this code was not in there.
Anyone else having this issue or know how to solve it?
Regards
Aaron
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 02/05/2007, 2:06 PM |
|
Aaron,
If you have grids in your project, CodeCharge will automatically issue a
Select Count statement.
Make sure you regenerate everything. If you have not manually modified the
common pages, try de;leting them so that CodeCharge can regenerate them.
If you have, take note of the changes which you made, regenerate the default
common pages, and them update your own files.
|
|
|
 |
klwillis
Posts: 428
|
| Posted: 02/05/2007, 2:06 PM |
|
Be sure to republish the *entire* project.
I encountered similar problems myself when upgrading to one of the
earlier versions, so perhaps that may be the root cause of your problems.
Quote Aaron:
I just upgraded to 3.1.1.0 today and republished my project. I didn't make any code changes. Now some db queries are not working at all. I've turned on debugging for mysql and have found completely incorrect sql statements in the generated code. No where in my code have I asked for it to run a select count statement but this is where the errors are.
I've checked my old (backed up project before upgrading) and this code was not in there.
Anyone else having this issue or know how to solve it?
Regards
Aaron
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
Aaron
Posts: 145
|
| Posted: 02/05/2007, 2:18 PM |
|
Thanks for the suggestions guys.
I updated the entire project (F9). I also haven't modified the common.php file.
Funny thing is, I looked at the statement about the grids getting auto COUNT statements and the bug fix they posted on the updates page for CCS 3.1.1.0. Their bug fix said they fixed where it wouldn't make COUNT code if there were multiple select statements. In the issue mentioned here, I have a complex, multi-select statement and that is where CCS is messing up the COUNT statement. Interestingly I also have a very similar query on another page and it *wasn't* updated in this manner. It still does not have a COUNT statement auto-generated.
So, I'm thinking there is still a bug.
Aaron
|
 |
 |
klwillis
Posts: 428
|
| Posted: 02/06/2007, 4:33 PM |
|
Can you provide the custom code "snippet" that is causing the problem?
Quote Aaron:
Thanks for the suggestions guys.
I updated the entire project (F9). I also haven't modified the common.php file.
Funny thing is, I looked at the statement about the grids getting auto COUNT statements and the bug fix they posted on the updates page for CCS 3.1.1.0. Their bug fix said they fixed where it wouldn't make COUNT code if there were multiple select statements. In the issue mentioned here, I have a complex, multi-select statement and that is where CCS is messing up the COUNT statement. Interestingly I also have a very similar query on another page and it *wasn't* updated in this manner. It still does not have a COUNT statement auto-generated.
So, I'm thinking there is still a bug.
Aaron
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
Aaron
Posts: 145
|
| Posted: 02/07/2007, 6:30 AM |
|
You mean the complex query? I have custom code in the page, but not dealing with what's going on. Or do you mean the COUNT (*) query it is making?
Aaron
|
 |
 |
klwillis
Posts: 428
|
| Posted: 02/08/2007, 8:23 PM |
|
Yes, the COUNT(*) query it is making.
More interesting is the other custom code you have - where the COUNT(*)
is *not* being generated.
Quote Aaron:
You mean the complex query? I have custom code in the page, but not dealing with what's going on. Or do you mean the COUNT (*) query it is making?
Aaron
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
Aaron
Posts: 145
|
| Posted: 02/09/2007, 6:23 AM |
|
I'm going crazy here.
After the issue I explained above, I uninstalled 3.1.1.0 and reinstalled 3.1.0.2 so I could get some work done. I didn't save anything 3.1.1.0 generated and picked up where I left off on my backed up code.
This morning I backed everything up (again) and reinstalled 3.1.1.0. F9 the project and went to go look at the error. I noticed now my grid page, while it still won't count all the records (gives the "CCS not counted" in the label) it only shows page 1 of 1 for the grid. I know for a fact this is not the case. I opened the query builder in CCS, copied all the SQL, opened Navicat and ran the query after changing CCS's ... LIKE '%{s_status}%' to ... LIKE '%' so Navicat could read it. Basically stripping out the variable names CCS is using.
That result set was over 800. I'm really confused now as to what is going on. It seems CCS is just making up code or not even running what it should.
But to reply to your query about my complex select query for which COUNT(*) isn't being created, here it is:
SELECT
Rx.rxControlCode,
Person.nameLast,
Person.nameFirst,
Person.phoneHome,
Person.socialSecurityNumber,
Person.PersonID,
physicianNameLast,
rxPhysicianID,
PracticeID,
RxStatusHistory.statusChangeDate,
RxStatusHistory.statusChangeTime,
RxStatusHistory.nextActionDate,
RxStatusHistory.nextActionTime,
RxClaimID,
rxStatusDescr,
Rx.RxID,
organizationName
FROM
Rx
LEFT Join RxClaim ON (RxClaim.RxID = Rx.RxID)
Inner Join Person ON (Person.PersonID = Rx.PatientID)
Inner Join Organization ON (Organization.OrganizationID =Rx.PracticeID),
( SELECT RxID, RxStatusHistory.RxStatusHistoryID, RxStatusHistory.statusChangeDate, RxStatusID, nextActionDate
FROM RxStatusHistory,
(
SELECT SUBSTRING_INDEX(MAX(CONCAT(statusChangeDate, '-', RxStatusHistoryID)), '-', -1) AS RxSHID
FROM RxStatusHistory
GROUP BY RxID
ORDER BY RxStatusHistoryID ASC) AS RxSH
WHERE RxSH.RxSHID = RxStatusHistory.RxStatusHistoryID
) AS RxSHMax,
( SELECT DISTINCT RxID, Person.nameLast AS physicianNameLast, Person.nameFirst AS physicianNameFirst
FROM Rx, Physician, Person
WHERE Rx.rxPhysicianID = Physician.PhysicianID
AND Physician.PersonID = Person.PersonID
) AS TempPhysician
Inner Join RxStatusHistory ON (RxStatusHistory.RxID = TempPhysician.RxID)
Inner Join RxStatus ON (RxStatus.RxStatusID = RxStatusHistory.RxStatusID)
WHERE RxSHMax.RxID = Rx.RxID
AND TempPhysician.RxID = Rx.RxID
AND RxSHMax.RxStatusHistoryID = RxStatusHistory.RxStatusHistoryID
AND Rx.PatientID = Person.PersonID
AND Person.nameLast LIKE '%{s_nameLast}%'
AND Person.nameFirst LIKE '%{s_nameFirst}%'
AND (
Person.socialSecurityNumber LIKE '%{s_socialSecurityNumber}%'
OR Person.socialSecurityNumber IS NULL
)
AND Rx.rxControlCode LIKE '%{s_rxControlCode}%'
AND (
RxStatusHistory.nextActionDate LIKE '%{s_nextActionDate}%'
OR RxStatusHistory.nextActionDate IS NULL
)
AND physicianNameLast LIKE '%{s_physicianLast}%'
AND rxStatusDescr LIKE '%{s_status}%'
ORDER BY RxStatusHistory.statusChangeDate DESC
Below is the select statement for which the COUNT(*) is being corrupted somehow:
SELECT DISTINCT
Address.AddressID,
Address.addressStreet,
Address.addressBuilding,
Address.addressSuite,
Address.addressCity,
Address.addressState,
Address.addressPostalCode,
AddressType.addressTypeName,
Rx.rxControlCode,
Person.nameLast,
Person.nameFirst,
Person.nameMiddle1,
Person.dateOfBirth,
Person.phoneHome,
Person.phoneWork,
Person.phoneCell,
Person.emailAddressPrimary,
Person.socialSecurityNumber,
Person.PersonID,
physicianNameLast,
physicianNameFirst,
rxPhysicianID,
PracticeID,
Rx.RxID,
Organization.organizationName
FROM
Organization AS Org,
PersonOrganization,
PersonOrganizationAddress,
Address,
AddressType,
AddressAddressType,
Rx
Inner Join Person ON (Person.PersonID = Rx.PatientID)
Inner Join Organization ON (Organization.OrganizationID =Rx.PracticeID),
( SELECT DISTINCT RxID, Person.nameLast AS physicianNameLast, Person.nameFirst AS physicianNameFirst
FROM Rx, Physician, Person
WHERE Rx.rxPhysicianID = Physician.PhysicianID
AND Physician.PersonID = Person.PersonID
) AS TempPhysician
WHERE TempPhysician.RxID = Rx.RxID
AND Rx.PatientID = Person.PersonID
AND Person.PersonID = PersonOrganization.PersonID
AND PersonOrganization.OrganizationID = Org.OrganizationID
AND PersonOrganizationAddress.PersonOrganizationID = PersonOrganization.PersonOrganizationID
AND PersonOrganizationAddress.AddressID = Address.AddressID
AND AddressAddressType.AddressID = Address.AddressID
AND AddressAddressType.AddressTypeID = AddressType.AddressTypeID
AND Person.PersonID = {PersonID}
AND Rx.rxControlCode = {rxControlCode}
Turning on debugging in db_mysql.php and republishing the page, I see the code CCS is generating. If I copy and paste it in Navicat, Navicat will also throw the error:
Database Error: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near ') AS TempPhysician
WHERE TempPhysician.RxID = Rx.RxID AND Rx.PatientID = Person' at line 7
Here is the problematic COUNT(*) CCS is making:
Debug: query = SELECT COUNT(*) FROM Rx, Physician, Person
WHERE Rx.rxPhysicianID = Physician.PhysicianID
AND Physician.PersonID = Person.PersonID ) AS TempPhysician
WHERE TempPhysician.RxID = Rx.RxID AND Rx.PatientID = Person.PersonID
AND Person.PersonID = PersonOrganization.PersonID
AND PersonOrganization.OrganizationID = Org.OrganizationID
AND PersonOrganizationAddress.PersonOrganizationID = PersonOrganization.PersonOrganizationID
AND PersonOrganizationAddress.AddressID = Address.AddressID
AND AddressAddressType.AddressID = Address.AddressID
AND AddressAddressType.AddressTypeID = AddressType.AddressTypeID
AND Person.PersonID = 63541
AND Rx.rxControlCode = 0701311200005
NOTE: I inserted line breaks above for readability
As you can see, there is no way this statement is even close to valid. I do not know why CCS is doing what's doing here.
Following that bad COUNT(*) statement, my complex select as pasted above should run (and does if published with an earlier version of CCS).
So I have to believe it is something CCS is doing. Keep in mind, none of this code was changed or modified between the two versions of CCS. I can go back to the old version, republish and it will work fine again.
Regards,
Aaron
|
 |
 |
klwillis
Posts: 428
|
| Posted: 02/09/2007, 7:51 PM |
|
Health information ... right up my ally. :)
You've verified that this complex query is working in CCS 3.0.1.2, so it appears
that the SQL itself is not being parsed correctly for some reason in the newer release.
Do either of the following where possible . . .
(1) Simply the query
(2) Replace inner-joins with direct key assignments (as you've done elsewhere with the where clause)
(3) Add parentheses around the left-join expressions.
After simplying this query to the extent you can, rebuild the project under CCS 3.0.1.2
to verify you get the same results.
Then, attempt to get this running under CCS 3.1.1.0
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
AnnaVA
Posts: 1
|
| Posted: 02/10/2007, 12:53 AM |
|
Hey, I had the same problem but problem really in the common files. I fix the common files and generate them over ..and it worked: server didn't show me problem with sql . However, I run into another problem.. all my old files don't show in browser just blank page. Tried to creat new pages..Couldn't even simple new grid to work, but could create report and record.and they worked in browser just fine.. Gallery didn't work either. Everything that contained word grid in code didn't work..
Still can not to understand what was wrong but i simply create new project from the examples ; and adjust common file according my server , copy in this folder all my pages that was generated from old version to new one(and didn't work before).. And guess what? Everything work now.. My guess , is that when is generate pages from old version to new one , it is some bug in common files code.
|
 |
 |
Aaron
Posts: 145
|
| Posted: 02/14/2007, 2:03 PM |
|
Kevin,
Yep. Health information. Fun eh? :)
While I'd love to continue trouble shooting this, I just can't take the time to get this working with the latest version when I can at least deal with and know about the problems in 3.0.1.2. Installing and reinstalling isn't worth it for me right now. Every time I upgrade I have to jump through more hoops to get my projects working again. There shouldn't be any reason a properly formed query should have to be massaged to work with CCS.
I appreciate your suggestions. They were right on track with what I was thinking (dreading) I'd have to do as well. If I stumble upon the magic solution I'll be sure to post it here.
Thanks.
Aaron
|
 |
 |
peterr
Posts: 5971
|
| Posted: 02/14/2007, 2:20 PM |
|
> Anyone else having this issue or know how to solve it?
Yep, product support.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
klwillis
Posts: 428
|
| Posted: 02/21/2007, 8:40 AM |
|
In the meantime, I'll stick with CCS 3.0.1.2
I'm curious to know the solution to this myself and look forward to your future posting.
Quote Aaron:
Kevin,
Yep. Health information. Fun eh? :)
While I'd love to continue trouble shooting this, I just can't take the time to get this working with the latest version when I can at least deal with and know about the problems in 3.0.1.2. Installing and reinstalling isn't worth it for me right now. Every time I upgrade I have to jump through more hoops to get my projects working again. There shouldn't be any reason a properly formed query should have to be massaged to work with CCS.
I appreciate your suggestions. They were right on track with what I was thinking (dreading) I'd have to do as well. If I stumble upon the magic solution I'll be sure to post it here.
Thanks.
Aaron
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
Aaron
Posts: 145
|
| Posted: 02/22/2007, 12:07 PM |
|
Hey Kevin. Sorry I haven't gotten back to this thread sooner.
I contacted support about this issue. I basically said, "I posted about this on the forums, here's the link." They came back with the following:
Quote :
Please open ..\CodeChargeStudio3\Components\Databases\MySQL.xml files
And replace
supportSelectFromSelect="False"
with
supportSelectFromSelect="True"
Then re-start CCS and regenerate the page. CountSQL should be built in a different way and that should resolve the problem.
My guess is either the install process should have fixed this or some sort of upgrade script should have (did?) run when upgrading and modified this file appropriately. Some files in my project worked after upgrading, other didn't. Once I followed their suggestion all files worked.
I don't know about you or anyone else, but I have many files that I've either abandoned but don't want to modify/lose or files that were half started in my projects. Republishing the whole project can be a PITA. Maybe I just have a poor way of managing the projects (wouldn't surprise me!).
|
 |
 |
wkempees
|
| Posted: 02/23/2007, 12:46 AM |
|
Aaron,
Thanks for posting this, in fact it has been mentioned in some other thread.
I imagine that Support has also asked you what version of MySQL you are
using?
Or is this solution independent of the MySQL capabilities?
Any idea?
Walter
|
|
|
 |
wkempees
|
| Posted: 02/23/2007, 12:49 AM |
|
cont'd:
http://forums.codecharge.com/posts.php?post_id=81316&s_...electFromSelect http://forums.codecharge.com/posts.php?post_id=62687&s_...electFromSelect
Walter
This is one for the FAQ Knowledgebase and Tips and Solutions!
"wkempees" <kempe819@planet.nl> schreef in bericht
news:erm9lu$m8c$1@news.codecharge.com...
>
> Aaron,
>
> Thanks for posting this, in fact it has been mentioned in some other
> thread.
> I imagine that Support has also asked you what version of MySQL you are
> using?
> Or is this solution independent of the MySQL capabilities?
> Any idea?
>
> Walter
>
>
|
|
|
 |
Aaron
Posts: 145
|
| Posted: 02/23/2007, 9:12 AM |
|
I mentioned my version of mysql in the request for support so I have no idea if this is dependent on mysql version and/or capabilities.
I agree it needs to be documented somewhere. I find it odd that prior to this version upgrade some worked and others didn't. Anyway....
Thanks for the heads up on that one. Hope others find this thread and information useful.
Aaron
|
 |
 |
klwillis
Posts: 428
|
| Posted: 02/23/2007, 12:17 PM |
|
Aaron -
Thanks for the post.
Glad all is working now for you.
- Kevin
Quote Aaron:
I mentioned my version of mysql in the request for support so I have no idea if this is dependent on mysql version and/or capabilities.
I agree it needs to be documented somewhere. I find it odd that prior to this version upgrade some worked and others didn't. Anyway....
Thanks for the heads up on that one. Hope others find this thread and information useful.
Aaron
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
wkempees
|
| Posted: 02/24/2007, 1:46 AM |
|
MySQL supports subselects as of version 4.1.x
So for earlier versions (3.2 and 4.0 still widely in use) CCS would create
erroneous SELECTS.
SELECT * from table1 where table1.id = (SELECT id from table2 where ..... )
Walter
|
|
|
 |
Aaron
Posts: 145
|
| Posted: 07/31/2007, 1:45 PM |
|
Glad I posted this last time I upgraded. Ran into this again with the upgrade from 3.1.x to 3.2.x.
|
 |
 |
|