前往Shuct.Net首页

Shudepb PB反编译专家长时间以来,为业内同类软件事实上的唯一选择.细节,彰显专业.态度,决定品质.

关于PowerBuilder的搜索

PowerBuilder: when argument to a function is in dot-notation and has value null, a null is NOT received - JJask.com Remember Register JJask.com Questions Unanswered Tags Users Ask a Question Welcome to JJask.com, where you can ask questions and receive answers from other members of the community. Related questions how do I map var myKey = “keyP” to functionP.myKey How to pass a column into a function? In JavaScript is it possible to have a series of key value functions that contain arguments? indexed object dot notation method gives scalar property What is the dot-notation between class names and what does it mean? Most popular tags java c# c++ android javascript python php ios jquery c .net objective-c asp.net html sql ruby-on-rails mysql PowerBuilder: when argument to a function is in dot-notation and has value null, a null is NOT received 0 votes I am calling a user-defined function and passing an argument that is in dot notation. For example, of_testingnullarg( tab_2.tabpage_comp_info.dw_webcomp_info.object.dormant[i] ) The above function is purely to demonstrate this problem. It accepts a long parameter and uses isNull() and messagebox() to tell the user if the parameter is null or not. Here is its listing: // of_testingnullarg( al_arg1 ) // strictly an experiment if isNull(al_arg1) then messageBox("al_arg1", "is null inside of_testingNullArg") else messageBox("al_arg1", "is NOT null inside of_testingNullArg, it is "+string(al_arg1)) end if When the dormant[i] (referring to the first function call) control contains a number, there is no problem--the parameter inside of_testingnullarg will contain the same number, as expected. But when the dormant[i] control has read null from the database, I find that the parameter inside of_testingnullarg does NOT hold null. It holds a number such as 16. Null was passed in (according to isNull()), but the parameter inside of_testingnullarg holds a number. It is not a random number, it is consistent, but seems to be dependent on how many parameters the function accepts. This problem does NOT reveal itself when I run the program inside the PowerBuilder IDE. (I am running PowerBuilder 12.5) It shows up only when I build the program and run the executable. I have found that if I first do this, the problem goes away: long ll_dormant ll_dormant = tab_2.tabpage_comp_info.dw_webcomp_info.object.dormant[i] of_testingnullarg( ll_dormant ) To summarize, the problem shows up when 3 things are true: I am NOT running the program through the PowerBuilder IDE My argument is in dot-notation (not inside a variable) The value in the control is null I think this must have something to do with a pointer on the call stack. It must be off 2 bytes or something. Is it common knowledge to always put the value into a variable first? function null PowerBuilder dot-notation asked 3 hours ago by anonymous Please log in or register to answer this question. 1 Answer 0 votes Best answer I have found out that dot-notation returns type 'ANY'. This is a problem when the value is NULL which is typeless. PowerBuilder is trying to do an implicit cast of a NULL Any value to a NULL Long and gets confused. The solution is to help PowerBuilder with the type BEFORE the function call (which is why putting it into a variable first worked). These also work: of_testingnullarg( LONG(tab_2.tabpage_comp_info.dw_webcomp_info.object.dormant[i]) ) or of_testingnullarg( tab_2.tabpage_comp_info.dw_webcomp_info.GetItemNumber(i, "dormant") ) answered 3 hours ago by anonymous Please log in or register to add a comment. Send feedback Powered by JJask.com ...