I have seen a bad bug in SC for quite sometime, however I was finally able to pinpoint exactly what is happening instead of just a ‘symptom’ of the entire app breaking or doing something unintended.
One example of where this happens:
I have a custom PHP method coded, in which we are running an SQL query. We recently had to change the name of the field in the table this query was accessing (the application was working perfectly for many months before this change).
I edited the query in the PHP method, however you can clearly see in the source code generated, that the OLD QUERY is still present somewhere it shouldn’t be, and whenever I try to run the application, it pops up an error code in the ScriptCase development environment.
Here is the updated PHP Method:
sc_include(core.library.php);
$sql1 = "SELECT MgmtIP FROM ap320 WHERE PMP320BSSID = '{PMP320ConnectedBSSID}'"
. " ORDER BY MgmtIP";
$sql2 = "SELECT Nickname FROM ap320 WHERE PMP320BSSID = '{PMP320ConnectedBSSID}'"
. " ORDER BY Nickname";
sc_lookup(rs1, $sql1);
sc_lookup(rs2, $sql2);
$GSTR2 = {rs1[0][0]};
$GSTR3 = {rs2[0][0]};
$GSTR1="http://$GSTR2";
{APNickname}=$GSTR3;
$link="<a href='$GSTR1' target='_blank'>{APNickname}</a>";
{APLink}=$link;
{APNickname}=$GSTR3;
Once I click on RUN, the following pop up window with an error appears in SC:
SQL ERROR's:
Field:pmp320connectedbssid SELECT PMPIP FROM ap320` WHERE PMP320BSSID = '{PMP320ConnectedBSSID}' ORDER BY PMPIP
()
(which was the OLD query) … the field PMPIP was renamed to MgmtIP in the MySQL database and in the PHP method.
This is a show stopper because I can’t deploy this updated application to our PE until this is fixed for fear that it would display this broken query to an end user (actually I have about half a dozen apps that are affected by this same bug). I can grep the generated source code and see that the old query is STILL in the index.php and one of the class.php files, despite the fact I have updated the php method, and there is no trace of the old field name in the application anymore.
Modifying queries in SC seems to be a big issue … i.e I can edit a query, and if I accidentally get the syntax wrong, it breaks/trashes/destroys the entire app to the point it won’t even load anymore, and correcting the syntax error doesn’t FIX it … and I either have to restore from backup or start over from scratch …
This should not be difficult at all the duplicate …
- Custom PHP method that executes an mySql query.
- Rename a field you are using in the select statement in the DB, then edit your php method to reflect that change
- Watch the pop error appear ...