コード例 #1
0
	def startQuery(self, event=None):
		analyzer =sqlAnalyzer( self.sqlInputEntry.get() )
		analyzer.startAnalyze()
		parser = sqlParser(self.db, analyzer.getAttribList(), analyzer.getTableList(), analyzer.getConditionList() )
		parser.startParse()

		resultCanvas = scrolledCanvas(self.resultWindow, 700, 500)
		resultCanvas.populate(parser.getResult())
コード例 #2
0

if __name__ == "__main__":
	''' do some unit test to make sure this is ok'''

	sqlInput=[]
	sqlInput.append("SELECT Dname, Sname FROM divinity D has_skill H skill S WHERE D.DID=H.DID and h.sid=s.sid and dname='michael'")
	sqlInput.append("SELECT INAME, PRICE FROM IVENTORY I DIVINITY D HAS_EQUIP HE WHERE HE.DID=D.DID AND HE.IID=I.IID")
	sqlInput.append("SELECT *  FROM DIVINITY D WHERE D.DID IN (SELECT HS.DID FROM HAS_SKILL HS WHERE HS.SID IN (SELECT S.SID FROM SKILL S WHERE S.DAMAGE>=20))")
	sqlInput.append("SELECT * FROM EMPLOYEE E, WORKS_ON W, project P WHERE Dno=5 and E.SSN=W.ESSN AND W.PNO=P.PNUMBER AND HOURS>10 AND Pname='ProductX' ")


	db = DataBase.DataBase('DataBase.xml')
	db.createTable()

	table=db.getTable()


	analyzer = sqlAnalyzer(sqlInput[2])
	analyzer.startAnalyze()

	print(analyzer.getAttribList())
	print(analyzer.getTableList())
	print(analyzer.getConditionList())
	print('================================')

	parser = sqlParser(db, analyzer.getAttribList(), analyzer.getTableList(), analyzer.getConditionList())
	parser.startParse()
	print( db.outputTable(parser.getResult()))
		
	#check the list and table, first
コード例 #3
0
        "SELECT Dname, Sname FROM divinity D has_skill H skill S WHERE D.DID=H.DID and h.sid=s.sid and dname='michael'"
    )
    sqlInput.append(
        "SELECT INAME, PRICE FROM IVENTORY I DIVINITY D HAS_EQUIP HE WHERE HE.DID=D.DID AND HE.IID=I.IID"
    )
    sqlInput.append(
        "SELECT *  FROM DIVINITY D WHERE D.DID IN (SELECT HS.DID FROM HAS_SKILL HS WHERE HS.SID IN (SELECT S.SID FROM SKILL S WHERE S.DAMAGE>=20))"
    )
    sqlInput.append(
        "SELECT * FROM EMPLOYEE E, WORKS_ON W, project P WHERE Dno=5 and E.SSN=W.ESSN AND W.PNO=P.PNUMBER AND HOURS>10 AND Pname='ProductX' "
    )

    db = DataBase.DataBase('DataBase.xml')
    db.createTable()

    table = db.getTable()

    analyzer = sqlAnalyzer(sqlInput[2])
    analyzer.startAnalyze()

    print(analyzer.getAttribList())
    print(analyzer.getTableList())
    print(analyzer.getConditionList())
    print('================================')

    parser = sqlParser(db, analyzer.getAttribList(), analyzer.getTableList(),
                       analyzer.getConditionList())
    parser.startParse()
    print(db.outputTable(parser.getResult()))

    #check the list and table, first