Skip to content

Commit ef36915

Browse files
committed
Merged in general improvements based on experience during a recent customer project.
1 parent 92bd8c4 commit ef36915

15 files changed

Lines changed: 115 additions & 80 deletions

LINUX/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dbl -do REPLICATOR_OBJ:library.dbo \
2121
LIBSRC:FileChunkReader.dbl \
2222
LIBSRC:FileServiceClient.dbl \
2323
LIBSRC:GetDateTimeString.dbl \
24-
LIBSRC:GetInstances.dbl \
24+
LIBSRC:GetInstanceNames.dbl \
2525
LIBSRC:GetReplicatedTables.dbl \
2626
LIBSRC:IndexExists.dbl \
2727
LIBSRC:InstanceInfo.dbl \

NetReplicationLibrary/NetReplicationLibrary.synproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<Compile Include="..\SRC\LIBRARY\GenerateDepartmentData.dbl" />
3030
<Compile Include="..\SRC\LIBRARY\GenerateEmployeeData.dbl" />
3131
<Compile Include="..\SRC\LIBRARY\GetDateTimeString.dbl" />
32-
<Compile Include="..\SRC\LIBRARY\GetInstances.dbl" />
32+
<Compile Include="..\SRC\LIBRARY\GetInstanceNames.dbl" />
3333
<Compile Include="..\SRC\LIBRARY\GetReplicatedTables.dbl" />
3434
<Compile Include="..\SRC\LIBRARY\IndexExists.dbl" />
3535
<Compile Include="..\SRC\LIBRARY\InstanceInfo.dbl" />

PRJVS/library/library.synproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
<Compile Include="..\..\SRC\LIBRARY\GetDateTimeString.dbl">
133133
<Link>GetDateTimeString.dbl</Link>
134134
</Compile>
135-
<Compile Include="..\..\SRC\LIBRARY\GetInstances.dbl">
136-
<Link>GetInstances.dbl</Link>
135+
<Compile Include="..\..\SRC\LIBRARY\GetInstanceNames.dbl">
136+
<Link>GetInstanceNames.dbl</Link>
137137
</Compile>
138138
<Compile Include="..\..\SRC\LIBRARY\GetReplicatedTables.dbl">
139139
<Link>GetReplicatedTables.dbl</Link>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;*****************************************************************************
22
;;
3-
;; File: GetInstances.dbl
3+
;; File: GetInstanceNames.dbl
44
;;
55
;; Description: Returns a collection of valid instance names
66
;;

SRC/LIBRARY/GetReplicatedTables.dbl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ subroutine GetReplicatedTables
4747
defaultTables, @ArrayList
4848
endrecord
4949
proc
50-
tables = new ArrayList()
51-
5250
using instanceName select
5351
("DEFAULT"),
5452
begin

SRC/LIBRARY/IOHooksISAM.dbl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ namespace ReplicationLibrary
317317
; end
318318
; else
319319
; begin
320-
mreturn mTableName
321-
; end
320+
begin
321+
mreturn mTableName
322+
end
322323

323324
endmethod
324325

SRC/LIBRARY/OpenOrCreateQueueFile.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ proc
6161
catch (e, @NoFileFoundException)
6262
begin
6363
.ifdef D_VMS
64-
xcall isamc(aQueueFileSpec + ", FIXED", 32042, 1, "START=1, LENGTH=8, TYPE=SEQUENCE, NAME=TRANSACTION_ID, DENSITY=100")
64+
xcall isamc(aQueueFileSpec + ", FIXED", 32054, 1, "START=1, LENGTH=20, TYPE=ALPHA, NAME=TRANSACTION_ID, DENSITY=100")
6565
.else
6666
xcall isamc(aQueueFileSpec + ", FIXED, COMPRESS, PAGE=1024, TBYTE", 65042, 1, "START=1, LENGTH=8, TYPE=SEQUENCE, NAME=TRANSACTION_ID, DENSITY=100")
6767
.endc

SRC/LIBRARY/Replicate.dbl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,24 @@ proc
239239

240240
;;And add it to the queue
241241

242+
.ifdef OS_VMS
243+
;On VMS we don't have auto sequence keys so we need to allocate a %DATETIME value as the
244+
;transaction ID and be prepared to retry if we get a duplicate key error.
245+
instruction.transaction_id = %datetime
246+
repeat
247+
begin
248+
store(instanceData.Channel,instruction) [$ERR_NODUPS=dupkey]
249+
if (false)
250+
begin
251+
dupkey, instruction.transaction_id = ^a(^d(instruction.transaction_id)+1)
252+
nextloop
253+
end
254+
exitloop
255+
end
256+
.else
257+
;On other platforms we can just store the transaction
242258
store(instanceData.Channel,instruction)
259+
.endc
243260

244261
end
245262
endusing

SRC/LIBRARY/StringTools.dbl

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ namespace ReplicationLibrary
3939

4040
public class StringTools
4141

42-
.define D_32K 32768
43-
.define D_32BIT_MAX 65535
42+
.define D_32K 32768
43+
.define D_32BIT_MAX 65535
4444

4545
private static b64Chars, a*, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
4646

@@ -83,7 +83,7 @@ namespace ReplicationLibrary
8383
endparams
8484

8585
stack record
86-
inData ,D_HANDLE
86+
inData ,D_HANDLE
8787
inLength ,int
8888
bits24 ,strBits24
8989
endrecord
@@ -94,7 +94,7 @@ namespace ReplicationLibrary
9494
endstructure
9595

9696
structure outputLine
97-
,a76
97+
,a76
9898
endstructure
9999

100100
proc
@@ -106,7 +106,7 @@ namespace ReplicationLibrary
106106
begin
107107
data ix ,int
108108
data setsOf4 ,int
109-
data unencodedData ,D_HANDLE
109+
data unencodedData ,D_HANDLE
110110
data unencodedDataIx ,int
111111
data fillerCount ,int, 0
112112

@@ -187,8 +187,8 @@ namespace ReplicationLibrary
187187
inData = %mem_proc(DM_FREE,inData)
188188

189189
;mreturn HandleToString(unencodedData)
190-
mreturn %string_from_handle(unencodedData)
191-
end
190+
mreturn %string_from_handle(unencodedData)
191+
end
192192
else
193193
mreturn ""
194194

@@ -219,7 +219,7 @@ namespace ReplicationLibrary
219219
;;(which will be either 2 bits or 4 bits), then that will
220220
;;equate to either 1 or 2 extra "Filler" characters needed at
221221
;;the end of the data.
222-
data encodedData ,D_HANDLE
222+
data encodedData ,D_HANDLE
223223
data bits24 ,strBits24
224224
data setsOf3 ,int ,inLength/3
225225
data remainingChars ,int ,inLength-(setsOf3*3)
@@ -292,16 +292,16 @@ namespace ReplicationLibrary
292292
^m(str1byte[b64ctr+=1],encodedData) = b64Chars(65:1)
293293

294294
if (addLineBreaks&&((b64LineLength+=4)==76))
295-
begin
296-
^m(str1byte[b64ctr+=1],encodedData) = %char(13)
297-
^m(str1byte[b64ctr+=1],encodedData) = %char(10)
298-
b64LineLength = 0
299-
end
295+
begin
296+
^m(str1byte[b64ctr+=1],encodedData) = %char(13)
297+
^m(str1byte[b64ctr+=1],encodedData) = %char(10)
298+
b64LineLength = 0
299+
end
300300
end
301301

302302
;;Turn the memory handle into a string and return the data
303-
;mreturn HandleToString(encodedData)
304-
mreturn %string_from_handle(encodedData)
303+
;mreturn HandleToString(encodedData)
304+
mreturn %string_from_handle(encodedData)
305305
end
306306
else
307307
mreturn ""
@@ -316,7 +316,7 @@ namespace ReplicationLibrary
316316
;;; <param name="addLineBreaks">Add line breaks after every 76th character.</param>
317317
;;; <returns>Base64 encoded data.</returns>
318318
public static method Base64EncodeHandle, string
319-
required in dataToEncode ,D_HANDLE
319+
required in dataToEncode ,D_HANDLE
320320
required in addLineBreaks ,boolean
321321
endparams
322322

@@ -333,7 +333,7 @@ namespace ReplicationLibrary
333333
;;(which will be either 2 bits or 4 bits), then that will
334334
;;equate to either 1 or 2 extra "Filler" characters needed at
335335
;;the end of the data.
336-
data encodedData ,D_HANDLE
336+
data encodedData ,D_HANDLE
337337
data bits24 ,strBits24
338338
data setsOf3 ,int ,inLength/3
339339
data remainingChars ,int ,inLength-(setsOf3*3)
@@ -402,19 +402,19 @@ namespace ReplicationLibrary
402402
else
403403
^m(str1byte[b64ctr+=1],encodedData) = b64Chars(65:1)
404404

405-
^m(str1byte[b64ctr+=1],encodedData) = b64Chars(65:1)
405+
^m(str1byte[b64ctr+=1],encodedData) = b64Chars(65:1)
406406

407-
if (addLineBreaks&&((b64LineLength+=4)==76))
408-
begin
409-
^m(str1byte[b64ctr+=1],encodedData) = %char(13)
410-
^m(str1byte[b64ctr+=1],encodedData) = %char(10)
411-
b64LineLength = 0
412-
end
407+
if (addLineBreaks&&((b64LineLength+=4)==76))
408+
begin
409+
^m(str1byte[b64ctr+=1],encodedData) = %char(13)
410+
^m(str1byte[b64ctr+=1],encodedData) = %char(10)
411+
b64LineLength = 0
412+
end
413413
end
414414

415415
;;Turn the memory handle into a string and return the data
416416
;mreturn HandleToString(encodedData)
417-
mreturn %string_from_handle(encodedData)
417+
mreturn %string_from_handle(encodedData)
418418
end
419419
else
420420
mreturn ""
@@ -427,12 +427,12 @@ namespace ReplicationLibrary
427427
;;; <param name="handleIn">Memory handle to be copied.</param>
428428
;;; <param name="handleOut">Memory handle containing copy of data.</param>
429429
public static method CopyHandle, void
430-
required in handleIn ,D_HANDLE
431-
required out handleOut ,D_HANDLE
430+
required in handleIn ,D_HANDLE
431+
required out handleOut ,D_HANDLE
432432
endparams
433433

434434
structure chunk
435-
,a D_32K
435+
,a D_32K
436436
endstructure
437437

438438
stack record
@@ -488,7 +488,7 @@ namespace ReplicationLibrary
488488
;;Copy remaining characters
489489
if (characters)
490490
^m(chunk[blocks+1](1:characters),handleOut)
491-
& = ^m(chunk[blocks+1](1:characters),handleIn)
491+
& = ^m(chunk[blocks+1](1:characters),handleIn)
492492
end
493493

494494
mreturn
@@ -497,7 +497,7 @@ namespace ReplicationLibrary
497497

498498
public static method FileToHandle, boolean
499499
required in fileSpec ,string
500-
required out fileData ,D_HANDLE
500+
required out fileData ,D_HANDLE
501501
endparams
502502

503503
stack record
@@ -506,7 +506,7 @@ namespace ReplicationLibrary
506506
endrecord
507507

508508
structure block
509-
,a D_32K
509+
,a D_32K
510510
endstructure
511511

512512
proc
@@ -515,12 +515,12 @@ namespace ReplicationLibrary
515515
;;Open the input file
516516
try
517517
begin
518-
.ifdef OS_VMS
518+
.ifdef OS_VMS
519519
open(ch=0,i,fileSpec,OPTIONS:"/stream")
520-
.else
521-
open(ch=0,i,fileSpec)
522-
.endc
523-
end
520+
.else
521+
open(ch=0,i,fileSpec)
522+
.endc
523+
end
524524
catch (ex)
525525
begin
526526
ok = false
@@ -543,11 +543,11 @@ namespace ReplicationLibrary
543543
;;Read data from file in "block size" chunks
544544
try
545545
begin
546-
repeat
547-
begin
548-
;reads(ch,^m(block[blocks+=1],fileData))
549-
gets(ch,^m(block[blocks+=1],fileData))
550-
end
546+
repeat
547+
begin
548+
;reads(ch,^m(block[blocks+=1],fileData))
549+
gets(ch,^m(block[blocks+=1],fileData))
550+
end
551551
end
552552
catch (ex, @EndOfFileException)
553553
begin
@@ -572,15 +572,15 @@ namespace ReplicationLibrary
572572

573573
stack record
574574
ok ,boolean
575-
dataHandle ,D_HANDLE
575+
dataHandle ,D_HANDLE
576576
endrecord
577577

578578
proc
579579

580580
if (ok = StringTools.FileToHandle(fileSpec,dataHandle))
581581
begin
582-
;dataString = HandleToString(dataHandle)
583-
dataString = %string_from_handle(dataHandle)
582+
;dataString = HandleToString(dataHandle)
583+
dataString = %string_from_handle(dataHandle)
584584
dataHandle = %mem_proc(DM_FREE,dataHandle)
585585
end
586586

@@ -589,7 +589,7 @@ namespace ReplicationLibrary
589589
endmethod
590590

591591
public static method HandleToFile, boolean
592-
required in inHandle ,D_HANDLE
592+
required in inHandle ,D_HANDLE
593593
required in fileSpec ,string
594594
endparams
595595

@@ -599,7 +599,7 @@ namespace ReplicationLibrary
599599
endrecord
600600

601601
structure block
602-
,a D_32K
602+
,a D_32K
603603
endstructure
604604

605605
proc

SRC/REPLICATOR/Counters.dbl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ namespace replicator
1616
public class Counters
1717

1818
;;Required for non-VS build!
19+
.ifndef OS_VMS
1920
static method Counters
2021
proc
2122
endmethod
2223

24+
.endc
2325
public static Inserts, int
2426

2527
public static Updates, int

0 commit comments

Comments
 (0)