Temporary InMemory Tables [AX 2012]

This topic has not yet been rated - Rate this topic

Updated: October 12, 2012

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

在 Microsoft Dynamics AX, 有一种类型的临时表叫做 InMemory table. 我们叫它 InMemory tables ,因为他们的 TableType 属性值是 InMemory . 这个值来自于枚举值 TableType::InMemory . The TableType property value can be seen at AOT Data Dictionary Tables MyInMemoryTable Properties TableType .

 Note

In Microsoft Dynamics AX 2009 and earlier versions, InMemory tables were called temporary tables. Now there are two kinds of temporary tables, namely InMemory tables and TempDB tables. To avoid confusion we do not use the phrase temporary tables to refer to just InMemory tables or to just TempDB tables.

Tier(层)

 

不论是在客户端或者服务端层,InMemory表在进程运行所在的活动内存中被实例化. InMemory表从来不出现在数据库管理系统中.

一个InMemory table 留在内存中,知道他的尺寸达到128KB. 该数据集然后被写到服务器层的一个磁盘文件. InMemory表的磁盘文件具有命名约定 $tmp<nnnnnnnn>.$$$.

Scope(范围)

 

当第一条记录插入后,InMemory表被实例化. 只要一条引用该表的记录缓冲区变量存在,实例化后的InMemory表就继续存在. 只要记录缓冲区超出范围,内存或硬盘就不给InMemory表分配空间.

Adding Data to an InMemory Table

 

To add data to an InMemory table, you must declare the record buffer and call the insert method. The following code example uses the TmpCustLedger table which has its TableTypeproperty set to InMemory in the AOT.

X++

static
void TableTmpInsertRecord(Args _args)

{ TmpCustLedger custTmpLedger;

; custTmpLedger.Name =
'NameValue'; custTmpLedger.Balance01 =
2345000;

custTmpLedger.insert();

}

 

 

 

要释放InMemory表的内存,并删除它的文件,可以设置 record buffer 变量为 null .

custTmpLedger = null;

下面演示从 CustTable table 复制数据到InMemory table ,它是 CustTable table 的表结构的副本. setTmp 方法用来创建一个与 CustTable table 匹配的 InMemory table. setTmp 方法改变getTableType方法的返回值 getTableType , from TableType::Regular to TableType::InMemory .

X++

static
void CopyPersistedTableToInMemoryJob(Args _args)

{

CustTable custTable;

CustTable custTmpLedger; custTmpLedger.setTmp(); custTable.recordLevelSecurity(true);

while select * from custTable where custTable.AccountNum like '1*'
{ custTmpLedger.data(custTable.data());

custTmpLedger.doInsert(); info(strFmt("Inserted a row for AccountNum =

%1",custTable.AccountNum)); } custTmpLedger = null;

}

 

Indexes

 

InMemory 表可以向
持久化的表一样定义索引. 如果一个InMemory表是通过拷贝一个持久化的表创建的,索引页会被拷贝到InMemory表中. 索引对于快速检索数据很有用,特别是当InMemory表数据在磁盘文件中时.

InMemory Tables vs. Containers

 

Microsoft Dynamics AX 支持一种特殊的数据类型,叫做 container .这种数据类型可以像你使用InMemory表一样使用. For more information, see Containers .

在容器中的数据是连续地存储和检索,但在InMemory表中,你可以定义索引来加快数据检索. 对于几行数据来说,索引没有益处.在这种情况下,容器可能有更少的开销,更快的执行速度.

另一个重要的不同是,如何在方法调用中使用.当你传递一个InMemeory表到一个方法调用, 它通过引用传递.容器通过值传递.当一个变量通过引用传递,只有指向该对象的指针被传递. 当一个变量通过值传递,该变量的一个新的拷贝被传递给方法.如果计算机有一定限制量的内存, 它会开始交换内存到磁盘,减慢应用程序的执行.当你传递一个变量给方法,InMemory表可能提供
更佳的性能.

For more information about temporary tables, see Greef, Pontoppidan, et al. 2006. Inside Microsoft Dynamics AX 4.0 . 351-359. Redmond: Microsoft Press.

TempDB Tables for Disabled Tables

 

你可以通过禁用 configuration key 来禁用一个常规持久化的数据库表,它控制着表.禁用这个键会导致系统自动创建一个, 与数据库表的字段和架构相匹配的TempDB类型的临时表.这个临时表会在SQL Server 数据库的底层存在, 通过AOS管理.

自动创建这个TempDB表的目的,是为了能让引用了被禁用表的AOT对象,继续编译和运行. 甚至在configuration key被禁用时,你依然可以读写这个TempDB表.

所有表缓冲区变量都继承 xRecord 类的方法. 其中一个方法是 setTmp , 它创建一个与常规表有着相同架构的InMemory 临时表. 然而, setTmp 方法不能从TempDB表创建InMemory表. 你可以调用 isTempDb 方法确定 setTmp 方法是否可用.

See also

 

Use the Table Browser to View, Add, Modify, or Delete Records

Temporary InMemory Tables [AX 2012]的更多相关文章

  1. Temporary TempDB Tables [AX 2012]

    Temporary TempDB Tables [AX 2012] 1 out of 4 rated this helpful - Rate this topic Updated: November ...

  2. Temporary Tables and the TableType Property [AX 2012]

    Temporary Tables and the TableType Property [AX 2012] 1 out of 1 rated this helpful - Rate this topi ...

  3. Table Properties [AX 2012]

    Table Properties [AX 2012] 1 out of 2 rated this helpful - Rate this topic Updated: July 20, 2012 Ap ...

  4. Select Statement Syntax [AX 2012]

    Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 ...

  5. View Properties [AX 2012]

    View Properties [AX 2012] Other Versions This topic has not yet been rated - Rate this topic Updated ...

  6. Understanding the RelationshipType Enumeration [AX 2012]

    Understanding the RelationshipType Enumeration [AX 2012] 3 out of 3 rated this helpful - Rate this t ...

  7. Table Groups [AX 2012]

    Table Groups [AX 2012] 0 out of 1 rated this helpful - Rate this topic Updated: February 21, 2012 Ap ...

  8. Dynamics AX 2012 的工业物联网解决方案

    Dynamics AX 2012 的工业物联网解决方案 物联网 物联网的概念在这两年非常火,包括近期很火的共享单车初创公司--摩拜单车,在产品中运用了Azure Iot物联网技术.但是,物联网并不是一 ...

  9. Dynamics AX 2012 在BI分析中建立数据仓库的必要性

    AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...

随机推荐

  1. Android java取得当前日期增加一天或多天

    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstanc ...

  2. WPF基础知识、界面布局及控件Binding

    WPF是和WinForm对应的,而其核心是数据驱动事件,在开发中显示的是UI界面和逻辑关系相分离的一种开放语言.UI界面是在XAML语言环境下开发人员可以进行一些自主设计的前台界面,逻辑关系还是基于c ...

  3. shell 判断字符串是否为数字

    本篇文章主要介绍了"shell 判断字符串是否为数字",主要涉及到shell 判断字符串是否为数字方面的内容,对于shell 判断字符串是否为数字感兴趣的同学可以参考一下. #!/ ...

  4. vmware虚拟机三种网络模式详解_转

    原文来自http://note.youdao.com/share/web/file.html?id=236896997b6ffbaa8e0d92eacd13abbf&type=note 由于L ...

  5. D3D标注动态避让

    原来也思考了该如何实现标注动态避让,认为必须得计算字符串所占的大小.如果在屏幕上要计算屏幕象素之类的东西. 今天总算找到了实现方法,在C# WorldWind中的KMLImporter类中有.关键是F ...

  6. 查找文件并执行的shell命令

    来由 经常我们需要找到某类文件, 并对进行处理. 例如找到.svn文件夹, 然后删除掉. 如果不使用shell,你可以选择手动删除, 前提是没有几个此类文件, 但是svn信息文件很多, 不能采用手动删 ...

  7. java 线上问题定位工具

    在JDK的bin目录下有很多命令行工具: 我们可以看到各个工具的体积基本上都稳定在27kb左右,这个不是JDK开发团队刻意为之的,而是因为这些工具大多数是jdk\lib\tools.jar类库的一层薄 ...

  8. 《30天自制操作系统》05_day_学习笔记

    //bootpack.c 完整代码 #include <stdio.h> void io_hlt(void); void io_cli(void); void io_out8(int po ...

  9. object_id的用法

    OBJECT_ID: 返回数据库对象标识号. 语法 OBJECT_ID ( 'object' ) 参数 'object' 要使用的对象.object 的数据类型为 char 或 nchar.如果 ob ...

  10. eclipse 导入jdbc4.jar 包

    详细讲解链接 http://wenku.baidu.com/link?url=QUhO2rIL2fYRgOUyd1TQPEgbl0jQr156ioxK5fiwSPm_Tset2okpBEJcO1fmz ...