Jump to content
TNG Community
Sign in to follow this  
Darrin Lythgoe

Backing out code with the UNION command for MySQL 3x

Recommended Posts

Darrin Lythgoe

If you're using 6.1.1 along with a version of MySQL prior to MySQL 4 and you're seeing SQL errors that contain the MySQL "UNION", then you have three choices:

A. You can upgrade your MySQL to at least v4 (or ask your hosting provider to do it).

B. Switch to a hosting provider that does support MySQL 4 or 5 (a bit drastic, I know).

C. Back the code out. You will not be able to take advantage of the faster queries produced by this new code, but it will function. Here are the things you'll need to change (please pardon any wrapping that may occur):

1. timeline2.php, line 107, replace this line:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, IF(marrdatetr !='0000-00-00',YEAR(marrdatetr),YEAR(marrdatetr)) as marriage FROM $families_table WHERE $families_table.husband = \"$personID\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, IF(marrdatetr !='0000-00-00',YEAR(marrdatetr),YEAR(marrdatetr)) as marriage FROM $families_table WHERE $families_table.wife = \"$personID\" AND gedcom = \"$tree\"";

with this one from the same file in v6.1.0:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, IF(marrdatetr !='0000-00-00',YEAR(marrdatetr),YEAR(marrdatetr)) as marriage FROM $families_table WHERE ($families_table.husband = \"$personID\" OR $families_table.wife = \"$personID\") AND gedcom = \"$tree\"";

2. reglib.php, line 23, replace this line:

$query = "SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE $families_table.wife = \"$personID\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE $families_table.husband = \"$personID\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE ($families_table.wife = \"$personID\" OR $families_table.husband = \"$personID\") AND gedcom = \"$tree\"";

3. reglib.php, line 27, replace this line:

$query = "SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE $families_table.wife = \"$personID\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE $families_table.husband = \"$personID\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID, marrdate, marrplace, marrtype, living, branch FROM $families_table WHERE ($families_table.wife = \"$personID\" OR $families_table.husband = \"$personID\") AND gedcom = \"$tree\"";

4. placesearch.php: The changes are too complicated to back out like this. Just replace the file with the 6.1.0 version.

5. getperson.php, line 273, replace this line:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y %H:%i:%s\") as changedate FROM $families_table WHERE $families_table.husband = \"$personID\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y %H:%i:%s\") as changedate FROM $families_table WHERE $families_table.wife = \"$personID\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y %H:%i:%s\") as changedate FROM $families_table WHERE ($families_table.husband = \"$personID\" OR $families_table.wife = \"$personID\") AND gedcom = \"$tree\"";

6. getperson.php, line 277, replace this line:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y\") as changedate FROM $families_table WHERE $families_table.husband = \"$personID\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y\") as changedate FROM $families_table WHERE $families_table.wife = \"$personID\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID, living, branch, marrdate, marrdatetr, marrplace, marrtype, divdate, divdatetr, divplace, sealdate, sealdatetr, sealplace, DATE_FORMAT(changedate,\"%d %b %Y\") as changedate FROM $families_table WHERE ($families_table.husband = \"$personID\" OR $families_table.wife = \"$personID\") AND gedcom = \"$tree\"";

7. gedcom.php, line 660, replace this line:

$query = "SELECT * FROM $families_table WHERE husband = \"$person\" AND gedcom = \"$tree\" UNION SELECT * FROM $families_table WHERE wife = \"$person\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT * FROM $families_table WHERE (husband = \"$person\" OR wife = \"$person\") AND gedcom = \"$tree\"";

8. descendtext.php, line 50, replace this line:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE $families_table.wife = \"$key\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID FROM $families_table WHERE $families_table.husband = \"$key\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE ($families_table.wife = \"$key\" OR $families_table.husband = \"$key\") AND gedcom = \"$tree\"";

9. descendtext.php, line 54, replace this line:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE $families_table.wife = \"$key\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID FROM $families_table WHERE $families_table.husband = \"$key\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE ($families_table.wife = \"$key\" OR $families_table.husband = \"$key\") AND gedcom = \"$tree\"";

10. descend.php, line 302, replace this line:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE $families_table.wife = \"$person\" AND gedcom = \"$tree\" UNION SELECT husband, wife, familyID FROM $families_table WHERE $families_table.husband = \"$person\" AND gedcom = \"$tree\"";

with this one from the same file in 6.1.0:

$query = "SELECT husband, wife, familyID FROM $families_table WHERE ($families_table.wife = \"$person\" OR $families_table.husband = \"$person\") AND gedcom = \"$tree\"";

Darrin

Share this post


Link to post
Share on other sites
Rob Wood

until i update my server, can you let me know where i can downlod 6.1.0 for the file change??

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×