@@ -59,10 +59,21 @@ class ThinLobImpl extends LobImpl {
59
59
}
60
60
}
61
61
62
+ //---------------------------------------------------------------------------
63
+ // getChunkSize()
64
+ //
65
+ // Internal method for returning the chunk size of the LOB.
66
+ //---------------------------------------------------------------------------
62
67
getChunkSize ( ) {
63
68
return this . _chunkSize ;
64
69
}
65
70
71
+ //---------------------------------------------------------------------------
72
+ // _getChunkSizeAsync()
73
+ //
74
+ // Internal method for returning the chunk size of the LOB fetched from
75
+ // the database.
76
+ //---------------------------------------------------------------------------
66
77
async _getChunkSizeAsync ( ) {
67
78
this . checkConn ( ) ;
68
79
const options = {
@@ -73,29 +84,60 @@ class ThinLobImpl extends LobImpl {
73
84
this . _chunkSize = this . _pieceSize = await this . _sendMessage ( options ) ;
74
85
}
75
86
87
+ //---------------------------------------------------------------------------
88
+ // getLength()
89
+ //
90
+ // Internal method for returning the length of a LOB.
91
+ //---------------------------------------------------------------------------
76
92
getLength ( ) {
77
93
return this . _length ;
78
94
}
79
95
96
+ //---------------------------------------------------------------------------
97
+ // getPieceSize()
98
+ //
99
+ // Internal method returning the size to use for each piece that is
100
+ // transferred when reading from the LOB.
101
+ //---------------------------------------------------------------------------
80
102
getPieceSize ( ) {
81
103
return this . _pieceSize ;
82
104
}
83
105
106
+ //---------------------------------------------------------------------------
107
+ // setPieceSize()
108
+ //
109
+ // Internal method to set the pieceSize for LOBs.
110
+ //---------------------------------------------------------------------------
84
111
setPieceSize ( value ) {
85
112
this . _pieceSize = value ;
86
113
}
87
114
115
+ //---------------------------------------------------------------------------
116
+ // getType()
117
+ //
118
+ // Internal method returning the datatype of LOBs.
119
+ //---------------------------------------------------------------------------
88
120
getType ( ) {
89
121
return this . dbType ;
90
122
}
91
123
124
+ //---------------------------------------------------------------------------
125
+ // getData()
126
+ //
127
+ // Internal method returning the data obtained from the database.
128
+ //---------------------------------------------------------------------------
92
129
async getData ( offset = 1 , len = this . _length ) {
93
130
if ( ! len ) {
94
131
len = this . _length ;
95
132
}
96
133
return await this . read ( offset , len ) ;
97
134
}
98
135
136
+ //---------------------------------------------------------------------------
137
+ // read()
138
+ //
139
+ // Internal method for reading a portion (or all) of the data in the LOB.
140
+ //---------------------------------------------------------------------------
99
141
async read ( offset , length ) {
100
142
this . checkConn ( ) ;
101
143
const options = {
@@ -108,6 +150,11 @@ class ThinLobImpl extends LobImpl {
108
150
return await this . _sendMessage ( options ) ;
109
151
}
110
152
153
+ //---------------------------------------------------------------------------
154
+ // write()
155
+ //
156
+ // Internal method for writing data to the LOB object.
157
+ //---------------------------------------------------------------------------
111
158
async write ( offset , data ) {
112
159
this . checkConn ( ) ;
113
160
const options = {
@@ -120,6 +167,11 @@ class ThinLobImpl extends LobImpl {
120
167
this . _length += data . length ;
121
168
}
122
169
170
+ //---------------------------------------------------------------------------
171
+ // getCsfrm()
172
+ //
173
+ // Return the character set encoding used by the LOB.
174
+ //---------------------------------------------------------------------------
123
175
getCsfrm ( ) {
124
176
if ( this . dbType . _csfrm !== constants . CSFRM_NCHAR ) {
125
177
if ( this . _locator [ constants . TNS_LOB_LOC_OFFSET_FLAG_3 ] &
@@ -155,11 +207,21 @@ class ThinLobImpl extends LobImpl {
155
207
await this . _getChunkSizeAsync ( ) ;
156
208
}
157
209
210
+ //---------------------------------------------------------------------------
211
+ // checkConn()
212
+ //
213
+ // Internal method to check the connection.
214
+ //---------------------------------------------------------------------------
158
215
checkConn ( ) {
159
216
if ( ! this . conn . nscon . connected )
160
217
errors . throwErr ( errors . ERR_INVALID_CONNECTION ) ;
161
218
}
162
219
220
+ //---------------------------------------------------------------------------
221
+ // close()
222
+ //
223
+ // Internal method to close the LOBs using piggyback mechanism.
224
+ //---------------------------------------------------------------------------
163
225
close ( ) {
164
226
this . checkConn ( ) ;
165
227
if ( this . _isTempLob ) {
@@ -169,6 +231,11 @@ class ThinLobImpl extends LobImpl {
169
231
}
170
232
}
171
233
234
+ //---------------------------------------------------------------------------
235
+ // init()
236
+ //
237
+ // Internal method to initialize LOBs.
238
+ //---------------------------------------------------------------------------
172
239
init ( conn , locator , dbType , len , chunkSize ) {
173
240
this . dirtyLength = false ;
174
241
this . conn = conn ;
0 commit comments