笔记详情软件,Caché应用笔记

 2023-09-26 阅读 17 评论 0

摘要:Cach应用笔记(一) 1 ODBC1.1 ODBC ConnectionString通过ODBC连接Cach,ConnectionString是一个麻烦事,下面是一个可用的例子: Provider=MSDASQL.1;Extended Properties="DRIVER={InterSystems ODBC};SERVER=127.0.0.1;
Caché应用笔记(一)
1         ODBC
1.1     ODBC ConnectionString
通过ODBC连接Caché,ConnectionString是一个麻烦事,下面是一个可用的例子: Provider=MSDASQL.1;Extended Properties="DRIVER={InterSystems ODBC};SERVER=127.0.0.1;PORT=1972;DATABASE=HMSDICT;UID=_SYSTEM;PWD=SYS" 1.2     TroubleShooting
平时遇到的一些问题和解决办法

错误编号
 描述
 解决方法
 
1
 使用ADO来连接, 最简单的方式来修改一个值然后Post,就报错:: 无法定位更新行,***已被改变
 更新其中一个为空的字符串字段为’ ’

or

修改其长度10240->1024
 
2
 Native Code 461
 数据库不能连接, 检查其连接
 
3
 Native Code 469
 修改ODBC的连接字符串,不要使用Delphi自己产生的字符串,而是使用本章1中的ODBC ConnectionString
 

2         分发/部署(Deployment)
2.1     分发时删除源码
l         5.0 以后

$system.OBJ.MakeClassDeployed

? classmethod MakeClassDeployed(classname As %String = "", flags As %String = "") returns %Status

Make a class in deployed mode. This will delete all the source code of the class from the disk. Once a class is in deployed mode, it can not be edited nor exported. It also can not be compiled, and non of it's sub-classes can be compiled either.

 

例如:

W $SYSTEM.OBJ.MakeClassDeployed("Sample.Film")

l          

%ROMF and then load it into a clean database using %RIMF for distribution. This is similar to shipping only an executable in other languages.

l         直接从Explore中删除 Routines

3         数据库移植(5.x->4.x)
l         导出CDL

w $SYSTEM.OBJ.ExportCDLPackage("Division","Divistion.cdl",4)

 

*注意事项

%ID -> ID

while 条件不能加括号

TS TC TRO 后面不能有空格(紧接其后回车可解决)

不能使用Continue(使用goto代替)

不能使用isObject

不能使用 >=

不能使用 %XML包

不能使用 %System.SYS

 

×导出CDL的格式要求

1 5.0和4.0的Global的格式有差别。 5中 在Global的ListNode的第一项 是"value (1) = %%CLASSNAME",而4中则不含此项。因此,会导致在4中,OpenId出错:class not exist。

无法打开对象。

 

解决方法: 将%%CLASSNAME替换成其他字符串,但不要和属性名重复。(在HMS中,使用TaoReserved替换)

 

2 ROWSPEC 中的 ID 不用加属性描述

 ID:%String:Dcit.EMedicalRecords.ICD10 -> ID:%String

 

1.         Stream

s b=##Class(%Dictionary.ClassDefinition).%OpenId("Dict.Report.ReportItems")

w b.Storages.GetAt(1).StreamLocation

4         对象操作
4.1     对象引用的快速赋值
对象引用时使用对象方法实现为:

  S obja=##Class(ClassA).$OpenId(“1”)

  S objb=##Class(ClassB).$OpenId(“1”)

  S obja.propertyB=objb

  D obja.%Save()

Global操作:

  假设 propertyB 在 Globa  ^ClassAD中位置在第三位,则

  $LIST(^ClassAD(“1”,3))=”1”

 

5         索引(Index)
ü         不要使用唯一Bitmap索引(Do not make unique indexes bit map)

ü         保持Index Collation(索引排序)和Property Collation属性排序相同

如果要更改Collation,就修改属性的Collation,而不要更改索引Collation

ü         确保为所有的外键(对象引用、关联等)都建立索引

ü         所有可能会用来比较(=,>,<,LIKE,BETWEEN )等操作的属性都可以考虑建立索引。如果可能出现的值在10,000个以上,使用一般的索引,否则可以考虑使用Bitmap。各个属性单独建立索引。

ü         %BuildIndices for Bitmap: 如果索引已经记录了索引值,那在调用%BuildIndices之前最好先调用%PurgeIndices 以去掉旧的索引值

转自:http://itrust.cnblogs.com/archive/2005/11/08/133436.html#271473

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/99013.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息