This file is indexed.

/usr/share/emma/emmalib/mysql_db.py is in emma 0.6-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- coding: utf-8 -*-
# emma
#
# Copyright (C) 2006 Florian Schmidt (flo@fastflo.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

import sys
import traceback
from mysql_table import *

class mysql_db:
	def __init__(self, host, name = None):
		self.handle = host.handle
		self.host = host
		if name != None:
			self.name = name
			self.expanded = False
			self.status_headers = []
			self.tables = {}
		else:
			print "unpickling tables!", self.handle
			for name, table in self.tables.iteritems():
				table.handle = self.handle
		#self.id = id
		
	def __getstate__(self):
		d = dict(self.__dict__)
		for i in ["handle"]:
			del d[i]
		#print "db will pickle:", d
		return d
		
	def refresh(self):
		self.host.select_database(self)
		if not self.host.query("show table status"): return
		new_tables = []
		
		result = self.handle.store_result()
		self.status_headers = []
		for h in result.describe():
			self.status_headers.append(h[0])
		old = dict(zip(self.tables.keys(), range(len(self.tables))))
		for row in result.fetch_row(0):
			if not row[0] in old:
				#print "new table", row[0]
				self.tables[row[0]] = mysql_table(self, row, result.describe())
				new_tables.append(row[0])
			else:
				#print "known table", row[0]
				# todo update self.tables[row[0]] with row!
				del old[row[0]]
				
		for table in old:
			print "destroy table", table
			del self.tables[table]
		return new_tables

	def query(self, query, check_use=True, append_to_log=True):
		self.host.select_database(self)
		return self.host.query(query, check_use, append_to_log)