@@ -399,10 +399,8 @@ def test_2529_set_rowid_to_string(self):
399399 self .assertRaisesRegex (oracledb .NotSupportedError , "^DPY-3004:" ,
400400 var .setvalue , 0 , "ABDHRYTHFJGKDKKDH" )
401401
402- @unittest .skipIf (test_env .get_is_thin (),
403- "thin mode doesn't support XML type objects yet" )
404402 def test_2530_short_xml_as_string (self ):
405- "2530 - test fetching XMLType object as a string"
403+ "2530 - test fetching XMLType (< 1K) as a string"
406404 self .cursor .execute ("""
407405 select XMLElement("string", stringCol)
408406 from TestStrings
@@ -411,13 +409,11 @@ def test_2530_short_xml_as_string(self):
411409 expected_value = "<string>String 1</string>"
412410 self .assertEqual (actual_value , expected_value )
413411
414- @unittest .skipIf (test_env .get_is_thin (),
415- "thin mode doesn't support XML type objects yet" )
416412 def test_2531_long_xml_as_string (self ):
417- "2531 - test inserting and fetching an XMLType object (1K) as a string"
413+ "2531 - test inserting and fetching XMLType (1K) as a string"
418414 chars = string .ascii_uppercase + string .ascii_lowercase
419415 random_string = '' .join (random .choice (chars ) for _ in range (1024 ))
420- int_val = 200
416+ int_val = 2531
421417 xml_string = '<data>' + random_string + '</data>'
422418 self .cursor .execute ("truncate table TestTempXML" )
423419 self .cursor .execute ("""
@@ -458,5 +454,24 @@ def test_2533_bypass_decode(self):
458454 cursor .execute ("select IntCol, StringCol1 from TestTempTable" )
459455 self .assertEqual (cursor .fetchone (), (1 , string_val ))
460456
457+ @unittest .skipIf (not test_env .get_is_thin (),
458+ "thick mode doesn't support fetching XMLType > VARCHAR2" )
459+ def test_2534_very_long_xml_as_string (self ):
460+ "2534 - test inserting and fetching XMLType (32K) as a string"
461+ chars = string .ascii_uppercase + string .ascii_lowercase
462+ random_string = '' .join (random .choice (chars ) for _ in range (32768 ))
463+ int_val = 2534
464+ xml_string = f"<data>{ random_string } </data>"
465+ lob = self .connection .createlob (oracledb .DB_TYPE_CLOB )
466+ lob .write (xml_string )
467+ self .cursor .execute ("truncate table TestTempXML" )
468+ self .cursor .execute ("""
469+ insert into TestTempXML (IntCol, XMLCol)
470+ values (:1, sys.xmltype(:2))""" , (int_val , lob ))
471+ self .cursor .execute ("select XMLCol from TestTempXML where intCol = :1" ,
472+ (int_val ,))
473+ actual_value , = self .cursor .fetchone ()
474+ self .assertEqual (actual_value .strip (), xml_string )
475+
461476if __name__ == "__main__" :
462477 test_env .run_test_cases ()
0 commit comments