- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
def mac_search(*args):
db = MySQLdb.connect(host="localhost",user="test",passwd="test",db="test")
cursor = db.cursor()
cursor.execute('SELECT * FROM ip_groups WHERE mac="%s" AND is_deleted=0;' %args[0].split()[0])
for j in cursor.fetchall():
cursor.execute("SELECT * FROM iptraffic_service_links WHERE ip_group_id=%s and is_deleted=0;" %j[1])
for j1 in cursor.fetchall():
cursor.execute("SELECT * FROM service_links WHERE id=%s AND is_deleted=0;" %j1[0])
for j2 in cursor.fetchall():
cursor.execute("SELECT * FROM accounts WHERE is_deleted=0 AND id=%s AND is_blocked=0;" %j2[2])
for j3 in cursor.fetchall():
cursor.execute("SELECT * FROM service_links WHERE account_id=%s AND is_deleted=0;" %j2[2])
for j4 in cursor.fetchall():
if j4[3]==465 or j4[3]==641:
cursor.execute("SELECT * FROM s_multicast WHERE service_id=%s AND %s>=ip_start AND %s<=ip_end;" %(j4[3],args[0].split()[1],args[0].split()[1]))
for j5 in cursor.fetchall():
return j5
Я конечно понимаю, таким уже не удивить. Но все же.
http://www.python.su/forum/viewtopic.php?pid=76855
Lure Of Chaos 14.09.2011 20:51 # +1
actuator 15.09.2011 00:20 # +1
3.14159265 16.09.2011 11:52 # 0
Python + SQL.
Таких использований лесенок тут я еще не видел.
gegMOPO4 17.09.2011 13:32 # +1
guest8 09.04.2019 11:31 # −999