diff options
Diffstat (limited to 'lib/kross/test/testkexidb.py')
-rw-r--r-- | lib/kross/test/testkexidb.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/kross/test/testkexidb.py b/lib/kross/test/testkexidb.py index 803d6548..c85f9806 100644 --- a/lib/kross/test/testkexidb.py +++ b/lib/kross/test/testkexidb.py @@ -15,36 +15,36 @@ class KexiDBClass: #import KexiDB import krosskexidb self.kexidbmodule = krosskexidb - print "KrossKexiDB version=%s" % self.kexidbmodule.version() + print("KrossKexiDB version=%s" % self.kexidbmodule.version()) # Create and remember the drivermanager. self.drivermanager = self.kexidbmodule.DriverManager() # Print informations about the KexiDB module. def printKexiDB(self): - print "KexiDB = %s %s" % (str(self.kexidbmodule),dir(self.kexidbmodule)) + print("KexiDB = %s %s" % (str(self.kexidbmodule),dir(self.kexidbmodule))) # Each object has __name__ and __doc__ #print "KexiDB.__name__ = %s" % self.kexidbmodule.__name__ #print "KexiDB.__doc__ = %s" % self.kexidbmodule.__doc__ # Print some infos about the drivermanager. - print "drivermanager = %s %s" % (self.drivermanager,dir(self.drivermanager)) + print("drivermanager = %s %s" % (self.drivermanager,dir(self.drivermanager))) # The drivermanager holds a list of drivers he supports. - print "drivermanager.driverNames() = %s" % self.driverNames() + print("drivermanager.driverNames() = %s" % self.driverNames()) # Print informations about a driver. def printDriverManger(self, driver): - print "driver = %s %s" % (driver,dir(driver)) + print("driver = %s %s" % (driver,dir(driver))) # Each driver has a version to be able to determinate with what release we are working. - print "driver.versionMajor() = %s" % driver.versionMajor() - print "driver.versionMinor() = %s" % driver.versionMinor() + print("driver.versionMajor() = %s" % driver.versionMajor()) + print("driver.versionMinor() = %s" % driver.versionMinor()) # Show us what connections are opened right now. - print "driver.connectionsList() = %s" % str(driver.connectionsList()) + print("driver.connectionsList() = %s" % str(driver.connectionsList())) # Print informations about a connection. def printConnection(self, connection): - print "connection = %s %s" % (str(connection),dir(connection)) + print("connection = %s %s" % (str(connection),dir(connection))) # Print a list of all avaible databasenames this connection has. - print "connection.databaseNames() = %s" % connection.databaseNames() + print("connection.databaseNames() = %s" % connection.databaseNames()) # Return a list of drivernames. def driverNames(self): @@ -65,7 +65,7 @@ class KexiDBClass: # Fill the new connectiondata object with what we need to connect. connectiondata.setCaption("myFileConnection") connectiondata.setFileName(filename) - print "connectiondata.serverInfoString = %s" % connectiondata.serverInfoString() + print("connectiondata.serverInfoString = %s" % connectiondata.serverInfoString()) # Create the connection now. connection = driver.createConnection(connectiondata) # Establish the connection. @@ -98,23 +98,23 @@ class KexiDBClass: def testParser(self, connection, sqlstatement): parser = connection.parser() if not parser: - raise "ERROR in testParser(): Failed to create parser!" - print "parser.parse = %s" % parser.parse(sqlstatement) - print "parser.statement = %s" % parser.statement() - print "parser.operation = %s" % parser.operation() - print "parser.table = %s" % parser.table() - print "parser.query = %s" % parser.query() - print "parser.connection = %s" % parser.connection() + raise("ERROR in testParser(): Failed to create parser!") + print("parser.parse = %s" % parser.parse(sqlstatement)) + print("parser.statement = %s" % parser.statement()) + print("parser.operation = %s" % parser.operation()) + print("parser.table = %s" % parser.table()) + print("parser.query = %s" % parser.query()) + print("parser.connection = %s" % parser.connection()) # Execute the sql query statement and print the single string result. def printQuerySingleString(self, connection, sqlstatement): query = myfileconnection.querySingleString("SELECT * FROM table1", 0) - print "querySingleString = %s" % query + print("querySingleString = %s" % query) # Execute the sql query statement and print the single stringlist result. def printQueryStringList(self, connection, sqlstatement): query = myfileconnection.queryStringList("SELECT * FROM table1", 0) - print "queryStringList = %s" % query + print("queryStringList = %s" % query) # Walk through the KexiDBCursor and print all item values. def printQueryCursor(self, cursor): @@ -130,7 +130,7 @@ class KexiDBClass: while(not cursor.eof()): # Print for each item some infos about the fields and there content. for i in range( cursor.fieldCount() ): - print "Item='%s' Field='%s' Value='%s'" % (cursor.at(), i, cursor.value(i)) + print("Item='%s' Field='%s' Value='%s'" % (cursor.at(), i, cursor.value(i))) # Move to the next item cursor.moveNext() @@ -148,7 +148,7 @@ class KexiDBClass: field.setType("Text") field.setName(name) tableschema.fieldlist().addField(field) - print "tableschema.fieldlist().fieldCount() = %s" % tableschema.fieldlist().fieldCount() + print("tableschema.fieldlist().fieldCount() = %s" % tableschema.fieldlist().fieldCount()) return field # Create a table. @@ -156,7 +156,7 @@ class KexiDBClass: # First we need a new tableschema. tableschema = self.drivermanager.tableSchema(tablename) self.addField(tableschema, "myfield") - print "connection.createTable = %s" % connection.createTable(tableschema, True) + print("connection.createTable = %s" % connection.createTable(tableschema, True)) return tableschema # Drop a table. @@ -166,7 +166,7 @@ class KexiDBClass: # Alter the name of a table. def alterTableName(self, connection, tablename, newtablename): tableschema = connection.tableSchema(tablename) - print "alterTableName from=%s to=%s tableschema=%s" % (tablename, newtablename, tableschema) + print("alterTableName from=%s to=%s tableschema=%s" % (tablename, newtablename, tableschema)) connection.alterTableName(tableschema, newtablename) def testKexiDB(): @@ -209,6 +209,6 @@ def testKexiDB(): #del(mydriver) #del(mykexidbclass) -print "########## BEGIN TEST: KexiDB ##########" +print("########## BEGIN TEST: KexiDB ##########") testKexiDB() -print "########## END TEST: KexiDB ##########" +print("########## END TEST: KexiDB ##########") |