Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5f11a5

Browse files
authored
Merge pull request#3378 from katzyn/lob
Fix LOBs in data change delta tables
2 parentsccaadc0 +1392152 commitc5f11a5

File tree

7 files changed

+64
-10
lines changed

7 files changed

+64
-10
lines changed

‎h2/src/docsrc/html/changelog.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ <h1>Change Log</h1>
2121

2222
<h2>Next Version (unreleased)</h2>
2323
<ul>
24+
<li>Issue #3376: Data cannot be read after insert of clob data> MAX_LENGTH_INPLACE_LOB with data change delta table
25+
</li>
26+
<li>PR #3377: Add -webExternalNames setting and fix WebServer.getConnection()
27+
</li>
2428
<li>PR #3367: Use faster checks of dimension systems of geometries
2529
</li>
2630
<li>PR #3369: Added v2 changes in migration docs

‎h2/src/main/org/h2/command/Parser.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,10 @@ private Table readDataChangeDeltaTable(String resultOptionName, int backupIndex)
19891989
throwgetSyntaxError();
19901990
}
19911991
read(CLOSE_PAREN);
1992+
if (currentSelect !=null) {
1993+
// Lobs aren't copied, so use it for more safety
1994+
currentSelect.setNeverLazy(true);
1995+
}
19921996
returnnewDataChangeDeltaTable(getSchemaWithDefault(),session,statement,resultOption);
19931997
}
19941998

‎h2/src/main/org/h2/result/LocalResult.java‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public static LocalResult forTable(SessionLocal session, Table table) {
6262
privateintvisibleColumnCount;
6363
privateintresultColumnCount;
6464
privateExpression[]expressions;
65+
privatebooleanforDataChangeDeltaTable;
6566
privatelongrowId,rowCount;
6667
privateArrayList<Value[]>rows;
6768
privateSortOrdersort;
@@ -140,6 +141,13 @@ public void setMaxMemoryRows(int maxValue) {
140141
this.maxMemoryRows =maxValue;
141142
}
142143

144+
/**
145+
* Sets value collection mode for data change delta tables.
146+
*/
147+
publicvoidsetForDataChangeDeltaTable() {
148+
forDataChangeDeltaTable =true;
149+
}
150+
143151
/**
144152
* Create a shallow copy of the result set. The data and a temporary table
145153
* (if there is any) is not copied.
@@ -343,10 +351,14 @@ private void cloneLobs(Value[] values) {
343351
for (inti =0;i <values.length;i++) {
344352
Valuev =values[i];
345353
if (vinstanceofValueLob) {
346-
ValueLobv2 = ((ValueLob)v).copyToResult();
347-
if (v2 !=v) {
354+
if (forDataChangeDeltaTable) {
348355
containsLobs =true;
349-
values[i] =session.addTemporaryLob(v2);
356+
}else {
357+
ValueLobv2 = ((ValueLob)v).copyToResult();
358+
if (v2 !=v) {
359+
containsLobs =true;
360+
values[i] =session.addTemporaryLob(v2);
361+
}
350362
}
351363
}
352364
}

‎h2/src/main/org/h2/server/web/WebThread.java‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,22 @@ private boolean process() throws IOException {
184184
message +="Transfer-Encoding: chunked\r\n";
185185
message +="\r\n";
186186
trace(message);
187-
output.write(message.getBytes());
187+
output.write(message.getBytes(StandardCharsets.ISO_8859_1));
188188
while (it.hasNext()) {
189189
Strings =it.next();
190190
s =PageParser.parse(s,session.map);
191191
bytes =s.getBytes(StandardCharsets.UTF_8);
192192
if (bytes.length ==0) {
193193
continue;
194194
}
195-
output.write(Integer.toHexString(bytes.length).getBytes());
196-
output.write("\r\n".getBytes());
195+
output.write(Integer.toHexString(bytes.length).getBytes(StandardCharsets.ISO_8859_1));
196+
output.write(RN);
197197
output.write(bytes);
198-
output.write("\r\n".getBytes());
198+
output.write(RN);
199199
output.flush();
200200
}
201-
output.write("0\r\n\r\n".getBytes());
201+
output.write('0');
202+
output.write(RNRN);
202203
output.flush();
203204
returnkeepAlive;
204205
}
@@ -217,7 +218,7 @@ private boolean process() throws IOException {
217218
message +="Content-Length: " +bytes.length +"\r\n";
218219
message +="\r\n";
219220
trace(message);
220-
output.write(message.getBytes());
221+
output.write(message.getBytes(StandardCharsets.ISO_8859_1));
221222
output.write(bytes);
222223
output.flush();
223224
returnkeepAlive;
@@ -252,6 +253,9 @@ private boolean checkHost(String host) throws IOException {
252253
if (index >=0) {
253254
host =host.substring(0,index);
254255
}
256+
if (host.isEmpty()) {
257+
returnfalse;
258+
}
255259
if (host.equals(server.getHost()) ||host.equals("localhost") ||host.equals("127.0.0.1")) {
256260
returntrue;
257261
}

‎h2/src/main/org/h2/store/fs/encrypt/FileEncrypt.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
importjava.nio.ByteBuffer;
1111
importjava.nio.channels.FileChannel;
1212
importjava.nio.channels.FileLock;
13+
importjava.nio.charset.StandardCharsets;
1314
importjava.util.Arrays;
1415
importorg.h2.security.AES;
1516
importorg.h2.security.SHA256;
@@ -37,7 +38,7 @@ public class FileEncrypt extends FileBaseDefault {
3738
*/
3839
staticfinalintHEADER_LENGTH =BLOCK_SIZE;
3940

40-
privatestaticfinalbyte[]HEADER ="H2encrypt\n".getBytes();
41+
privatestaticfinalbyte[]HEADER ="H2encrypt\n".getBytes(StandardCharsets.ISO_8859_1);
4142
privatestaticfinalintSALT_POS =HEADER.length;
4243

4344
/**

‎h2/src/main/org/h2/table/DataChangeDeltaTable.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public ResultInterface getResult(SessionLocal session) {
116116
statement.prepare();
117117
intcolumnCount =expressions.length;
118118
LocalResultresult =newLocalResult(session,expressions,columnCount,columnCount);
119+
result.setForDataChangeDeltaTable();
119120
statement.update(result,resultOption);
120121
returnresult;
121122
}

‎h2/src/test/org/h2/test/scripts/other/data-change-delta-table.sql‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,31 @@ SELECT * FROM NEW TABLE (MERGE INTO TEST_VIEW TEST USING
387387

388388
DROPTABLE TEST CASCADE;
389389
> ok
390+
391+
CREATETABLETEST(IDBIGINT, DATA CHARACTER LARGE OBJECT);
392+
> ok
393+
394+
INSERT INTO TESTVALUES (1, REPEAT('A',1000));
395+
>update count:1
396+
397+
SELECT IDFROM FINAL TABLE (INSERT INTO TESTVALUES (2, REPEAT('B',1000)));
398+
>>2
399+
400+
SELECT ID,SUBSTRING(DATAFROM1 FOR2)FROM TEST;
401+
> IDSUBSTRING(DATAFROM1 FOR2)
402+
>-- ----------------------------
403+
>1 AA
404+
>2 BB
405+
> rows:2
406+
407+
@reconnect
408+
409+
SELECT ID,SUBSTRING(DATAFROM1 FOR2)FROM TEST;
410+
> IDSUBSTRING(DATAFROM1 FOR2)
411+
>-- ----------------------------
412+
>1 AA
413+
>2 BB
414+
> rows:2
415+
416+
DROPTABLE TEST;
417+
> ok

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp