hibernate-orm/etc/CacheSequences.xml

117 lines
3.8 KiB
XML
Raw Normal View History

<?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>