source: trunk/scripts/seek-value-in-db.php @ 1184

Revision 1109, 958 bytes checked in by Prostu, 2 years ago (diff)

Added a new button in the page generated by /admin/[round]?action=sterge-runda
that erases all the information regarding the round from the database.
Information relation to a round is found in the following tables:
ia_job_test
ia_job
ia_parameter_value
ia_round_task
ia_user_round
ia_round_task
ia_round

Line 
1#! /usr/bin/env php
2
3<?php
4
5require_once(dirname($argv[0]) . "/utilities.php");
6
7db_connect();
8
9$query ="SELECT T.table_name table_name, C.column_name column_name, C.data_type
10         FROM information_schema.tables T, information_schema.columns C
11         WHERE T.table_name LIKE 'ia_%' AND T.table_name = C.table_name";
12
13$all_columns = db_query($query);
14
15while ($row = db_next_row($all_columns)) {
16    $table_name = $row["table_name"];
17    $column_name = $row["column_name"];
18    $data_type = $row["data_type"];
19
20    if ($data_type == 'varchar') {
21        $query = sprintf("SELECT COUNT(*) count
22                          FROM %s
23                          WHERE `%s` = %s",
24                          db_escape($table_name), db_escape($column_name), db_quote($argv[1]));
25
26        $cnt = db_query_value($query);
27        if ($cnt) {
28            log_print("found " . $argv[1] . " in table " . $table_name . " in column " . $column_name);
29        }
30    }
31}
32
33?>
Note: See TracBrowser for help on using the repository browser.