Temporary TempDB Tables [AX 2012]

1 out of 4 rated this helpful - Rate this topic

Updated: November 5, 2013

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

In Microsoft Dynamics AX, one type of temporary table is a TempDB table. We call them TempDB tables because their TableType property value is TempDB . This value comes from theTableType::TempDB enum value. The TableType property value can be set at AOT Data Dictionary Tables MyTempDBTable Properties TableType .

All types of temporary tables are automatically dropped by the system when the table variable in X++ goes out of scope. A TempDB table is not dropped when you set its record buffer variable to null .

TempDB tables are a different type of temporary table than InMemory tables. For more information, see Temporary InMemory Tables .

Capabilities of TempDB Tables

The following table describes the capabilities of TempDB tables.

Capability

Description

Can be joined .

你的X++ SQL 代码可以 join a TempDB table 到一个常规表,在单个调用中执行多行操作.

Can be either per company or global.

在TempDB表上的 SaveDataPerCompany 属性可以被设置为 Yes or No . 如果值为 No ,会成为全局表. For more information, see Table Properties .

可以通过 .NET Business Connector 从企业门户使用.

TempDB表可以用于窗体和X++代码,与任何用户界面没有关联.但是它可以直接被企业门户数据集使用.

Can have foreign key columns.

TempDB表可以引用其他表的主键作为自己的外间列.然而,它的主键不能作为其他表的外键.

TempDB tables可以从客户端或服务器层实例化.

TempDB表可以用于运行在客户端层或AOS层的逻辑.

Can have indexes columns.

TempDB可以在AOT中为它定义索引.

Can have methods, but cannot override .

你可以为TempDB表添加方法,然而,不能覆盖TempDB表中的任何方法.

Usable as a query How to: Add Multiple Data Sources to a Query .

在 AOT Queries 下的一个查询,可以引用TempDB作为他的数据源.

Transaction support .

底层数据库管理系统,为每个TempDB表的实例,提供事务支持,就像常规表一样. 每个实例都是一个单独的表,与其他实例是无关的,每个实例都短命.

No configuration key .

No configuration key is needed for you to use a TempDB table.

Limitations of TempDB Tables

The following table describes the limitations of TempDB tables.

Limitation

Descriptions

Cannot be a valid time state table(有效时间状态表) .

ValidTimeStateFieldType 属性被默认值 None 限制了. 这意味着系统在TempDB表中不能管理日期有效数据.

Cannot have any delete actions .

A TempDB table cannot have any delete actions defined under its DeleteActions node in the AOT.

No Record Level Security ( RLS ).

RLS is not applied to TempDB tables.

Cannot use the Table browser form .

要将记录添加到常规表,你可以在AOT中右键它的节点,点击 Open . 打开 Table browser form. 通过键入 Ctrl+N, 你可以添加记录. 然而, Table browser form 不支持TempDB表. 这是因为TempDB表仅存在于实例它的方法范围内.

Cannot be in a table collection .

任何临时表都不能在表集合中.

No view support.

AOT中的视图不能引用TempDB表.当一个视图通过 AOT Data Dictionary Views 创建并保存,视图会同步到底层数据库系统. 在那一刻,视图必须由数据库系统创建. 但是每个TempDB表是很少存在于数据库中,因为TempDB表仅存在于实例化表的方法期间. 因此,TempDB表通常不是在数据库中为任何数据库视图可以引用的.

Lifetime of TempDB Tables

当第一个SQL操作从AOS发送到数据库系统时,TempDB表在底层数据库管理系统中被实例化. SQL操作可以是select,insert,update,delete.

下面的表,描述了导致TempDB表被丢弃的情形.

Cause of drop

Description

Variable goes out of scope.(变量超出范围)

典型的例子是,一个方法为特定TempDB类型声明了一个变量.这个方法插入数据到TempDB表. 插入导致TempDB在数据库中被实例化.当方法结束,方法中的所有变量都超出范围. AOS告诉数据库系统,当TempDB表对应的变量超出范围,丢弃它.

Controlled restart of the AOS.

当你停止挺重启AOS,AOS会告诉数据库系统,丢弃所有的TempDB表.

Restart of the database system.

当数据库系统停止并重启,所有TempDB表的实例会被丢弃.

如果AOS服务短暂停止,比如硬件电源故障,TempDB表可以留在底层数据库中. 这里没有自动机制立即丢弃表.

Closure of the AX32.exe client.

假设你从 AX32.exe 客户端 AOT Jobs 启动一个 job from. Job会调用服务端方法实例化一个TempDb表.当你关闭你的 AX32.exe程序,服务端方法依然在运行.这将结束你的Microsoft Dynamics AX 会话, 并立即结束服务端方法.所有方法中声明的变量现在都超出了范围.因此,AOS告诉 数据库系统,丢弃TempDB表.

Online Users form.

The Online Users 窗体可以用于任何与还没有自动丢弃的TempDB表相关的Microsoft Dynamics AX会话. 窗体在内容面板 Administration Administration AreaCommon forms Online users 中可用.

TempDB Tables for Disabled Tables

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

自动创建TempDB表的目的是为了让被禁用的AOT对象继续变异和运行. configuration key被禁用后,依然能读写这些TempDB表.

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

X++ Code Example

The following X++ code example assumes that a TempDB table which is named MyTempdb has already been defined under AOT Data Dictionary Tables . The MyTempdb table has one column that is the same type as the AccountNum column on the CustTable table. The while select statement in the example contains a JOIN clause that cannot be used with temporary InMemory tables.

X++

server public
static
void main(Args _args)

{

MyTempdb xrecMyTempdb;

CustTable xrecCustTable;

TableType tableTypeEnum;

str stringWork;

Global::info("Start of main.");

xrecMyTempdb.AccountNum =
"4004";

xrecMyTempdb.doInsert();

xrecMyTempdb.AccountNum =
"4005";

xrecMyTempdb.doInsert();

tableTypeEnum = xrecMyTempdb.getTableType();

stringWork =
"MyTempdb.TableType is: "
+

enum2Str(tableTypeEnum); info(stringWork);

while select * from xrecCustTable

JOIN xrecMyTempdb where xrecMyTempdb.AccountNum == xrecCustTable.AccountNum

{

stringWork = xrecCustTable.AccountNum +

" , "
+

int2Str(xrecCustTable.MandatoryCreditLimit);

info(stringWork);

}

}
/*** Infolog outputMessage (05:21:28 pm) Start of

main. MyTempdb.TableType is: TempDB 4004 , 0 4005 , 1 ***/

 

See also

Temporary Tables and the TableType Property

Community Additions

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

  1. Temporary InMemory Tables [AX 2012]

    Temporary InMemory Tables [AX 2012] This topic has not yet been rated - Rate this topic Updated: Oct ...

  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. centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课

    centos   shell编程6一些工作中实践脚本   nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志  直接送给bc做计算  gzip  innobacku ...

  2. Inside Kolla - 03 下载Kolla

    下载 Kolla Kolla 目前托管在 github.com 上,项目仓库的 URL 是 https://github.com/stackforge/kolla. 下载 Kolla 时,可下载 gi ...

  3. nginx源码分析—内存池结构ngx_pool_t及内存管理

    Content 0. 序 1. 内存池结构 1.1 ngx_pool_t结构 1.2 其他相关结构 1.3 ngx_pool_t的逻辑结构 2. 内存池操作 2.1 创建内存池 2.2 销毁内存池 2 ...

  4. javascript实例学习之三——类新浪微博的登录框

    该登录框和百度的搜索框类似,可以实现如下效果: 1.文字输入时自动弹出提示层 2,提示层根据输入文字进行自动过滤 3,提示层可以使用上下按键进行选择 4,提示层可以点击或者回车来确认输入 微博登录框h ...

  5. 面向对象编程思想(OOP)

    本文我将从面向对象编程思想是如何解决软件开发中各种疑难问题的角度,来讲述我们面向对象编程思想的理解,梳理面向对象四大基本特性.七大设计原则和23种设计模式之间的关系. 软件开发中疑难问题: 软件复杂庞 ...

  6. 使用RMAN对控制文件进行restore

    控制文件的默认备份格式是: c-IIIIIIIIII-YYYYMMDD-QQ 其中: c:表示控制文件 IIIIIIIIII:表示DBID YYYYMMDD:备份的时间戳 QQ:16进制的序列号,从0 ...

  7. 转:python socket编程详细介绍

    Python 提供了两个基本的 socket 模块. 第一个是 Socket,它提供了标准的 BSD Sockets API. 第二个是 SocketServer, 它提供了服务器中心类,可以简化网络 ...

  8. python在window下的Nginx部署

    Python版本3.21 安装nginx下载windows上的nginx最新版本,http://www.nginx.org/en/download.html.解压后即可.运行nginx.exe后本地打 ...

  9. paper 87:行人检测资源(下)代码数据【转载,以后使用】

    这是行人检测相关资源的第二部分:源码和数据集.考虑到实际应用的实时性要求,源码主要是C/C++的.源码和数据集的网址,经过测试都可访问,并注明了这些网址最后更新的日期,供学习和研究进行参考.(欢迎补充 ...

  10. c++的学习内容一汇总篇(常更新)

    在这里假定读者们是有一定编程经验的.例如c#,java,c或者其他任何编程语言. 所有语言都无外乎掌握它的语法,熟悉它的一些库的调用. ---------------语法篇-------------- ...