-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathObject.py
31 lines (25 loc) · 816 Bytes
/
Object.py
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
from exeSQL import SQL
#debug=True
debug=False
class Object:
def __init__(self,primaryKey):
self.head=[]
self.results=[]
self.sql="show databases"
def getDataFromDB(self):
self.head=[]
self.results=[]
lines=SQL(self.sql).split("\n")
self.head=lines[0].split("\t");
for i in range(1,len(lines)) :# the results of i line.i begin from 1
iLine=lines[i].split("\t")
if(debug):
print "iLine:", iLine
line=[]
for word in iLine:#if the word is a null string ,replace it as ''
if(word.strip() == ""):
word="''"
line.append(word)
if(debug):
print "line:",line
self.results.append( line )