Esempio n. 1
0
 def test_escape_string(self):
     '''test escape string'''
     try:
         print CUBRIDdb.escape_string('', 1, 1)
     except Exception, e:
         errorValue = str(e)
         print("errorValue: ", errorValue)
Esempio n. 2
0
 def test_escape_string(self):
     '''test escape string'''
     try:
         print CUBRIDdb.escape_string('',1,1)
     except Exception,e:
         errorValue=str(e)
         print("errorValue: ",errorValue)
Esempio n. 3
0
class SetTest(unittest.TestCase):
    def getConStr(self):
        xmlt = minidom.parse('configuration/python_config.xml')
        ips = xmlt.childNodes[0].getElementsByTagName('ip')
        ip = ips[0].childNodes[0].toxml()
        ports = xmlt.childNodes[0].getElementsByTagName('port')
        port = ports[0].childNodes[0].toxml()
        dbnames = xmlt.childNodes[0].getElementsByTagName('dbname')
        dbname = dbnames[0].childNodes[0].toxml()
        conStr = "CUBRID:" + ip + ":" + port + ":" + dbname + ":::"
        return conStr

    def setUp(self):
        conStr = self.getConStr()
        self.con = CUBRIDdb.connect(conStr, "dba", "")
        self.cur = self.con.cursor()

    def tearDown(self):
        self.cur.close
        self.con.close

    def test_escape_string(self):
        '''test escape string'''
        try:
            print CUBRIDdb.escape_string('', 1, 1)
        except Exception, e:
            errorValue = str(e)
            print("errorValue: ", errorValue)
        self.assertEqual(CUBRIDdb.escape_string("cubrid \ Laptop", 1),
                         "cubrid \ Laptop")
        self.assertEqual(CUBRIDdb.escape_string("cubrid \ Laptop", 0),
                         "cubrid \\\\ Laptop")

        try:
            print self.con.escape_string('', 1, 1)
        except Exception, e:
            errorValue = str(e)
            print("errorValue: ", errorValue)