Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
test_fragmented_rollback.inc
1 <?php
28 {
29 
30 
37  public static function getName()
38  {
39  return 'Fragmented Rollback Test';
40 
41  }//end getName()
42 
43 
50  public static function getDescription()
51  {
52  return 'A test to find fragmented rollback entries';
53 
54  }//end getDescription()
55 
56 
66  public static function test(&$messages, &$errors)
67  {
68  // TODO Add in extra verbose information
69  $status = TRUE;
70 
71  // -- sq_ast_attr_val --
72  $sql = 'SELECT count(*) FROM (SELECT assetid, attrid, count(*) AS id FROM sq_rb_ast_attr_val WHERE sq_eff_to is null GROUP BY assetid, attrid HAVING count(*) > 1)';
73  if (MatrixDAL::getDbType() != 'oci') $sql.=' AS rollback';
74  $result = MatrixDAL::executeSqlOne($sql);
75  if (!empty($result)) {
76  $status = FALSE;
77  $messages[] = 'There are '.$result.' fragmented entries on sq_ast_attr_val table';
78  }//end if
79 
80  // -- sq_ast_lookup_value --
81  $sql = 'SELECT count(*) FROM (SELECT url, name, count(*) AS id FROM sq_rb_ast_lookup_value WHERE sq_eff_to is null GROUP BY url, name HAVING count(*) > 1)';
82  if (MatrixDAL::getDbType() != 'oci') $sql.=' AS rollback';
83  $result = MatrixDAL::executeSqlOne($sql);
84  if (!empty($result)) {
85  $status = FALSE;
86  $messages[] = 'There are '.$result.' fragmented entries on sq_ast_lookup_value table';
87  }//end if
88 
89  // -- sq_ast_lookup --
90  $sql = 'SELECT count(*) FROM (SELECT url, assetid, root_urlid, count(*) AS id FROM sq_rb_ast_lookup WHERE sq_eff_to is null GROUP BY url, assetid, root_urlid HAVING count(*) > 1)';
91  if (MatrixDAL::getDbType() != 'oci') $sql.=' AS rollback';
92  $result = MatrixDAL::executeSqlOne($sql);
93  if (!empty($result)) {
94  $status = FALSE;
95  $messages[] = 'There are '.$result.' fragmented entries on sq_ast_lookup table';
96  }//end if
97 
98  // -- sq_ast --
99  $sql = 'SELECT count(*) FROM (SELECT assetid, count(*) AS id FROM sq_rb_ast WHERE sq_eff_to is null GROUP BY assetid HAVING count(*) > 1)';
100  if (MatrixDAL::getDbType() != 'oci') $sql.=' AS rollback';
101  $result = MatrixDAL::executeSqlOne($sql);
102  if (!empty($result)) {
103  $status = FALSE;
104  $messages[] = 'There are '.$result.' fragmented entries on sq_ast table';
105  }//end if
106 
107  return $status;
108 
109  }//end test()
110 
111 }//end class
112 ?>