取数据窗口发生变化的一个函数(补充篇)

发表于:2007-06-07来源:作者:点击数: 标签:
取数据窗口发生变化的一个函数(补充篇) by ...---... (QQ:21417511) 前几天收到一份MAIL,说上文《取数据窗口发生变化的一个函数》写的函数中代码没放全,仔细看了一下,是用了另外一些函数,在此表示道歉啦。现在补全那些函数:of_strip() , of_getitem() ,

取数据窗口发生变化的一个函数(补充篇)
by ...---... (QQ:21417511)

前几天收到一份MAIL,说上文《取数据窗口发生变化的一个函数》写的函数中代码没放全,仔细看了一下,是用了另外一些函数,在此表示道歉啦。现在补全那些函数:of_strip() , of_getitem() , of_getstring() ,  uf_isnull(),不同的函数用不同颜色区分开了。

各位看官有兴趣自己看着改改吧……  :)

/*------------------------------------------------------------------------------

 Function:   public u_dw.of_Strip

 Returns:         String

 Parameters:      value String a_szarg

 Description:  

--------------------------------------------------------------------------------
 2005-4-25 2.0.0  Initial version by cuixuf (Mail:cuixuf@sina.com)
------------------------------------------------------------------------------*/

Integer nLength, nPos

nLength = Len( a_szArg)

For nPos = 1 To nLength
 Choose Case Mid( a_szArg, nPos, 1)
  Case "~t", "~r", "~n", '"',":"
   a_szArg = Replace( a_szArg, nPos, 2, "  ")
 End Choose
Next

Return Trim( a_szArg)

/*------------------------------------------------------------------------------

 Function:   public u_dw.of_Getitem

 Returns:         Any

 Parameters:      value DataStore ads_target
                  value Integer ai_row
                  value Integer ai_col
                  value String as_type

 Description:  

--------------------------------------------------------------------------------
 2005-4-25 2.0.0  Initial version by cuixuf (Mail:cuixuf@sina.com)
------------------------------------------------------------------------------*/

Choose Case Left(as_type,5)
 Case Left("char(n)",5)
  return ads_target.GetItemString(ai_row,ai_col)
 Case Left("date",5)
  return ads_target.GetItemDate(ai_row,ai_col)
 Case Left("datetime",5)
  return ads_target.GetItemDateTime(ai_row,ai_col)
 Case Left("decimal",5)
  return ads_target.GetItemDecimal(ai_row,ai_col)
 Case "int","long",Left("number",5),"real","ulong"
  return ads_target.GetItemNumber(ai_row,ai_col)
End Choose

/*------------------------------------------------------------------------------

 Function:   public u_dw.of_Getitem

 Returns:         Any

 Parameters:      value Integer ai_row
                  value Integer ai_col
                  value String as_type

 Description:  

--------------------------------------------------------------------------------
 2005-4-25 2.0.0  Initial version by cuixuf (Mail:cuixuf@sina.com)
------------------------------------------------------------------------------*/

Choose Case Left(as_type,5)
 Case Left("char(n)",5)
  return this.GetItemString(ai_row,ai_col)
 Case Left("date",5)
  return this.GetItemDate(ai_row,ai_col)
 Case Left("datetime",5)
  return this.GetItemDateTime(ai_row,ai_col)
 Case Left("decimal",5)
  return this.GetItemDecimal(ai_row,ai_col)
 Case "int","long",Left("number",5),"real","ulong"
  return this.GetItemNumber(ai_row,ai_col)
End Choose

/*------------------------------------------------------------------------------

 Function:   public u_dw.of_Getstring

 Returns:         String

 Parameters:      value Any aa_data
                  value String as_type

 Description:  

--------------------------------------------------------------------------------
 2005-4-25 2.0.0  Initial version by cuixuf (Mail:cuixuf@sina.com)
------------------------------------------------------------------------------*/

if isNull(aa_data) then return "[Null]"

Choose Case Left(as_type,5)
 Case Left("char(n)",5)
  return "'"+string(aa_data)+"'"
 Case Left("date",5),Left("datetime",5),Left("decimal",5),"int","long",Left("number",5),"real","ulong"
  return string(aa_data)
End Choose

/*------------------------------------------------------------------------------

 Function:   public n_functions.uf_Isnull

 Returns:         Boolean

 Parameters:      value String as_str

 Description:  

--------------------------------------------------------------------------------
 2005-4-25 2.0.0  Initial version by cuixuf (Mail:cuixuf@sina.com)
------------------------------------------------------------------------------*/

if isnull(as_str) or trim(as_str) = "" then
 return true
else
 return false
end if

另外说一句,如果大家有什么建议或者叫个好,扔个鸡蛋之类的话,请直接在评论上给出吧,因为我的MAIL中经常会自动把邮件转到垃圾信箱中,上面提到的邮件就是这种情形,不好意思啊……还算好,我在删除垃圾邮件之前,看了一眼,呵呵!

总而言之,欢迎大家评论,也让我知道有同志们关注,这样,我会放出更多的东东,小生在此谢过先!


原文转自:http://www.ltesting.net