File: CacheSequences.xml

package info (click to toggle)
libhibernate3-java 3.5.4.Final-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 56,936 kB
  • ctags: 61,154
  • sloc: java: 323,763; xml: 160,906; perl: 65; sh: 25; makefile: 8
file content (116 lines) | stat: -rw-r--r-- 3,877 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?xml version="1.0" encoding="UTF-8"?>

<!--
An example of enabling support for sequences in Intersystems' Cache SQL 2007.1 database.
-->

<Export generator="Cache" version="9" zv="Cache for Windows NT (Intel) 5.0.17 (Build 6006U)" ts="2005-09-29 14:10:54">
<Project name="Hibernate_Sequences" LastModified="2005-09-29 14:10:54">
  <Items>
    <ProjectItem name="InterSystems.Sequences" type="CLS"/>
  </Items>
</Project>
<Class name="InterSystems.Sequences">
<Description><![CDATA[
Class to maintain a table of counters for Oracle sequence or MSSql identity columns
<br><br>Counters can be incremented by calling the stored procedure BEFORE the insert
using syntax like:  call InterSystems.Sequences_GetNext("Name"), or using standard SQL,
or part of an SQL select like:
<br><br>select InterSystems.Sequences_GetNext(sequencename) from InterSystems.Sequences where Name='sequencename'
<br>
<br>Can also be queried as table InterSystems.Sequences, but that data is actually stored
in ^InterSystems.Sequences. Note use of %CacheSqlStorage to speed incrementing.
<br>
<br> Note: to make the Sequences system-wide, simply map ^InterSystems.Sequences* to a
common location
 <br>
	<br> Note: counter names are case-insensitive and force to uppercase on disk.
<br><br> Merge of ideas by JSL and APC 09/2005
]]></Description>
<ClassType>persistent</ClassType>
<SqlRowIdPrivate>1</SqlRowIdPrivate>
<StorageStrategy>custom</StorageStrategy>
<Super>%Persistent</Super>
<TimeChanged>60172,44404.735854</TimeChanged>
<TimeCreated>60137,56752.747989</TimeCreated>
<ClassDefinitionError>0</ClassDefinitionError>

<Index name="UniqueIndex1">
<IdKey>1</IdKey>
<PrimaryKey>1</PrimaryKey>
<Properties>Name</Properties>
<Unique>1</Unique>
</Index>

<Property name="Name">
<Description>
The name of the sequence or identity, forced to uppercase. Typically a tablename
(MSSQL identities) or an Oracle-like Sequence name</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="64"/>
</Property>

<Property name="Counter">
<Description>
Last assigned value for this Name. Initial </Description>
<Type>%Integer</Type>
<InitialExpression>0</InitialExpression>
</Property>

<Method name="GetNext">
<Description>
Returns an integer value with next assigned counter.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>name:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[ quit $increment(^InterSystems.Sequences($zcvt(name,"U")))  //force name to uppercase to be safe
]]></Implementation>
</Method>

<Method name="Init">
<Description>
Hibernate procedure to intialise a sequence, but can be used at any time</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>SequenceName:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set ^InterSystems.Sequences($zcvt(SequenceName,"U"))=0
	quit 0
]]></Implementation>
</Method>

<Method name="Drop">
<Description>
Hibernate procedure to kill a sequence, but can be used at any time</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>SequenceName:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	kill ^InterSystems.Sequences($zcvt(SequenceName,"U"))
	quit 0
]]></Implementation>
</Method>

<Storage name="custom">
<Type>%CacheSQLStorage</Type>
<StreamLocation>^InterSystems.SequencesS</StreamLocation>
<Property name="Counter"/>
<Property name="Name">
<Selectivity>1</Selectivity>
</Property>
<SQLMap name="datamap">
<Type>data</Type>
<Global>^InterSystems.Sequences</Global>
<Structure>delimited</Structure>
<Subscript name="1">
<Expression>{Name}</Expression>
</Subscript>
<Data name="Counter"/>
</SQLMap>
</Storage>
</Class>
<Checksum value="3603995477"/>
</Export>