--- trunk/admin/include/scribe_fix.php 2004/03/04 22:43:17 41
+++ trunk/admin/include/scribe_fix.php 2004/03/04 22:43:50 42
@@ -53,30 +53,30 @@
// Distinct orders
$sql = "SELECT DISTINCT element_order FROM element WHERE page_id ="
. $page_id;
- $rs = mysql_query($sql, $con);
- $num_orders = mysql_num_rows($rs);
+ $rs = xx_query($sql, $con);
+ $num_orders = xx_num_rows($rs);
printf("Unique orders: %d
\n", $num_orders);
// Number of rows (should be the same)
$sql = "SELECT element_id FROM element WHERE page_id = "
. $page_id;
- $rs = mysql_query($sql, $con);
- $num_rows = mysql_num_rows($rs);
+ $rs = xx_query($sql, $con);
+ $num_rows = xx_num_rows($rs);
printf("Number of rows: %d
\n", $num_rows);
// Smallest order (if rows present, should be 1)
$sql = "SELECT MIN(element_order) as min_order FROM element WHERE page_id = "
. $page_id;
- $rs = mysql_query($sql, $con);
- $row = mysql_fetch_array ($rs);
+ $rs = xx_query($sql, $con);
+ $row = xx_fetch_array ($rs);
$min_order = $row["min_order"];
printf("First order: %d
\n", $min_order);
// Largest order (should equal distinct rows and number of rows
$sql = "SELECT MAX(element_order) as max_order FROM element WHERE page_id = "
. $page_id;
- $rs = mysql_query($sql, $con);
- $row = mysql_fetch_array ($rs);
+ $rs = xx_query($sql, $con);
+ $row = xx_fetch_array ($rs);
$max_order = $row["max_order"];
printf("Last order: %d
\n", $max_order);
@@ -88,9 +88,9 @@
$c1_sql = "SELECT element_id, parent_id, element_order, indent_level FROM element WHERE page_id = "
. $page_id
. " AND parent_id > 0 ORDER BY element_order";
- $c1_rs = mysql_query($c1_sql, $con);
+ $c1_rs = xx_query($c1_sql, $con);
- while ($c1_row = mysql_fetch_array ($c1_rs)) {
+ while ($c1_row = xx_fetch_array ($c1_rs)) {
$parent_id = $c1_row["parent_id"];
$indent_level = $c1_row["indent_level"];
$element_id = $c1_row["element_id"];
@@ -99,8 +99,8 @@
// For each row returned, hunt for the parent
$c2_sql ="SELECT element_id, element_order, indent_level FROM element WHERE element_id = "
. $parent_id;
- $c2_rs = mysql_query($c2_sql, $con);
- $c2_row = mysql_fetch_array ($c2_rs);
+ $c2_rs = xx_query($c2_sql, $con);
+ $c2_row = xx_fetch_array ($c2_rs);
$c2_indent_level = $c2_row["indent_level"];
$c2_element_id = $c2_row["element_id"];
$c2_element_order = $c2_row["element_order"];
@@ -172,9 +172,9 @@
. $page_id
. " ORDER BY element_order";
- $rs = mysql_query($sql, $con);
+ $rs = xx_query($sql, $con);
- while ($row = mysql_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs)) {
$element_id = $row["element_id"];
$indent_level = $row["indent_level"];
$parent_id = $row["parent_id"];
@@ -236,8 +236,8 @@
. " AND page_id = "
. $page_id;
- $rs = mysql_query($sql, $con);
- $row = mysql_fetch_array ($rs);
+ $rs = xx_query($sql, $con);
+ $row = xx_fetch_array ($rs);
$probe_parent_id = $row["parent_id"];
$probe_element_id = $row["parent_id"];
@@ -290,8 +290,8 @@
// testing
// printf("orphan probe sql was: %s ", $sql);
- $rs = mysql_query($sql, $con);
- $row = mysql_fetch_array ($rs);
+ $rs = xx_query($sql, $con);
+ $row = xx_fetch_array ($rs);
$par_found = $row["par_found"];
// Should have only one match. If none (or multiple) set to 0.
@@ -331,9 +331,9 @@
. $page_id
. " ORDER BY element_order";
- $rs = mysql_query($sql, $con);
+ $rs = xx_query($sql, $con);
- while ($row = mysql_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs)) {
$element_id = $row["element_id"];
$element_order = $row["element_order"];
$parent_id = $row["parent_id"];
@@ -353,9 +353,9 @@
// printf("delete sql wasd: %s
", $sql);
- if (!mysql_query ($sub_sql, $con)){
+ if (!xx_query ($sub_sql, $con)){
sql_err($sub_sql);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
bailout();
}
else {
@@ -363,7 +363,7 @@
// Output
printf("Element %d was an orphan. Deleted it.
\n", $element_id);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
} // deleted this element
} // delete all elements which are orphaned
@@ -394,15 +394,15 @@
WHERE page_id = "
. $page_id;
- if (!mysql_query ($sql, $con)){
+ if (!xx_query ($sql, $con)){
sql_err($sql);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
bailout();
}
else {
printf("Purged all!
\n");
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
} // purged all!
@@ -494,9 +494,9 @@
. $page_id
. " ORDER BY element_order";
- $rs = mysql_query($sql, $con);
+ $rs = xx_query($sql, $con);
- while ($row = mysql_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs)) {
$element_id = $row["element_id"];
$indent_level = $row["indent_level"];
$parent_id = $row["parent_id"];
@@ -522,15 +522,15 @@
. " AND element_id = "
. $element_id;
- if (!mysql_query ($sub_sql, $con)){
+ if (!xx_query ($sub_sql, $con)){
sql_err($sub_sql);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
bailout();
}
else {
// Output
printf("Element #%d reported generation of %d, but calculated at %d. Fixed.
\n", $element_id, $indent_level, $gen_level);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
} // fixed this element's indent
@@ -571,9 +571,9 @@
. $page_id
. " ORDER BY element_order";
- $rs = mysql_query($sql, $con);
+ $rs = xx_query($sql, $con);
- while ($row = mysql_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs)) {
$element_id = $row["element_id"];
$element_order = $row["element_order"];
@@ -595,16 +595,16 @@
. " AND element_id = "
. $element_id;
- if (!mysql_query ($sub_sql, $con)){
+ if (!xx_query ($sub_sql, $con)){
sql_err($sub_sql);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
bailout();
}
else {
// Output
printf("Row #%d reported cardinal order of %d, but calculated at %d. Fixed.
\n", $element_count, $element_order, $element_count);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
} // fixed this element's order
} // if an order discrepancy was found
@@ -645,9 +645,9 @@
. $page_id
. " ORDER BY element_order";
- $rs = mysql_query($sql, $con);
+ $rs = xx_query($sql, $con);
- while ($row = mysql_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs)) {
$element_id = $row["element_id"];
$element_order = $row["element_order"];
$parent_id = $row["parent_id"];
@@ -671,9 +671,9 @@
. " AND element_id = "
. $element_id;
- if (!mysql_query ($sub_sql, $con)){
+ if (!xx_query ($sub_sql, $con)){
sql_err($sub_sql);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
bailout();
}
else {
@@ -681,7 +681,7 @@
// Output
printf("Element #%d orphaned. Reassigned to parent #%d
\n", $element_id, $new_parent_id);
- mysql_query ("UNLOCK TABLES", $con);
+ xx_query ("UNLOCK TABLES", $con);
} // reassigned this element
} // reassign problematic elements