AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 22.12.2015, 09:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
mfp: X++ in AX7: String truncation
Источник: http://blogs.msdn.com/b/mfp/archive/...runcation.aspx
==============
Consider this X++ code:

CustGroupId id = "012345678901234567890123456789"; //30 chars long;

CustGroup custgroup;
custGroup.id = id;
custGroup.insert;

select custGroup
where custGroup.id == id;


The CustGroupID EDT is defined with a length of 20 characters. In AX 2012 the assignment in the very first line would truncate the string from 30 to 20 characters. The record would be inserted and selected again.

In AX7 the CustGroupID EDT is being compiled as the CLR type: string. The consequence being that no truncation occurs in the first line. The truncation happens in the data base layer, as the column can only contain 20 characters. The most significant change is in the select statement. In AX7 no record will be found, as no record has an ID matching the 30-character long ID.

Actually; this also happens in AX2012 – when X++ code is compiled as CIL.

Is this good or bad?

I think it is primarily good. It is good - very good from a performance perspective. X++ is now compiled into CLR and is magnitudes faster than in AX2012. We could have injected a small check to validate and truncate every string upon assignment - at a quite dire cost. In the vast majority of cases the truncation isn't required - string lengths are already enforced, for example on the UI - so we opted for performance.

The only issues we discovered by this was in automated testing - like unit tests, where test data defined in code contained too long strings. In reality an implementation problem already in AX2012 - but it didn't surface until now. Once you know this change in behavior, solving the relatively few issues aren't a big deal.



THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 TECHICAL PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS.







==============
Источник: http://blogs.msdn.com/b/mfp/archive/...runcation.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
mfp: X++ in AX7: Garbage Collection Blog bot DAX Blogs 0 21.12.2015 11:11
mfp: X++ in AX7: Const keyword Blog bot DAX Blogs 0 17.12.2015 12:02
mfp: X++ in AX7 Blog bot DAX Blogs 0 02.12.2015 22:13
X++: New Option to Log X++ Max-Length String Truncation Blog bot DAX Blogs 0 07.10.2011 04:12
X++: More help needed from community: Do you rely on string truncation? Blog bot DAX Blogs 4 19.03.2010 10:50

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:53.