marshal.diff
src/com/goldencode/p2j/persist/DynamicTablesHelper.java 2022-10-18 07:43:22 +0000 | ||
---|---|---|
832 | 832 |
tableField.putAnnotation("col_lab", field.getColumnLabel()); |
833 | 833 |
} |
834 | 834 |
|
835 |
if (field.getCodePage() != null)
|
|
835 |
if (!org.apache.commons.lang3.StringUtils.isEmpty(field.getCodePage()))
|
|
836 | 836 |
{ |
837 |
tableField.putAnnotation("codePage", field.getCodePage());
|
|
837 |
tableField.putAnnotation("column-codepage", field.getCodePage());
|
|
838 | 838 |
} |
839 | 839 | |
840 | 840 |
if (field.isSerializeHidden()) |
src/com/goldencode/p2j/persist/PropertyDefinition.java 2022-10-29 16:20:33 +0000 | ||
---|---|---|
17 | 17 |
** SVL 20201030 Added format, label and columnLabel fields. |
18 | 18 |
** OM 20201120 Added SCHEMA-MARSHAL implementation. |
19 | 19 |
** CA 20220909 Always marshal the schema, otherwise the remote side will not be able to rebuild the table. |
20 |
** IAS 20221029 Added support for missed properties. |
|
20 | 21 |
*/ |
21 | 22 | |
22 | 23 |
/* |
... | ... | |
76 | 77 | |
77 | 78 |
import java.io.*; |
78 | 79 |
import java.util.*; |
80 | ||
81 |
import com.goldencode.p2j.persist.orm.*; |
|
82 |
import com.goldencode.p2j.util.*; |
|
83 | ||
79 | 84 |
import static com.goldencode.p2j.persist.AbstractTempTable.*; |
80 | 85 |
import static com.goldencode.util.NativeTypeSerializer.*; |
81 | 86 | |
... | ... | |
117 | 122 |
|
118 | 123 |
/** The column label of this property. */ |
119 | 124 |
private String columnLabel; |
120 |
|
|
125 | ||
126 |
/** HELP attribute of this field. */ |
|
127 |
private String help; |
|
128 |
|
|
129 |
/** INITIAL attribute of this field. */ |
|
130 |
private String initial; |
|
131 | ||
132 |
/** Flag indicating the field should not be included in serialized output. */ |
|
133 |
private boolean serializeHidden; |
|
134 |
|
|
135 |
/** Flag indicating the field is case-sensitive. */ |
|
136 |
private boolean caseSensitive; |
|
137 | ||
138 |
/** Node type of field in XML output. */ |
|
139 |
private String xmlNodeType; |
|
140 |
|
|
141 |
/** Code page of the CLOB field. */ |
|
142 |
private String codePage; |
|
143 | ||
121 | 144 |
/** |
122 | 145 |
* The SCHEMA-MARSHAL level for the parent temp-table. It is never {@code SM_DEFAULT} when object is to |
123 | 146 |
* be serialized. Always {@code SM_DEFAULT} for a read object. |
... | ... | |
303 | 326 |
this.label = label; |
304 | 327 |
this.columnLabel = columnLabel; |
305 | 328 |
} |
306 |
|
|
329 | ||
330 |
/** |
|
331 |
* Create a new property definition. |
|
332 |
* |
|
333 |
* @param prop |
|
334 |
* The ORM field <code>Property</code>. |
|
335 |
*/ |
|
336 |
public PropertyDefinition(Property prop) |
|
337 |
{ |
|
338 |
this.name = prop.name; |
|
339 |
verifyType(prop._fwdType); |
|
340 |
this.type = prop._fwdType; |
|
341 |
int extent = prop.index > 0 ? 0 : prop.extent; |
|
342 |
this.extent = extent == 0 ? NO_EXTENT : extent; |
|
343 |
this.legacyName = prop.legacy; |
|
344 |
this.format = prop.format; |
|
345 |
this.label = prop.label; |
|
346 |
this.columnLabel = prop.columnLabel; |
|
347 |
this.help = prop.help; |
|
348 |
this.initial = prop.initial; |
|
349 |
this.serializeHidden = prop.serializeHidden; |
|
350 |
this.caseSensitive = prop.caseSensitive; |
|
351 |
this.xmlNodeType = prop.xmlNodeType; |
|
352 |
this.codePage = prop.codePage; |
|
353 |
} |
|
307 | 354 |
/** |
308 | 355 |
* Get the type of this property. |
309 | 356 |
* |
... | ... | |
385 | 432 |
} |
386 | 433 | |
387 | 434 |
/** |
435 |
* Get help text of this property. |
|
436 |
* |
|
437 |
* @return help text of this property. |
|
438 |
*/ |
|
439 |
public String getHelp() |
|
440 |
{ |
|
441 |
return help; |
|
442 |
} |
|
443 | ||
444 |
/** |
|
445 |
* Get initial value of this property. |
|
446 |
* |
|
447 |
* @return initial value of this property. |
|
448 |
*/ |
|
449 |
public String getInitial() |
|
450 |
{ |
|
451 |
return initial; |
|
452 |
} |
|
453 | ||
454 |
/** |
|
455 |
* Get 'serialize hidden' flag of this property. |
|
456 |
* |
|
457 |
* @return 'serialize hidden' flag of this property. |
|
458 |
*/ |
|
459 |
public boolean isSerializeHidden() |
|
460 |
{ |
|
461 |
return serializeHidden; |
|
462 |
} |
|
463 | ||
464 |
/** |
|
465 |
* Get 'case-sensitive' flag of this property. |
|
466 |
* |
|
467 |
* @return 'case-sensitive' flag of this property. |
|
468 |
*/ |
|
469 |
public boolean isCaseSensitive() |
|
470 |
{ |
|
471 |
return caseSensitive; |
|
472 |
} |
|
473 | ||
474 |
|
|
475 |
/** |
|
476 |
* Get XML node type of this property. |
|
477 |
* |
|
478 |
* @return XML node type of this property. |
|
479 |
*/ |
|
480 |
public String getXmlNodeType() |
|
481 |
{ |
|
482 |
return xmlNodeType; |
|
483 |
} |
|
484 | ||
485 |
/** |
|
486 |
* Get code page of this property. |
|
487 |
* |
|
488 |
* @return code page of this property. |
|
489 |
*/ |
|
490 |
public String getCodePage() |
|
491 |
{ |
|
492 |
return codePage; |
|
493 |
} |
|
494 | ||
495 |
/** |
|
388 | 496 |
* Send the property definition to the specified output destination. |
389 | 497 |
* |
390 | 498 |
* @param out |
... | ... | |
401 | 509 |
// recreate the temp-table. |
402 | 510 |
boolean none = false; // schemaMarshalLevel == SM_NONE; |
403 | 511 |
|
404 |
writeString(out, none ? null : name); |
|
405 |
writeString(out, (type == null || none) ? null : type.getName()); |
|
406 |
out.writeInt(none ? 0 : extent); |
|
407 |
writeString(out, none ? null : legacyName); |
|
408 |
writeString(out, full ? format : null); |
|
409 |
writeString(out, full ? label : null); |
|
410 |
writeString(out, full ? columnLabel : null); |
|
512 |
writeString(out, name); |
|
513 |
writeString(out, legacyName); |
|
514 |
writeString(out, type == null ? null : type.getName()); |
|
515 |
out.writeInt(extent); |
|
516 |
writeString(out, initial); |
|
517 |
out.writeByte(serializeHidden ? 1 : 0); |
|
518 |
out.writeByte(caseSensitive ? 1 : 0); |
|
519 |
writeString(out, xmlNodeType); |
|
520 |
writeString(out, codePage); |
|
521 |
out.writeByte(full ? 1 : 0); |
|
522 |
if (!full ) |
|
523 |
{ |
|
524 |
return; |
|
525 |
} |
|
526 |
writeString(out, format); |
|
527 |
writeString(out, label); |
|
528 |
writeString(out, columnLabel); |
|
529 |
writeString(out, help); |
|
411 | 530 |
} |
412 | 531 |
|
413 | 532 |
/** |
... | ... | |
427 | 546 |
ClassNotFoundException |
428 | 547 |
{ |
429 | 548 |
name = readString(in); |
549 |
legacyName = readString(in); |
|
430 | 550 |
String tn = readString(in); |
431 | 551 |
type = (tn == null) ? null : Class.forName(tn); |
432 | 552 |
extent = in.readInt(); |
433 |
legacyName = readString(in); |
|
553 |
initial = readString(in); |
|
554 |
serializeHidden = in.readByte() == 1; |
|
555 |
caseSensitive = in.readByte() == 1; |
|
556 |
xmlNodeType = readString(in); |
|
557 |
codePage = readString(in); |
|
558 |
boolean full = in.readByte() == 1; |
|
559 |
if (!full) |
|
560 |
{ |
|
561 |
return; |
|
562 |
} |
|
434 | 563 |
format = readString(in); |
435 | 564 |
label = readString(in); |
436 | 565 |
columnLabel = readString(in); |
566 |
help = readString(in); |
|
437 | 567 |
} |
438 | 568 |
|
439 | 569 |
/** |
src/com/goldencode/p2j/persist/TableMapper.java 2022-10-18 08:44:34 +0000 | ||
---|---|---|
102 | 102 |
** CA 20220601 getIndexFieldNames must return lowercased legacy names. |
103 | 103 |
** OM 20220914 Added MAX-WIDTH support for CHARACTER fields. |
104 | 104 |
** IAS 20221006 Added 'definedFormat' and 'definedLabel'. |
105 |
** IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value. |
|
105 | 106 |
*/ |
106 | 107 | |
107 | 108 |
/* |
... | ... | |
2874 | 2875 |
{ |
2875 | 2876 |
if ("today".equalsIgnoreCase(text)) |
2876 | 2877 |
{ |
2877 |
initialValue = date.today();
|
|
2878 |
initialValue = new character(text);
|
|
2878 | 2879 |
} |
2879 | 2880 |
else |
2880 | 2881 |
{ |
... | ... | |
2885 | 2886 |
{ |
2886 | 2887 |
if ("now".equalsIgnoreCase(text)) |
2887 | 2888 |
{ |
2888 |
initialValue = datetime.now();
|
|
2889 |
initialValue = new character(text);
|
|
2889 | 2890 |
} |
2890 | 2891 |
else if (text.toUpperCase().indexOf('T') > 0) |
2891 | 2892 |
{ |
... | ... | |
2902 | 2903 |
{ |
2903 | 2904 |
if ("now".equalsIgnoreCase(text)) |
2904 | 2905 |
{ |
2905 |
initialValue = datetimetz.now();
|
|
2906 |
initialValue = new character(text);
|
|
2906 | 2907 |
} |
2907 | 2908 |
else if (text.toUpperCase().indexOf('T') > 0) |
2908 | 2909 |
{ |
src/com/goldencode/p2j/persist/TableWrapper.java 2022-10-29 16:21:58 +0000 | ||
---|---|---|
28 | 28 |
** (so that relations, schema, etc is done on the server-side). |
29 | 29 |
** CA 20220428 Allow null peerDef at setPeerDef. |
30 | 30 |
** CA 20220602 Added basic support for transport of object instances over appserver call. |
31 |
** IAS 20221029 Added support for the SCHEMA-MARSHAL attribute. |
|
31 | 32 |
*/ |
32 | 33 | |
33 | 34 |
/* |
... | ... | |
123 | 124 |
/** Table name. */ |
124 | 125 |
private String tableName; |
125 | 126 | |
127 |
/** Table SCHEMA-MARSHAL attribute value encodes as int */ |
|
128 |
private int schemaMarshalLevel; |
|
129 | ||
126 | 130 |
/** |
127 | 131 |
* Determines if this wrapper wraps data from a TABLE-HANDLE parameter. Necessary because of |
128 | 132 |
* quirks in error handling: calling side needs to know if it is a TABLE-HANDLE parameter (not |
... | ... | |
698 | 702 |
while (resultSet.hasMoreProperties()) |
699 | 703 |
{ |
700 | 704 |
PropertyDefinition property = resultSet.nextProperty(); |
705 |
property.setMarshalLevel(schemaMarshalLevel); |
|
701 | 706 |
out.writeByte(1); |
702 | 707 |
property.writeExternal(out); |
703 | 708 | |
... | ... | |
921 | 926 |
this.tableHandle = tableHandle; |
922 | 927 |
} |
923 | 928 | |
929 |
/** Get encoded table SCHEMA-MARSHAL attribute value. |
|
930 |
* |
|
931 |
* @return encoded table SCHEMA-MARSHAL attribute value. |
|
932 |
*/ |
|
933 |
public int getSchemaMarshalLevel() |
|
934 |
{ |
|
935 |
return schemaMarshalLevel; |
|
936 |
} |
|
937 | ||
938 |
/** Set encoded table SCHEMA-MARSHAL attribute value. |
|
939 |
* |
|
940 |
* @param schemaMarshalLevel |
|
941 |
* encoded table SCHEMA-MARSHAL attribute value. |
|
942 |
*/ |
|
943 |
public void setSchemaMarshalLevel(int schemaMarshalLevel) |
|
944 |
{ |
|
945 |
this.schemaMarshalLevel = schemaMarshalLevel; |
|
946 |
} |
|
947 | ||
924 | 948 |
/** |
925 | 949 |
* Initialize this wrapper with the info from the given temp-table. |
926 | 950 |
* |
src/com/goldencode/p2j/persist/TempTableBuilder.java 2022-10-29 16:22:57 +0000 | ||
---|---|---|
122 | 122 |
** OM 20220914 Added MAX-WIDTH support for CHARACTER fields. |
123 | 123 |
** IAS 20221003 Fixed default value of the PRIMARY attribute |
124 | 124 |
** IAS 20221014 Added COMHANDLE to the 'datatypesMatchLen' map |
125 |
** IAS 20221029 Added support for missed properties. |
|
125 | 126 |
*/ |
126 | 127 | |
127 | 128 |
/* |
... | ... | |
1340 | 1341 |
character label, |
1341 | 1342 |
character columnLabel) |
1342 | 1343 |
{ |
1344 |
return addNewField(name, type, extent, format, initial, label, columnLabel, |
|
1345 |
null, null, null, false, false); |
|
1346 |
} |
|
1347 |
/** |
|
1348 |
* Adds a field with the specified properties to the temp-table. |
|
1349 |
* This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method |
|
1350 |
* of Progress 4GL. |
|
1351 |
* <p> |
|
1352 |
* When a parameter is set to null, it means it was not specified by the business logic. |
|
1353 |
* |
|
1354 |
* @param name |
|
1355 |
* The name of the field to be created in the temp-table. |
|
1356 |
* @param type |
|
1357 |
* The data type of the specified field. |
|
1358 |
* @param extent |
|
1359 |
* An integer expression specifying the extent of an array. |
|
1360 |
* @param format |
|
1361 |
* The data format for the defined data type. If empty or unknown, format is |
|
1362 |
* replaced with default format. Null value means that format is not used in |
|
1363 |
* ADD-NEW-FIELD. |
|
1364 |
* @param initial |
|
1365 |
* An expression that evaluates to the initial value of the defined field. |
|
1366 |
* TODO: this method will probably be overloaded because of this. |
|
1367 |
* @param label |
|
1368 |
* The label of the defined field. If <code>null</code> or unknown the name |
|
1369 |
* parameter will be used. |
|
1370 |
* @param columnLabel |
|
1371 |
* The label of the column associated with the defined field |
|
1372 |
* @param help |
|
1373 |
* @param xmlNodeType |
|
1374 |
* @param codePage |
|
1375 |
* @param serializeHidden |
|
1376 |
* @param caseSensitive |
|
1377 |
* |
|
1378 |
* @return <code>true</code> on success. |
|
1379 |
*/ |
|
1380 |
public logical addNewField(character name, |
|
1381 |
character type, |
|
1382 |
integer extent, |
|
1383 |
character format, |
|
1384 |
BaseDataType initial, |
|
1385 |
character label, |
|
1386 |
character columnLabel, |
|
1387 |
character help, |
|
1388 |
character xmlNodeType, |
|
1389 |
character codePage, |
|
1390 |
boolean serializeHidden, |
|
1391 |
boolean caseSensitive) |
|
1392 |
{ |
|
1343 | 1393 |
addFunctionCalled = true; |
1344 | 1394 |
|
1345 | 1395 |
if (_prepared()) |
... | ... | |
1397 | 1447 |
|
1398 | 1448 |
String labelStr = label != null ? label.getValue() : null; |
1399 | 1449 |
String columnLabelStr = columnLabel != null ? columnLabel.getValue() : null; |
1450 |
String helpStr = help != null ? help.getValue() : null; |
|
1451 |
String codePageStr = codePage != null ? codePage.getValue() : null; |
|
1452 |
String xmlNodeTypeStr = xmlNodeType != null ? xmlNodeType.getValue() : null; |
|
1400 | 1453 |
|
1401 | 1454 |
// Note: case-sensitivity and CLOB code page cannot be specified using P4GL ADD-NEW-FIELD method |
1402 | 1455 |
long ext = extent == null || extent.getValue() == 1 ? 0 : extent.getValue(); |
1403 | 1456 |
P2JField field = new P2JField(fieldName, parmType, ext, formatStr, |
1404 |
initial, labelStr, columnLabelStr, false, null, null, false, null, null, |
|
1405 |
null, null, false, 0, 0); |
|
1457 |
initial, labelStr, columnLabelStr, caseSensitive, |
|
1458 |
codePageStr, helpStr, serializeHidden, null, null, |
|
1459 |
null, xmlNodeTypeStr, false, 0, 0); |
|
1406 | 1460 |
addField(field); |
1407 | 1461 |
return new logical(true); |
1408 | 1462 |
} |
... | ... | |
2749 | 2803 |
PropertyDefinition propertyDefinition = iter.next(); |
2750 | 2804 |
addNewField(propertyDefinition); |
2751 | 2805 |
} |
2806 |
this.namespaceURI(tableWrapper.getXmlns()); |
|
2807 |
this.namespacePrefix(tableWrapper.getXmlPrefix()); |
|
2752 | 2808 |
tempTablePrepare(tableWrapper.getTableName()); |
2753 | 2809 |
TemporaryBuffer.insertAllRows(tableWrapper, |
2754 | 2810 |
(Temporary) defaultBufferHandle().getResource(), |
... | ... | |
3114 | 3170 |
new character(dataType), |
3115 | 3171 |
extent, |
3116 | 3172 |
new character(propertyDefinition.getFormat()), |
3117 |
null,
|
|
3173 |
new character(propertyDefinition.getInitial()),
|
|
3118 | 3174 |
new character(propertyDefinition.getLabel()), |
3119 |
new character(propertyDefinition.getColumnLabel())); |
|
3175 |
new character(propertyDefinition.getColumnLabel()), |
|
3176 |
new character(propertyDefinition.getHelp()), |
|
3177 |
new character(propertyDefinition.getXmlNodeType()), |
|
3178 |
new character(propertyDefinition.getCodePage()), |
|
3179 |
propertyDefinition.isSerializeHidden(), |
|
3180 |
propertyDefinition.isCaseSensitive()); |
|
3120 | 3181 |
} |
3121 | 3182 |
|
3122 | 3183 |
/** |
src/com/goldencode/p2j/persist/TempTableResultSet.java 2022-10-29 16:24:55 +0000 | ||
---|---|---|
31 | 31 |
** SVL 20210701 Added clearRows. |
32 | 32 |
** CA 20221006 Do not access tableHandle() in the FWD runtime, get the TempTable instance directly. |
33 | 33 |
** Refs #6826 |
34 |
** IAS 20221029 Re-worked 'init' method. |
|
34 | 35 |
*/ |
35 | 36 | |
36 | 37 |
/* |
... | ... | |
189 | 190 |
* @param append |
190 | 191 |
* Flag indicating this table is sent in APPEND mode. |
191 | 192 |
* |
192 |
* @throws ClassNotFoundException |
|
193 |
* If the type of a property can not be resolved to a class. |
|
194 | 193 |
*/ |
195 | 194 |
public TempTableResultSet(Temporary dmo, boolean input, boolean output, boolean append) |
196 |
// throws ClassNotFoundException |
|
197 | 195 |
{ |
198 | 196 |
this(dmo, input, output, append, true); |
199 | 197 |
} |
... | ... | |
358 | 356 |
* TODO: improve this (i.e. use an open cursor or some other alternative to not read the data |
359 | 357 |
* in memory) |
360 | 358 |
* |
361 |
* @throws ClassNotFoundException |
|
362 |
* If the type of a property can not be resolved to a class. |
|
363 | 359 |
*/ |
364 | 360 |
private void init(boolean copyRows) |
365 |
// throws ClassNotFoundException |
|
366 | 361 |
{ |
367 | 362 |
TemporaryBuffer buffer = (TemporaryBuffer) ((BufferReference) dmo).buffer(); |
368 | 363 |
|
... | ... | |
387 | 382 |
{ |
388 | 383 |
dmoPropIndex.put(dmoProps[i], i); |
389 | 384 |
} |
390 |
PropertyDefinition[] props = new PropertyDefinition[dmoProps.length]; |
|
391 |
|
|
392 |
Iterator<Property> iter = dmoInfo.getFields(false); // skip properties that are not accessible via the DMO's API. |
|
393 |
while (iter.hasNext()) |
|
394 |
{ |
|
395 |
Property prop = iter.next(); |
|
396 |
// the Properties whose extent fields were denormalized are treated as simple ones |
|
397 |
int extent = prop.index > 0 ? 0 : prop.extent; |
|
398 |
if (extent == 0) |
|
399 |
{ |
|
400 |
props[dmoPropIndex.get(prop.name)] = |
|
401 |
new PropertyDefinition(prop.name, |
|
402 |
prop._fwdType, |
|
403 |
prop.legacy, |
|
404 |
prop.format, |
|
405 |
prop.label, |
|
406 |
prop.columnLabel); |
|
407 |
} |
|
408 |
else |
|
409 |
{ |
|
410 |
props[dmoPropIndex.get(prop.name)] = |
|
411 |
new PropertyDefinition(prop.name, |
|
412 |
prop._fwdType, |
|
413 |
extent, |
|
414 |
prop.legacy, |
|
415 |
prop.format, |
|
416 |
prop.label, |
|
417 |
prop.columnLabel); |
|
418 |
} |
|
419 |
} |
|
420 |
|
|
421 |
java.util.List<PropertyDefinition> lprops = new ArrayList<>(); |
|
422 |
for (int i = 0; i < props.length; i++) |
|
423 |
{ |
|
424 |
if (props[i] != null) |
|
425 |
{ |
|
426 |
lprops.add(props[i]); |
|
427 |
} |
|
428 |
} |
|
385 |
|
|
386 |
Iterable<Property> iter = () -> dmoInfo.getFields(false); // skip properties that are not accessible via the DMO's API. |
|
387 |
Map<Integer, PropertyDefinition> mprops = new TreeMap<>(); |
|
388 |
for (Property prop: iter) |
|
389 |
{ |
|
390 |
mprops.put(dmoPropIndex.get(prop.name), new PropertyDefinition(prop)); |
|
391 |
} |
|
392 |
List<PropertyDefinition> lprops = new ArrayList<>(mprops.values()); |
|
429 | 393 | |
430 | 394 |
if (copyRows) |
431 | 395 |
{ |
src/com/goldencode/p2j/persist/orm/DmoMeta.java 2022-10-18 08:44:59 +0000 | ||
---|---|---|
39 | 39 |
** to a better suited name. |
40 | 40 |
** OM 20220706 The objects returned by getDatabaseIndexes() carry the legacy names, too. |
41 | 41 |
** OM 20220914 Use MAX-WIDTH to generate custom sized varchar columns. |
42 |
** IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value. |
|
42 | 43 |
*/ |
43 | 44 | |
44 | 45 |
/* |
... | ... | |
1591 | 1592 |
{ |
1592 | 1593 |
if (bdtType == date.class) |
1593 | 1594 |
{ |
1594 |
init = "today".equalsIgnoreCase(p.initial) ? date.today() : new date(p.initial);
|
|
1595 |
init = "today".equalsIgnoreCase(p.initial) ? new character(p.initial) : new date(p.initial);
|
|
1595 | 1596 |
} |
1596 | 1597 |
else if (bdtType == datetime.class) |
1597 | 1598 |
{ |
1598 | 1599 |
if ("now".equalsIgnoreCase(p.initial)) |
1599 | 1600 |
{ |
1600 |
init = datetime.now();
|
|
1601 |
init = new character(p.initial);
|
|
1601 | 1602 |
} |
1602 | 1603 |
else if (p.initial.toUpperCase().indexOf('T') > 0) |
1603 | 1604 |
{ |
... | ... | |
1614 | 1615 |
{ |
1615 | 1616 |
if ("now".equalsIgnoreCase(p.initial)) |
1616 | 1617 |
{ |
1617 |
init = datetimetz.now();
|
|
1618 |
init = new character(p.initial);
|
|
1618 | 1619 |
} |
1619 | 1620 |
else if (p.initial.toUpperCase().indexOf('T') > 0) |
1620 | 1621 |
{ |
src/com/goldencode/p2j/persist/serial/XmlImport.java 2022-10-18 08:45:19 +0000 | ||
---|---|---|
42 | 42 |
** OM 20220914 Use MAX-WIDTH to generate custom sized varchar columns. |
43 | 43 |
** IAS 20220926 Fixed READ-XMLSCHEMA support. |
44 | 44 |
** IAS 20221014 More fixes to READ-XMLSCHEMA support. |
45 |
** IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value. |
|
45 | 46 |
*/ |
46 | 47 | |
47 | 48 |
/* |
... | ... | |
1866 | 1867 |
// Unable to set initial value '<value>' from XML Schema for field '<field>'. |
1867 | 1868 |
return false; |
1868 | 1869 |
} |
1869 |
|
|
1870 |
try |
|
1871 |
{ |
|
1872 |
Constructor<? extends BaseDataType> ctor = |
|
1873 |
(Constructor<? extends BaseDataType>) fwdType.getConstructor(String.class); |
|
1874 |
defVal = ctor.newInstance(defaultStrVal); |
|
1875 |
} |
|
1876 |
catch (NoSuchMethodException | IllegalAccessException | |
|
1877 |
InstantiationException | InvocationTargetException e) |
|
1878 |
{ |
|
1879 |
ErrorManager.recordOrShowError(13143, defaultStrVal, fieldName); |
|
1880 |
// Unable to set initial value '<value>' from XML Schema for field '<field>'. |
|
1881 |
return false; |
|
1870 |
if (fwdType == date.class && "today".equalsIgnoreCase(defaultStrVal)) |
|
1871 |
{ |
|
1872 |
defVal = new character("today"); |
|
1873 |
} |
|
1874 |
else if ((fwdType == datetime.class || fwdType == datetimetz.class) && |
|
1875 |
"now".equalsIgnoreCase(defaultStrVal)) |
|
1876 |
{ |
|
1877 |
defVal = new character("now"); |
|
1878 |
} |
|
1879 |
else |
|
1880 |
{ |
|
1881 |
try |
|
1882 |
{ |
|
1883 |
Constructor<? extends BaseDataType> ctor = |
|
1884 |
(Constructor<? extends BaseDataType>) fwdType.getConstructor(String.class); |
|
1885 |
defVal = ctor.newInstance(defaultStrVal); |
|
1886 |
} |
|
1887 |
catch (NoSuchMethodException | IllegalAccessException | |
|
1888 |
InstantiationException | InvocationTargetException e) |
|
1889 |
{ |
|
1890 |
ErrorManager.recordOrShowError(13143, defaultStrVal, fieldName); |
|
1891 |
// Unable to set initial value '<value>' from XML Schema for field '<field>'. |
|
1892 |
return false; |
|
1893 |
} |
|
1882 | 1894 |
} |
1883 | 1895 |
} |
1884 | 1896 |
|
src/com/goldencode/p2j/util/AppServerHelper.java 2022-10-29 16:26:53 +0000 | ||
---|---|---|
77 | 77 |
** CA 20220428 Fixed memptr, extent, table arguments when the request is remote. |
78 | 78 |
** CA 20220602 Added basic support for transport of object instances over appserver call. |
79 | 79 |
** CA 20220912 If a dataset from the call has no buffers added to it, set it to unknown. |
80 |
** IAS 20221029 Fixed TableParameter processing. |
|
80 | 81 |
*/ |
81 | 82 | |
82 | 83 |
/* |
... | ... | |
2660 | 2661 | |
2661 | 2662 |
boolean input = (mode == 'I' || mode == 'U'); |
2662 | 2663 |
boolean output = (mode == 'O' || mode == 'U'); |
2664 |
|
|
2665 |
int schemaMarshalLevel = tableParam.getSchemaMarshalLevel(); |
|
2663 | 2666 | |
2664 | 2667 |
// try |
2665 | 2668 |
// { |
2666 | 2669 |
arg = new TableWrapper(new TempTableResultSet(tempDMO, input, output, append, input)); |
2667 | 2670 |
String tableName = ((BufferImpl) tempDMO).buffer().getDmoInfo().legacyTable; |
2668 | 2671 |
((TableWrapper) arg).setTableName(tableName); |
2672 |
((TableWrapper) arg).setSchemaMarshalLevel(schemaMarshalLevel); |
|
2673 |
if (tempDMO != null && ((Buffer) tempDMO).tableHandle()._isValid()) |
|
2674 |
{ |
|
2675 |
((TableWrapper) arg).init((TempTable) ((Buffer) tempDMO).tableHandle().getResource()); |
|
2676 |
} |
|
2669 | 2677 |
// } |
2670 | 2678 |
// catch (ClassNotFoundException e) |
2671 | 2679 |
// { |
src/com/goldencode/p2j/util/TableParameter.java 2022-10-29 16:28:13 +0000 | ||
---|---|---|
38 | 38 |
** INPUT-OUTPUT mode, and the DATASET-HANDLE, DATASET, TABLE-HANDLE or TABLE versions. |
39 | 39 |
** CA 20220727 Fixed OO dataset/table parameters (at the method definition and method call) when there is |
40 | 40 |
** an APPEND option. |
41 |
** IAS 20221029 Added SCHEMA-MARSHAL attribute support. |
|
41 | 42 |
*/ |
42 | 43 | |
43 | 44 |
/* |
... | ... | |
134 | 135 |
/** {@code true} if the parameter mode is OUTPUT or INPUT-OUTPUT. */ |
135 | 136 |
private boolean output = false; |
136 | 137 |
|
138 |
/** Table SCHEMA-MARSHAL attribute value encodes as int */ |
|
139 |
private int schemaMarshalLevel; |
|
140 |
|
|
137 | 141 |
/** Flag indicating this is a TABLE-HANDLE argument. */ |
138 | 142 |
private boolean isTableHandle = false; |
139 | 143 |
|
... | ... | |
218 | 222 |
this.options = options; |
219 | 223 |
this.input = input; |
220 | 224 |
this.output = output; |
225 |
this.schemaMarshalLevel = ((AbstractTempTable)this.tableHandle.unwrapTempTable()). |
|
226 |
getSchemaMarshalLevel(); |
|
221 | 227 |
} |
222 | 228 |
|
223 | 229 |
/** |
... | ... | |
596 | 602 |
return parameterIndex; |
597 | 603 |
} |
598 | 604 |
|
605 |
/** Get encoded table SCHEMA-MARSHAL attribute value. |
|
606 |
* |
|
607 |
* @return encoded table SCHEMA-MARSHAL attribute value. |
|
608 |
*/ |
|
609 |
public int getSchemaMarshalLevel() |
|
610 |
{ |
|
611 |
return schemaMarshalLevel; |
|
612 |
} |
|
613 | ||
599 | 614 |
/** |
600 | 615 |
* Set 1-based index of the table parameter (in declaration of the function). |
601 | 616 |
* |