|
1 | 1 | package com.xxdb; |
2 | 2 |
|
3 | 3 | import com.alibaba.fastjson2.JSONObject; |
| 4 | +import com.sun.org.apache.xml.internal.utils.StringVector; |
4 | 5 | import com.xxdb.data.Dictionary; |
5 | 6 | import com.xxdb.data.Vector; |
6 | 7 | import com.xxdb.data.*; |
@@ -5057,6 +5058,39 @@ public void test_DBConnection_upload_illegal_string() throws IOException { |
5057 | 5058 | assertEquals("", table2.getColumn(3).get(1).getString()); |
5058 | 5059 | assertEquals("blob1AMZN", table2.getColumn(3).get(2).getString()); |
5059 | 5060 | } |
| 5061 | + @Test |
| 5062 | + public void test_DBConnection_upload_illegal_string1() throws IOException { |
| 5063 | + DBConnection connection = new DBConnection(); |
| 5064 | + connection.connect(HOST, PORT, "admin", "123456"); |
| 5065 | + |
| 5066 | + BasicString sv = new BasicString("blob1AM\0ZN"); |
| 5067 | + Map<String, Entity> upObj = new HashMap<String, Entity>(); |
| 5068 | + upObj.put("SV", (Entity) sv); |
| 5069 | + conn.upload(upObj); |
| 5070 | + Entity sv1 = conn.run("SV;\n"); |
| 5071 | + Assert.assertEquals("blob1AM",sv1.getString()); |
| 5072 | + } |
| 5073 | + @Test |
| 5074 | + public void test_DBConnection_upload_ASCII_char() throws IOException { |
| 5075 | + DBConnection connection = new DBConnection(); |
| 5076 | + connection.connect(HOST, PORT, "admin", "123456"); |
| 5077 | + |
| 5078 | + for (int i = 1; i <= 0x7F; i++) { |
| 5079 | + char c = (char) i; |
| 5080 | + System.out.printf("Unicode: \\u%04X | Dec: %3d | Char: %s%n", |
| 5081 | + i, i, |
| 5082 | + (i < 32 || i == 127) ? "[控制字符]" : c); |
| 5083 | + BasicString sv = new BasicString(String.valueOf(c)); |
| 5084 | + Map<String, Entity> upObj = new HashMap<String, Entity>(); |
| 5085 | + upObj.put("SV", (Entity) sv); |
| 5086 | + conn.upload(upObj); |
| 5087 | + Entity sv1 = conn.run("SV;\n"); |
| 5088 | + if (i != 13){ |
| 5089 | + Assert.assertEquals(sv1,(Entity)sv); |
| 5090 | + } |
| 5091 | + } |
| 5092 | + } |
| 5093 | + |
5060 | 5094 | @Test |
5061 | 5095 | public void test_DBConnection_run_ASCII_char() throws IOException, InterruptedException { |
5062 | 5096 | DBConnection connection = new DBConnection(); |
@@ -5106,7 +5140,7 @@ public void test_connection_enableSeqNo_true() throws Exception { |
5106 | 5140 | assertEquals(30000, res2.rows()); |
5107 | 5141 | connection.close(); |
5108 | 5142 | } |
5109 | | - |
| 5143 | + |
5110 | 5144 | @Test |
5111 | 5145 | public void test_connection_enableSeqNo_false() throws Exception { |
5112 | 5146 | DBConnection connection = new DBConnection(false, false, false); |
|
0 commit comments