Field.xba 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Field" script:language="StarBasic">
  4. REM =======================================================================================================================
  5. REM === The Access2Base library is a part of the LibreOffice project. ===
  6. REM === Full documentation is available on http://www.access2base.com ===
  7. REM =======================================================================================================================
  8. Option Compatible
  9. Option ClassModule
  10. Option Explicit
  11. REM -----------------------------------------------------------------------------------------------------------------------
  12. REM --- CLASS ROOT FIELDS ---
  13. REM -----------------------------------------------------------------------------------------------------------------------
  14. Private _Type As String &apos; Must be FIELD
  15. Private _This As Object &apos; Workaround for absence of This builtin function
  16. Private _Parent As Object
  17. Private _Name As String
  18. Private _Precision As Long
  19. Private _ParentName As String
  20. Private _ParentType As String
  21. Private _ParentDatabase As Object
  22. Private _ParentRecordset As Object
  23. Private _DefaultValue As String
  24. Private _DefaultValueSet As Boolean
  25. Private Column As Object &apos; com.sun.star.sdb.OTableColumnWrapper
  26. &apos; or org.openoffice.comp.dbaccess.OQueryColumn
  27. &apos; or com.sun.star.sdb.ODataColumn
  28. REM -----------------------------------------------------------------------------------------------------------------------
  29. REM --- CONSTRUCTORS / DESTRUCTORS ---
  30. REM -----------------------------------------------------------------------------------------------------------------------
  31. Private Sub Class_Initialize()
  32. _Type = OBJFIELD
  33. Set _This = Nothing
  34. Set _Parent = Nothing
  35. _Name = &quot;&quot;
  36. _ParentName = &quot;&quot;
  37. _ParentType = &quot;&quot;
  38. _DefaultValue = &quot;&quot;
  39. _DefaultValueSet = False
  40. Set Column = Nothing
  41. End Sub &apos; Constructor
  42. REM -----------------------------------------------------------------------------------------------------------------------
  43. Private Sub Class_Terminate()
  44. On Local Error Resume Next
  45. Call Class_Initialize()
  46. End Sub &apos; Destructor
  47. REM -----------------------------------------------------------------------------------------------------------------------
  48. Public Sub Dispose()
  49. Call Class_Terminate()
  50. End Sub &apos; Explicit destructor
  51. REM -----------------------------------------------------------------------------------------------------------------------
  52. REM --- CLASS GET/LET/SET PROPERTIES ---
  53. REM -----------------------------------------------------------------------------------------------------------------------
  54. Property Get DataType() As Long &apos; AOO/LibO type
  55. DataType = _PropertyGet(&quot;DataType&quot;)
  56. End Property &apos; DataType (get)
  57. Property Get DataUpdatable() As Boolean
  58. DataUpdatable = _PropertyGet(&quot;DataUpdatable&quot;)
  59. End Property &apos; DataUpdatable (get)
  60. REM -----------------------------------------------------------------------------------------------------------------------
  61. Property Get DbType() As Long &apos; MSAccess type
  62. DbType = _PropertyGet(&quot;DbType&quot;)
  63. End Property &apos; DbType (get)
  64. REM -----------------------------------------------------------------------------------------------------------------------
  65. Property Get DefaultValue() As Variant
  66. DefaultValue = _PropertyGet(&quot;DefaultValue&quot;)
  67. End Property &apos; DefaultValue (get)
  68. Property Let DefaultValue(ByVal pvDefaultValue As Variant)
  69. Call _PropertySet(&quot;DefaultValue&quot;, pvDefaultValue)
  70. End Property &apos; DefaultValue (set)
  71. REM -----------------------------------------------------------------------------------------------------------------------
  72. Property Get Description() As Variant
  73. Description = _PropertyGet(&quot;Description&quot;)
  74. End Property &apos; Description (get)
  75. Property Let Description(ByVal pvDescription As Variant)
  76. Call _PropertySet(&quot;Description&quot;, pvDescription)
  77. End Property &apos; Description (set)
  78. REM -----------------------------------------------------------------------------------------------------------------------
  79. Property Get FieldSize() As Long
  80. FieldSize = _PropertyGet(&quot;FieldSize&quot;)
  81. End Property &apos; FieldSize (get)
  82. REM -----------------------------------------------------------------------------------------------------------------------
  83. Property Get Name() As String
  84. Name = _PropertyGet(&quot;Name&quot;)
  85. End Property &apos; Name (get)
  86. REM -----------------------------------------------------------------------------------------------------------------------
  87. Property Get ObjectType() As String
  88. ObjectType = _PropertyGet(&quot;ObjectType&quot;)
  89. End Property &apos; ObjectType (get)
  90. REM -----------------------------------------------------------------------------------------------------------------------
  91. Property Get Size() As Long
  92. Size = _PropertyGet(&quot;Size&quot;)
  93. End Property &apos; Size (get)
  94. REM -----------------------------------------------------------------------------------------------------------------------
  95. Property Get SourceField() As String
  96. SourceField = _PropertyGet(&quot;SourceField&quot;)
  97. End Property &apos; SourceField (get)
  98. REM -----------------------------------------------------------------------------------------------------------------------
  99. Property Get SourceTable() As String
  100. SourceTable = _PropertyGet(&quot;SourceTable&quot;)
  101. End Property &apos; SourceTable (get)
  102. REM -----------------------------------------------------------------------------------------------------------------------
  103. Property Get TypeName() As String
  104. TypeName = _PropertyGet(&quot;TypeName&quot;)
  105. End Property &apos; TypeName (get)
  106. REM -----------------------------------------------------------------------------------------------------------------------
  107. Property Get Value() As Variant
  108. Value = _PropertyGet(&quot;Value&quot;)
  109. End Property &apos; Value (get)
  110. Property Let Value(ByVal pvValue As Variant)
  111. Call _PropertySet(&quot;Value&quot;, pvValue)
  112. End Property &apos; Value (set)
  113. REM -----------------------------------------------------------------------------------------------------------------------
  114. REM --- CLASS METHODS ---
  115. REM -----------------------------------------------------------------------------------------------------------------------
  116. REM -----------------------------------------------------------------------------------------------------------------------
  117. Public Function AppendChunk(ByRef Optional pvValue As Variant) As Boolean
  118. &apos; Store a chunk of string or binary characters into the current field, presumably a large object (CLOB or BLOB)
  119. If _ErrorHandler() Then On Local Error Goto Error_Function
  120. Const cstThisSub = &quot;Field.AppendChunk&quot;
  121. Utils._SetCalledSub(cstThisSub)
  122. AppendChunk = False
  123. If IsMissing(pvValue) Then Call _TraceArguments()
  124. If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
  125. If Not Column.IsWritable Then Goto Trace_Error_Updatable
  126. If Column.IsReadOnly Then Goto Trace_Error_Updatable
  127. If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
  128. Dim iChunkType As Integer
  129. With com.sun.star.sdbc.DataType
  130. Select Case Column.Type &apos; DOES NOT WORK FOR CHARACTER TYPES
  131. &apos; Case .CHAR, .VARCHAR, .LONGVARCHAR, .CLOB
  132. &apos; iChunkType = vbString
  133. Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB, .CHAR &apos; .CHAR added for Sqlite3
  134. iChunkType = vbByte
  135. Case Else
  136. Goto Trace_Error
  137. End Select
  138. End With
  139. AppendChunk = _ParentRecordset._AppendChunk(_Name, pvValue, iChunkType)
  140. Exit_Function:
  141. Utils._ResetCalledSub(cstThisSub)
  142. Exit Function
  143. Trace_Error_Update:
  144. TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
  145. _PropertySet = False
  146. Goto Exit_Function
  147. Trace_Error_Updatable:
  148. TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
  149. _PropertySet = False
  150. Goto Exit_Function
  151. Trace_Error:
  152. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , cstThisSub)
  153. Goto Exit_Function
  154. Error_Function:
  155. TraceError(TRACEABORT, Err, cstThisSub, Erl)
  156. _PropertySet = False
  157. GoTo Exit_Function
  158. End Function &apos; AppendChunk V1.5.0
  159. REM -----------------------------------------------------------------------------------------------------------------------
  160. Public Function GetChunk(ByVal Optional pvOffset As Variant, ByVal Optional pvBytes As Variant) As Variant
  161. &apos; Get a chunk of string or binary characters from the current field, presumably a large object (CLOB or BLOB)
  162. If _ErrorHandler() Then On Local Error Goto Error_Function
  163. Const cstThisSub = &quot;Field.GetChunk&quot;
  164. Utils._SetCalledSub(cstThisSub)
  165. Dim oValue As Object, bNullable As Boolean, bNull As Boolean, vValue() As Variant
  166. Dim lLength As Long, lOffset As Long, lValue As Long
  167. If IsMissing(pvOffset) Or IsMissing(pvBytes) Then Call _TraceArguments()
  168. If Not Utils._CheckArgument(pvOffset, 1, _AddNumeric()) Then Goto Exit_Function
  169. If pvOffset &lt; 0 Then
  170. TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(1, pvOffset))
  171. Goto Exit_Function
  172. End If
  173. If Not Utils._CheckArgument(pvBytes, 2, _AddNumeric()) Then Goto Exit_Function
  174. If pvBytes &lt; 0 Then
  175. TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(2, pvBytes))
  176. Goto Exit_Function
  177. End If
  178. bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
  179. bNull = False
  180. GetChunk = Null
  181. vValue = Array()
  182. With com.sun.star.sdbc.DataType
  183. Select Case Column.Type &apos; DOES NOT WORK FOR CHARACTER TYPES
  184. &apos; Case .CHAR, .VARCHAR, .LONGVARCHAR
  185. &apos; Set oValue = Column.getCharacterStream()
  186. &apos; Case .CLOB
  187. &apos; Set oValue = Column.getClob.getCharacterStream()
  188. Case .BINARY, .VARBINARY, .LONGVARBINARY
  189. Set oValue = Column.getBinaryStream()
  190. Case .BLOB
  191. Set oValue = Column.getBlob.getBinaryStream()
  192. Case Else
  193. Goto Trace_Error
  194. End Select
  195. If bNullable Then bNull = Column.wasNull()
  196. If Not bNull Then
  197. lOffset = CLng(pvOffset)
  198. If lOffset &gt; 0 Then oValue.skipBytes(lOffset)
  199. lValue = oValue.readBytes(vValue, pvBytes)
  200. End If
  201. oValue.closeInput()
  202. End With
  203. GetChunk = vValue
  204. Exit_Function:
  205. Utils._ResetCalledSub(cstThisSub)
  206. Exit Function
  207. Trace_Error:
  208. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , cstThisSub)
  209. Goto Exit_Function
  210. Trace_Argument:
  211. TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(iArg, pvIndex))
  212. Set vForms = Nothing
  213. Goto Exit_Function
  214. Error_Function:
  215. TraceError(TRACEABORT, Err, cstThisSub, Erl)
  216. GoTo Exit_Function
  217. End Function &apos; GetChunk V1.5.0
  218. REM -----------------------------------------------------------------------------------------------------------------------
  219. Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
  220. &apos; Return property value of psProperty property name
  221. Const cstThisSub = &quot;Field.getProperty&quot;
  222. Utils._SetCalledSub(cstThisSub)
  223. If IsMissing(pvProperty) Then Call _TraceArguments()
  224. getProperty = _PropertyGet(pvProperty)
  225. Utils._ResetCalledSub(cstThisSub)
  226. End Function &apos; getProperty
  227. REM -----------------------------------------------------------------------------------------------------------------------
  228. Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
  229. &apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
  230. Const cstThisSub = &quot;Field.hasProperty&quot;
  231. Utils._SetCalledSub(cstThisSub)
  232. If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
  233. Utils._ResetCalledSub(cstThisSub)
  234. Exit Function
  235. End Function &apos; hasProperty
  236. REM -----------------------------------------------------------------------------------------------------------------------
  237. Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
  238. &apos; Return
  239. &apos; a Collection object if pvIndex absent
  240. &apos; a Property object otherwise
  241. Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String, sName As String
  242. Const cstThisSub = &quot;Field.Properties&quot;
  243. Utils._SetCalledSub(cstThisSub)
  244. vPropertiesList = _PropertiesList()
  245. sObject = Utils._PCase(_Type)
  246. sName = _ParentType &amp; &quot;/&quot; &amp; _ParentName &amp; &quot;/&quot; &amp; _Name
  247. If IsMissing(pvIndex) Then
  248. vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
  249. Else
  250. vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
  251. vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
  252. Set vProperty._ParentDatabase = _ParentDatabase
  253. End If
  254. Exit_Function:
  255. Set Properties = vProperty
  256. Utils._ResetCalledSub(cstThisSub)
  257. Exit Function
  258. End Function &apos; Properties
  259. REM -----------------------------------------------------------------------------------------------------------------------
  260. Public Function ReadAllBytes(ByVal Optional pvFile As Variant) As Boolean
  261. &apos; Read the whole content of a file into Long Binary Field object
  262. Const cstThisSub = &quot;Field.ReadAllBytes&quot;
  263. Utils._SetCalledSub(cstThisSub)
  264. If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
  265. ReadAllBytes = _ReadAll(pvFile, &quot;ReadAllBytes&quot;)
  266. Exit_Function:
  267. Utils._ResetCalledSub(cstThisSub)
  268. Exit Function
  269. End Function &apos; ReadAllBytes
  270. REM -----------------------------------------------------------------------------------------------------------------------
  271. Public Function ReadAllText(ByVal Optional pvFile As Variant) As Boolean
  272. &apos; Read the whole content of a file into a Long Char Field object
  273. Const cstThisSub = &quot;Field.ReadAllText&quot;
  274. Utils._SetCalledSub(cstThisSub)
  275. If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
  276. ReadAllText = _ReadAll(pvFile, &quot;ReadAllText&quot;)
  277. Exit_Function:
  278. Utils._ResetCalledSub(cstThisSub)
  279. Exit Function
  280. End Function &apos; ReadAllText
  281. REM -----------------------------------------------------------------------------------------------------------------------
  282. Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
  283. &apos; Return True if property setting OK
  284. Const cstThisSub = &quot;Field.setProperty&quot;
  285. Utils._SetCalledSub(cstThisSub)
  286. setProperty = _PropertySet(psProperty, pvValue)
  287. Utils._ResetCalledSub(cstThisSub)
  288. End Function
  289. REM -----------------------------------------------------------------------------------------------------------------------
  290. Public Function WriteAllBytes(ByVal Optional pvFile As Variant) As Boolean
  291. &apos; Write the whole content of a Long Binary Field object to a file
  292. Const cstThisSub = &quot;Field.WriteAllBytes&quot;
  293. Utils._SetCalledSub(cstThisSub)
  294. If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
  295. WriteAllBytes = _WriteAll(pvFile, &quot;WriteAllBytes&quot;)
  296. Exit_Function:
  297. Utils._ResetCalledSub(cstThisSub)
  298. Exit Function
  299. End Function &apos; WriteAllBytes
  300. REM -----------------------------------------------------------------------------------------------------------------------
  301. Public Function WriteAllText(ByVal Optional pvFile As Variant) As Boolean
  302. &apos; Write the whole content of a Long Char Field object to a file
  303. Const cstThisSub = &quot;Field.WriteAllText&quot;
  304. Utils._SetCalledSub(cstThisSub)
  305. If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
  306. WriteAllText = _WriteAll(pvFile, &quot;WriteAllText&quot;)
  307. Exit_Function:
  308. Utils._ResetCalledSub(cstThisSub)
  309. Exit Function
  310. End Function &apos; WriteAllText
  311. REM -----------------------------------------------------------------------------------------------------------------------
  312. REM --- PRIVATE FUNCTIONS ---
  313. REM -----------------------------------------------------------------------------------------------------------------------
  314. REM -----------------------------------------------------------------------------------------------------------------------
  315. Private Function _PropertiesList() As Variant
  316. Select Case _ParentType
  317. Case OBJTABLEDEF
  318. _PropertiesList =Array(&quot;DataType&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
  319. , &quot;Description&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Size&quot;, &quot;SourceField&quot;, &quot;SourceTable&quot; _
  320. , &quot;TypeName&quot; _
  321. )
  322. Case OBJQUERYDEF
  323. _PropertiesList = Array(&quot;DataType&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
  324. , &quot;Description&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Size&quot;, &quot;SourceField&quot;, &quot;SourceTable&quot; _
  325. , &quot;TypeName&quot; _
  326. )
  327. Case OBJRECORDSET
  328. _PropertiesList = Array(&quot;DataType&quot;, &quot;DataUpdatable&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
  329. , &quot;Description&quot; , &quot;FieldSize&quot;, &quot;Name&quot;, &quot;ObjectType&quot; _
  330. , &quot;Size&quot;, &quot;SourceTable&quot;, &quot;TypeName&quot;, &quot;Value&quot; _
  331. )
  332. End Select
  333. End Function &apos; _PropertiesList
  334. REM -----------------------------------------------------------------------------------------------------------------------
  335. Private Function _PropertyGet(ByVal psProperty As String) As Variant
  336. &apos; Return property value of the psProperty property name
  337. If _ErrorHandler() Then On Local Error Goto Error_Function
  338. Dim cstThisSub As String
  339. cstThisSub = &quot;Field.get&quot; &amp; psProperty
  340. Utils._SetCalledSub(cstThisSub)
  341. If Not hasProperty(psProperty) Then Goto Trace_Error
  342. Dim bCond1 As Boolean, bCond2 As Boolean, vValue As Variant, oValue As Object, sValue As String
  343. Dim oSize As Object, lSize As Long, bNullable As Boolean, bNull As Boolean
  344. Const cstMaxBinlength = 2 * 65535
  345. _PropertyGet = EMPTY
  346. Select Case UCase(psProperty)
  347. Case UCase(&quot;DataType&quot;)
  348. _PropertyGet = Column.Type
  349. Case UCase(&quot;DbType&quot;)
  350. With com.sun.star.sdbc.DataType
  351. Select Case Column.Type
  352. Case .BIT : _PropertyGet = dbBoolean
  353. Case .TINYINT : _PropertyGet = dbInteger
  354. Case .SMALLINT : _PropertyGet = dbLong
  355. Case .INTEGER : _PropertyGet = dbLong
  356. Case .BIGINT : _PropertyGet = dbBigInt
  357. Case .FLOAT : _PropertyGet = dbFloat
  358. Case .REAL : _PropertyGet = dbSingle
  359. Case .DOUBLE : _PropertyGet = dbDouble
  360. Case .NUMERIC : _PropertyGet = dbNumeric
  361. Case .DECIMAL : _PropertyGet = dbDecimal
  362. Case .CHAR : _PropertyGet = dbChar
  363. Case .VARCHAR : _PropertyGet = dbText
  364. Case .LONGVARCHAR : _PropertyGet = dbMemo
  365. Case .CLOB : _PropertyGet = dbMemo
  366. Case .DATE : _PropertyGet = dbDate
  367. Case .TIME : _PropertyGet = dbTime
  368. Case .TIMESTAMP : _PropertyGet = dbTimeStamp
  369. Case .BINARY : _PropertyGet = dbBinary
  370. Case .VARBINARY : _PropertyGet = dbVarBinary
  371. Case .LONGVARBINARY : _PropertyGet = dbLongBinary
  372. Case .BLOB : _PropertyGet = dbLongBinary
  373. Case .BOOLEAN : _PropertyGet = dbBoolean
  374. Case Else : _PropertyGet = dbUndefined
  375. End Select
  376. End With
  377. Case UCase(&quot;DataUpdatable&quot;)
  378. If Utils._hasUNOProperty(Column, &quot;IsWritable&quot;) Then
  379. _PropertyGet = Column.IsWritable
  380. ElseIf Utils._hasUNOProperty(Column, &quot;IsReadOnly&quot;) Then
  381. _PropertyGet = Not Column.IsReadOnly
  382. ElseIf Utils._hasUNOProperty(Column, &quot;IsDefinitelyWritable&quot;) Then
  383. _PropertyGet = Column.IsDefinitelyWritable
  384. Else
  385. _PropertyGet = False
  386. End If
  387. If Utils._hasUNOProperty(Column, &quot;IsAutoIncrement&quot;) Then
  388. If Column.IsAutoIncrement Then _PropertyGet = False &apos; Forces False if auto-increment (MSAccess)
  389. End If
  390. Case UCase(&quot;DefaultValue&quot;)
  391. &apos; default value buffered to avoid multiple calls
  392. If Not _DefaultValueSet Then
  393. If Utils._hasUNOProperty(Column, &quot;DefaultValue&quot;) Then &apos; Default value in database set via SQL statement
  394. _DefaultValue = Column.DefaultValue
  395. ElseIf Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
  396. If IsEmpty(Column.ControlDefault) Then _DefaultValue = &quot;&quot; Else _DefaultValue = Column.ControlDefault
  397. Else
  398. _DefaultValue = &quot;&quot;
  399. End If
  400. _DefaultValueSet = True
  401. End If
  402. _PropertyGet = _DefaultValue
  403. Case UCase(&quot;Description&quot;)
  404. bCond1 = Utils._hasUNOProperty(Column, &quot;Description&quot;)
  405. bCond2 = Utils._hasUNOProperty(Column, &quot;HelpText&quot;)
  406. Select Case True
  407. Case ( bCond1 And bCond2 )
  408. If IsEmpty(Column.HelpText) Then _PropertyGet = Column.Description Else _PropertyGet = Column.HelpText
  409. Case ( bCond1 And ( Not bCond2 ) )
  410. _PropertyGet = Column.Description
  411. Case ( ( Not bCond1 ) And bCond2 )
  412. _PropertyGet = Column.HelpText
  413. Case Else
  414. _PropertyGet = &quot;&quot;
  415. End Select
  416. Case UCase(&quot;FieldSize&quot;)
  417. With com.sun.star.sdbc.DataType
  418. Select Case Column.Type
  419. Case .VARCHAR, .LONGVARCHAR, .CLOB
  420. Set oSize = Column.getCharacterStream
  421. Case .LONGVARBINARY, .VARBINARY, .BINARY, .BLOB
  422. Set oSize = Column.getBinaryStream
  423. Case Else
  424. Set oSize = Nothing
  425. End Select
  426. End With
  427. If Not IsNull(oSize) Then
  428. bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
  429. If bNullable Then
  430. If Column.wasNull() Then _PropertyGet = 0 Else _PropertyGet = CLng(oSize.getLength())
  431. Else
  432. _PropertyGet = CLng(oSize.getLength())
  433. End If
  434. oSize.closeInput()
  435. Else
  436. _PropertyGet = EMPTY
  437. End If
  438. Case UCase(&quot;Name&quot;)
  439. _PropertyGet = _Name
  440. Case UCase(&quot;ObjectType&quot;)
  441. _PropertyGet = _Type
  442. Case UCase(&quot;Size&quot;)
  443. With com.sun.star.sdbc.DataType
  444. Select Case Column.Type
  445. Case .LONGVARCHAR, .LONGVARBINARY, .VARBINARY, .BINARY, .BLOB, .CLOB
  446. _PropertyGet = 0 &apos; Always 0 (MSAccess)
  447. Case Else
  448. If Utils._hasUNOProperty(Column, &quot;Precision&quot;) Then _PropertyGet = Column.Precision Else _PropertyGet = 0
  449. End Select
  450. End With
  451. Case UCase(&quot;SourceField&quot;)
  452. Select Case _ParentType
  453. Case OBJTABLEDEF
  454. _PropertyGet = _Name
  455. Case OBJQUERYDEF &apos; RealName = not documented ?!?
  456. If Utils._hasUNOProperty(Column, &quot;RealName&quot;) Then _PropertyGet = Column.RealName Else _PropertyGet = _Name
  457. End Select
  458. Case UCase(&quot;SourceTable&quot;)
  459. Select Case _ParentType
  460. Case OBJTABLEDEF
  461. _PropertyGet = _ParentName
  462. Case OBJQUERYDEF, OBJRECORDSET
  463. _PropertyGet = Column.TableName
  464. End Select
  465. Case UCase(&quot;TypeName&quot;)
  466. _PropertyGet = Column.TypeName
  467. Case UCase(&quot;Value&quot;)
  468. bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
  469. bNull = False
  470. With com.sun.star.sdbc.DataType
  471. Select Case Column.Type
  472. Case .BIT, .BOOLEAN : vValue = Column.getBoolean() &apos; vbBoolean
  473. Case .TINYINT : vValue = Column.getShort() &apos; vbInteger
  474. Case .SMALLINT, .INTEGER: vValue = Column.getInt() &apos; vbLong
  475. Case .BIGINT : vValue = Column.getLong() &apos; vbBigint
  476. Case .FLOAT : vValue = Column.getFloat() &apos; vbSingle
  477. Case .REAL, .DOUBLE : vValue = Column.getDouble() &apos; vbDouble
  478. Case .NUMERIC, .DECIMAL
  479. If Utils._hasUNOProperty(Column, &quot;Scale&quot;) Then
  480. If Column.Scale &gt; 0 Then
  481. vValue = Column.getDouble()
  482. Else &apos; Try Long otherwise Double (CDec not implemented anymore in LO ?!?)
  483. On Local Error Resume Next &apos; Avoid overflow error
  484. &apos; CLng checks local decimal point, getString does not !
  485. sValue = Join(Split(Column.getString(), &quot;.&quot;), Utils._DecimalPoint())
  486. vValue = CLng(sValue)
  487. If Err &lt;&gt; 0 Then
  488. vValue = CDbl(sValue)
  489. Err.Clear
  490. On Local Error Goto Error_Function
  491. End If
  492. End If
  493. Else
  494. vValue = CDbl(Column.getString())
  495. End If
  496. Case .CHAR : vValue = Column.getString()
  497. Case .VARCHAR : vValue = Column.getString() &apos; vbString
  498. Case .LONGVARCHAR, .CLOB
  499. Set oValue = Column.getCharacterStream()
  500. If bNullable Then bNull = Column.wasNull()
  501. If Not bNull Then
  502. lSize = CLng(oValue.getLength())
  503. oValue.closeInput()
  504. vValue = Column.getString() &apos; vbString
  505. Else
  506. oValue.closeInput()
  507. End If
  508. Case .DATE : Set oValue = Column.getDate() &apos; vbObject with members VarType Unsigned Short = 18
  509. If bNullable Then bNull = Column.wasNull()
  510. If Not bNull Then vValue = DateSerial(CInt(oValue.Year), CInt(oValue.Month), CInt(oValue.Day))
  511. Case .TIME : Set oValue = Column.getTime() &apos; vbObject with members VarType Unsigned Short = 18
  512. If bNullable Then bNull = Column.wasNull()
  513. If Not bNull Then vValue = TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)&apos;, oValue.HundredthSeconds)
  514. Case .TIMESTAMP : Set oValue = Column.getTimeStamp()
  515. If bNullable Then bNull = Column.wasNull()
  516. If Not bNull Then vValue = DateSerial(CInt(oValue.Year), CInt(oValue.Month), CInt(oValue.Day)) _
  517. + TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)&apos;, oValue.HundredthSeconds)
  518. Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
  519. Set oValue = Column.getBinaryStream()
  520. If bNullable Then bNull = Column.wasNull()
  521. If Not bNull Then
  522. lSize = CLng(oValue.getLength()) &apos; vbLong =&gt; equivalent to FieldSize
  523. If lSize &gt; cstMaxBinlength Then Goto Trace_Length
  524. vValue = Array()
  525. oValue.readBytes(vValue, lSize)
  526. End If
  527. oValue.closeInput()
  528. Case Else
  529. vValue = Column.getString() &apos;GIVE STRING A TRY
  530. If IsNumeric(vValue) Then vValue = Val(vValue) &apos;Required when type = &quot;&quot;, sometimes numeric fields are returned as strings (query/MSAccess)
  531. End Select
  532. If bNullable Then
  533. If Column.wasNull() Then vValue = Null &apos;getXXX must precede wasNull()
  534. End If
  535. End With
  536. _PropertyGet = vValue
  537. Case Else
  538. Goto Trace_Error
  539. End Select
  540. Exit_Function:
  541. Utils._ResetCalledSub(cstThisSub)
  542. Exit Function
  543. Trace_Error:
  544. TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
  545. _PropertyGet = EMPTY
  546. Goto Exit_Function
  547. Trace_Length:
  548. TraceError(TRACEFATAL, ERROVERFLOW, Utils._CalledSub(), 0, , Array(lSize, &quot;GetChunk&quot;))
  549. _PropertyGet = EMPTY
  550. Goto Exit_Function
  551. Error_Function:
  552. TraceError(TRACEABORT, Err, cstThisSub, Erl)
  553. _PropertyGet = EMPTY
  554. GoTo Exit_Function
  555. End Function &apos; _PropertyGet V1.1.0
  556. REM -----------------------------------------------------------------------------------------------------------------------
  557. Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
  558. &apos; Return True if property setting OK
  559. If _ErrorHandler() Then On Local Error Goto Error_Function
  560. Dim cstThisSub As String
  561. cstThisSub = &quot;Field.set&quot; &amp; psProperty
  562. Utils._SetCalledSub(cstThisSub)
  563. _PropertySet = True
  564. Dim iArgNr As Integer, vTemp As Variant
  565. Dim oParent As Object
  566. Select Case UCase(_A2B_.CalledSub)
  567. Case UCase(&quot;setProperty&quot;) : iArgNr = 3
  568. Case UCase(&quot;Field.setProperty&quot;) : iArgNr = 2
  569. Case UCase(cstThisSub) : iArgNr = 1
  570. End Select
  571. If Not hasProperty(psProperty) Then Goto Trace_Error
  572. Select Case UCase(psProperty)
  573. Case UCase(&quot;DefaultValue&quot;)
  574. If _ParentType &lt;&gt; OBJTABLEDEF Then Goto Trace_Error
  575. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  576. If Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
  577. Column.ControlDefault = pvValue
  578. _DefaultValue = pvValue
  579. _DefaultValueSet = True
  580. End If
  581. Case UCase(&quot;Description&quot;)
  582. If _ParentType &lt;&gt; OBJTABLEDEF Then Goto Trace_Error
  583. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  584. Column.HelpText = pvValue
  585. Case UCase(&quot;Value&quot;)
  586. If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
  587. If Not Column.IsWritable Then Goto Trace_Error_Updatable
  588. If Column.IsReadOnly Then Goto Trace_Error_Updatable
  589. If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
  590. With com.sun.star.sdbc.DataType
  591. If IsNull(pvValue) Then
  592. If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then Column.updateNull() Else Goto Trace_Null
  593. Else
  594. Select Case Column.Type
  595. Case .BIT, .BOOLEAN
  596. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  597. Column.updateBoolean(pvValue)
  598. Case .TINYINT
  599. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  600. If pvValue &lt; -128 Or pvValue &gt; +127 Then Goto Trace_Error_Value
  601. Column.updateShort(CInt(pvValue))
  602. Case .SMALLINT
  603. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  604. If pvValue &lt; -32768 Or pvValue &gt; 32767 Then Goto trace_Error_Value
  605. Column.updateInt(CLng(pvValue))
  606. Case .INTEGER
  607. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  608. If pvValue &lt; -2147483648 Or pvValue &gt; 2147483647 Then Goto trace_Error_Value
  609. Column.updateInt(CLng(pvValue))
  610. Case .BIGINT
  611. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  612. Column.updateLong(pvValue) &apos; No proper type conversion for HYPER data type
  613. Case .FLOAT
  614. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  615. If Abs(pvValue) &lt; 3.402823E38 And Abs(pvValue) &gt; 1.401298E-45 Then Column.updateFloat(CSng(pvValue)) Else Goto trace_Error_Value
  616. Case .REAL, .DOUBLE
  617. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  618. &apos;If Abs(pvValue) &lt; 1.79769313486232E308 And Abs(pvValue) &gt; 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value
  619. Column.updateDouble(CDbl(pvValue))
  620. Case .NUMERIC, .DECIMAL
  621. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  622. If Utils._hasUNOProperty(Column, &quot;Scale&quot;) Then
  623. If Column.Scale &gt; 0 Then
  624. &apos;If Abs(pvValue) &lt; 1.79769313486232E308 And Abs(pvValue) &gt; 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value
  625. Column.updateDouble(CDbl(pvValue))
  626. Else
  627. Column.updateString(CStr(pvValue))
  628. End If
  629. Else
  630. Column.updateString(CStr(pvValue))
  631. End If
  632. Case .CHAR, .VARCHAR, .LONGVARCHAR, .CLOB
  633. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  634. If _Precision &gt; 0 And Len(pvValue) &gt; _Precision Then Goto Trace_Error_Length
  635. Column.updateString(pvValue) &apos; vbString
  636. Case .DATE
  637. If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
  638. vTemp = New com.sun.star.util.Date
  639. With vTemp
  640. .Day = Day(pvValue)
  641. .Month = Month(pvValue)
  642. .Year = Year(pvValue)
  643. End With
  644. Column.updateDate(vTemp)
  645. Case .TIME
  646. If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
  647. vTemp = New com.sun.star.util.Time
  648. With vTemp
  649. .Hours = Hour(pvValue)
  650. .Minutes = Minute(pvValue)
  651. .Seconds = Second(pvValue)
  652. &apos;.HundredthSeconds = 0 &apos; replaced with Long nanoSeconds in LO 4.1 ??
  653. End With
  654. Column.updateTime(vTemp)
  655. Case .TIMESTAMP
  656. If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
  657. vTemp = New com.sun.star.util.DateTime
  658. With vTemp
  659. .Day = Day(pvValue)
  660. .Month = Month(pvValue)
  661. .Year = Year(pvValue)
  662. .Hours = Hour(pvValue)
  663. .Minutes = Minute(pvValue)
  664. .Seconds = Second(pvValue)
  665. &apos;.HundredthSeconds = 0
  666. End With
  667. Column.updateTimestamp(vTemp)
  668. Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
  669. If Not IsArray(pvValue) Then Goto Trace_Error_Value
  670. If UBound(pvValue) &lt; LBound(pvValue) Then Goto Trace_Error_Value
  671. If Not Utils._CheckArgument(pvValue(LBound(pvValue)), iArgNr, vbInteger, , False) Then Goto Trace_Error_Value
  672. Column.updateBytes(pvValue)
  673. Case Else
  674. Goto trace_Error
  675. End Select
  676. End If
  677. End With
  678. Case Else
  679. Goto Trace_Error
  680. End Select
  681. Exit_Function:
  682. Utils._ResetCalledSub(cstThisSub)
  683. Exit Function
  684. Trace_Error:
  685. TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
  686. _PropertySet = False
  687. Goto Exit_Function
  688. Trace_Error_Value:
  689. TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
  690. _PropertySet = False
  691. Goto Exit_Function
  692. Trace_Null:
  693. TraceError(TRACEFATAL, ERRNOTNULLABLE, Utils._CalledSub(), 0, 1, _Name)
  694. _PropertySet = False
  695. Goto Exit_Function
  696. Trace_Error_Update:
  697. TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
  698. _PropertySet = False
  699. Goto Exit_Function
  700. Trace_Error_Updatable:
  701. TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
  702. _PropertySet = False
  703. Goto Exit_Function
  704. Trace_Error_Length:
  705. TraceError(TRACEFATAL, ERROVERFLOW, Utils._CalledSub(), 0, , Array(Len(pvValue), &quot;AppendChunk&quot;))
  706. _PropertySet = False
  707. Goto Exit_Function
  708. Error_Function:
  709. TraceError(TRACEABORT, Err, cstThisSub, Erl)
  710. _PropertySet = False
  711. GoTo Exit_Function
  712. End Function &apos; _PropertySet
  713. REM -----------------------------------------------------------------------------------------------------------------------
  714. Public Function _ReadAll(ByVal psFile As String, ByVal psMethod As String) As Boolean
  715. &apos; Write the whole content of a file into a stream object
  716. If _ErrorHandler() Then On Local Error Goto Error_Function
  717. _ReadAll = False
  718. If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
  719. If Not Column.IsWritable Then Goto Trace_Error_Updatable
  720. If Column.IsReadOnly Then Goto Trace_Error_Updatable
  721. If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
  722. Dim sFile As String, oSimpleFileAccess As Object, sMethod As String, oStream As Object
  723. Dim lFileLength As Long, sBuffer As String, sMemo As String, iFile As Integer
  724. Const cstMaxLength = 64000
  725. sFile = ConvertToURL(psFile)
  726. oSimpleFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
  727. If Not oSimpleFileAccess.exists(sFile) Then Goto Trace_File
  728. With com.sun.star.sdbc.DataType
  729. Select Case Column.Type
  730. Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
  731. If psMethod &lt;&gt; &quot;ReadAllBytes&quot; Then Goto Trace_Error
  732. Set oStream = oSimpleFileAccess.openFileRead(sFile)
  733. lFileLength = oStream.getLength()
  734. If lFileLength = 0 Then Goto Trace_File
  735. Column.updateBinaryStream(oStream, lFileLength)
  736. oStream.closeInput()
  737. Case .VARCHAR, .LONGVARCHAR, .CLOB
  738. If psMethod &lt;&gt; &quot;ReadAllText&quot; Then Goto Trace_Error
  739. sMemo = &quot;&quot;
  740. lFileLength = 0
  741. iFile = FreeFile()
  742. Open sFile For Input Access Read Shared As iFile
  743. Do While Not Eof(iFile)
  744. Line Input #iFile, sBuffer
  745. lFileLength = lFileLength + Len(sBuffer) + 1
  746. If lFileLength &gt; cstMaxLength Then Exit Do
  747. sMemo = sMemo &amp; sBuffer &amp; vbNewLine
  748. Loop
  749. If lFileLength = 0 Or lFileLength &gt; cstMaxLength Then
  750. Close #iFile
  751. Goto Trace_File
  752. End If
  753. sMemo = Left(sMemo, lFileLength - 1)
  754. Column.updateString(sMemo)
  755. &apos;Column.updateCharacterStream(oStream, lFileLength) &apos; DOES NOT WORK ?!?
  756. Case Else
  757. Goto Trace_Error
  758. End Select
  759. End With
  760. _ReadAll = True
  761. Exit_Function:
  762. Exit Function
  763. Trace_Error:
  764. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , psMethod)
  765. Goto Exit_Function
  766. Trace_File:
  767. TraceError(TRACEFATAL, ERRFILEACCESS, Utils._CalledSub(), 0, , sFile)
  768. If Not IsNull(oStream) Then oStream.closeInput()
  769. Goto Exit_Function
  770. Trace_Error_Update:
  771. TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
  772. If Not IsNull(oStream) Then oStream.closeInput()
  773. Goto Exit_Function
  774. Trace_Error_Updatable:
  775. TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
  776. If Not IsNull(oStream) Then oStream.closeInput()
  777. Goto Exit_Function
  778. Error_Function:
  779. TraceError(TRACEABORT, Err, _CalledSub, Erl)
  780. GoTo Exit_Function
  781. End Function &apos; ReadAll
  782. REM -----------------------------------------------------------------------------------------------------------------------
  783. Public Function _WriteAll(ByVal psFile As String, ByVal psMethod As String) As Boolean
  784. &apos; Write the whole content of a stream object to a file
  785. If _ErrorHandler() Then On Local Error Goto Error_Function
  786. _WriteAll = False
  787. Dim sFile As String, oSimpleFileAccess As Object, sMethod As String, oStream As Object
  788. sFile = ConvertToURL(psFile)
  789. oSimpleFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
  790. With com.sun.star.sdbc.DataType
  791. Select Case Column.Type
  792. Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
  793. If psMethod &lt;&gt; &quot;WriteAllBytes&quot; Then Goto Trace_Error
  794. Set oStream = Column.getBinaryStream()
  795. Case .VARCHAR, .LONGVARCHAR, .CLOB
  796. If psMethod &lt;&gt; &quot;WriteAllText&quot; Then Goto Trace_Error
  797. Set oStream = Column.getCharacterStream()
  798. Case Else
  799. Goto Trace_Error
  800. End Select
  801. End With
  802. If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then
  803. If Column.wasNull() Then Goto Trace_Null
  804. End If
  805. If oStream.getLength() = 0 Then Goto Trace_Null
  806. On Local Error Goto Trace_File
  807. If oSimpleFileAccess.exists(sFile) Then oSimpleFileAccess.kill(sFile)
  808. oSimpleFileAccess.writeFile(sFile, oStream)
  809. On Local Error Goto Error_Function
  810. oStream.closeInput()
  811. _WriteAll = True
  812. Exit_Function:
  813. Exit Function
  814. Trace_Error:
  815. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , psMethod)
  816. Goto Exit_Function
  817. Trace_File:
  818. TraceError(TRACEFATAL, ERRFILEACCESS, Utils._CalledSub(), 0, , sFile)
  819. If Not IsNull(oStream) Then oStream.closeInput()
  820. Goto Exit_Function
  821. Trace_Null:
  822. TraceError(TRACEFATAL, ERRFIELDNULL, _CalledSub, 0)
  823. If Not IsNull(oStream) Then oStream.closeInput()
  824. Goto Exit_Function
  825. Error_Function:
  826. TraceError(TRACEABORT, Err, _CalledSub, Erl)
  827. GoTo Exit_Function
  828. End Function &apos; WriteAll
  829. </script:module>