| Qore BulkSqlUtil Module Reference 1.3.1

Loading...
Searching...
No Matches
AbstractBulkOperation.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* AbstractBulkOperation.qc Copyright 2015 - 2024 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
26 namespace BulkSqlUtil {
28
77 class AbstractBulkOperation {
78
79 public:
81 const OptionKeys = ...;
82
83
85 const OptionDefaults = ...;
86
87
88 protected:
90 SqlUtil::AbstractTable table;
91
93 softint block_size;
94
96 hash hbuf;
97
99 hash cval;
100
102 list cval_keys;
103
105 *code info_log;
106
108 int row_count = 0;
109
111 string opname;
112
114 list ret_args = ();
115
116 public:
117
119
126 constructor(string name, SqlUtil::Table target, *hash opts);
127
128
130
137 constructor(string name, SqlUtil::AbstractTable target, *hash opts);
138
139
141
144 destructor();
145
146
148
190 queueData(hash data);
191
192
194
228 queueData(list<auto> l);
229
230
232
236 int size();
237
238
240 protected:
241 init(*hash<auto> opts);
242 public:
243
244
246 protected:
247 setupInitialRowColumns(hash<auto> row);
248 public:
249
250
252 protected:
253 setupInitialRow(hash<auto> row);
254 public:
255
256
258
290 flush();
291
292
294 protected:
295 flushIntern();
296 public:
297
298
300
332 discard();
333
334
336 nothing commit();
337
338
340 nothing rollback();
341
342
344 string getTableName();
345
346
348 SqlUtil::AbstractTable getTable();
349
350
352 Qore::SQL::AbstractDatasource getDatasource();
353
354
356 int getRowCount();
357
358
360 protected:
361 abstract flushImpl();
362 public:
363 };
364};
BulkSqlUtil::AbstractBulkOperation
base class for bulk DML operations
Definition AbstractBulkOperation.qc.dox.h:77
BulkSqlUtil::AbstractBulkOperation::getDatasource
Qore::SQL::AbstractDatasource getDatasource()
returns the AbstractDatasource object associated with this object
BulkSqlUtil::AbstractBulkOperation::row_count
int row_count
row count
Definition AbstractBulkOperation.qc.dox.h:108
BulkSqlUtil::AbstractBulkOperation::flushIntern
flushIntern()
flushes queued data to the database
BulkSqlUtil::AbstractBulkOperation::size
int size()
returns the current size of the cache as a number of rows
BulkSqlUtil::AbstractBulkOperation::block_size
softint block_size
bulk operation block size
Definition AbstractBulkOperation.qc.dox.h:93
BulkSqlUtil::AbstractBulkOperation::setupInitialRowColumns
setupInitialRowColumns(hash< auto > row)
sets up the block buffer given the initial template hash of lists for inserting
BulkSqlUtil::AbstractBulkOperation::constructor
constructor(string name, SqlUtil::AbstractTable target, *hash opts)
creates the object from the supplied arguments
BulkSqlUtil::AbstractBulkOperation::cval_keys
list cval_keys
"constant" row value keys
Definition AbstractBulkOperation.qc.dox.h:102
BulkSqlUtil::AbstractBulkOperation::queueData
queueData(hash data)
queues row data in the block buffer; the block buffer is flushed to the DB if the buffer size reaches...
BulkSqlUtil::AbstractBulkOperation::init
init(*hash< auto > opts)
common constructor initialization
BulkSqlUtil::AbstractBulkOperation::queueData
queueData(list< auto > l)
queues row data in the block buffer; the block buffer is flushed to the DB if the buffer size reaches...
BulkSqlUtil::AbstractBulkOperation::OptionDefaults
const OptionDefaults
default option values
Definition AbstractBulkOperation.qc.dox.h:85
BulkSqlUtil::AbstractBulkOperation::ret_args
list ret_args
list of "returning" columns
Definition AbstractBulkOperation.qc.dox.h:114
BulkSqlUtil::AbstractBulkOperation::destructor
destructor()
throws an exception if there is data pending in the internal row data cache; make sure to call flush(...
BulkSqlUtil::AbstractBulkOperation::flush
flush()
flushes any remaining batched data to the database; this method should always be called before commit...
BulkSqlUtil::AbstractBulkOperation::table
SqlUtil::AbstractTable table
the target table object
Definition AbstractBulkOperation.qc.dox.h:90
BulkSqlUtil::AbstractBulkOperation::cval
hash cval
"constant" row values; must be equal in all calls to queueData
Definition AbstractBulkOperation.qc.dox.h:99
BulkSqlUtil::AbstractBulkOperation::OptionKeys
const OptionKeys
option keys for this object
Definition AbstractBulkOperation.qc.dox.h:81
BulkSqlUtil::AbstractBulkOperation::getTableName
string getTableName()
returns the table name
BulkSqlUtil::AbstractBulkOperation::setupInitialRow
setupInitialRow(hash< auto > row)
sets up the block buffer given the initial template row for inserting
BulkSqlUtil::AbstractBulkOperation::info_log
*code info_log
an optional info logging callback; must accept a sprintf()-style format specifier and optional argume...
Definition AbstractBulkOperation.qc.dox.h:105
BulkSqlUtil::AbstractBulkOperation::commit
nothing commit()
flushes any queued data and commits the transaction
BulkSqlUtil::AbstractBulkOperation::constructor
constructor(string name, SqlUtil::Table target, *hash opts)
creates the object from the supplied arguments
BulkSqlUtil::AbstractBulkOperation::hbuf
hash hbuf
buffer for bulk operations
Definition AbstractBulkOperation.qc.dox.h:96
BulkSqlUtil::AbstractBulkOperation::getTable
SqlUtil::AbstractTable getTable()
returns the underlying SqlUtil::AbstractTable object
BulkSqlUtil::AbstractBulkOperation::getRowCount
int getRowCount()
returns the affected row count
BulkSqlUtil::AbstractBulkOperation::rollback
nothing rollback()
discards any queued data and rolls back the transaction
BulkSqlUtil::AbstractBulkOperation::flushImpl
abstract flushImpl()
flushes queued data to the database
BulkSqlUtil::AbstractBulkOperation::opname
string opname
operation name
Definition AbstractBulkOperation.qc.dox.h:111
BulkSqlUtil::AbstractBulkOperation::discard
discard()
discards any buffered batched data; this method should be called before destroying the object if an e...
Qore::SQL::AbstractDatasource
BulkSqlUtil
Qore AbstractBulkOperation class definition.
Definition AbstractBulkOperation.qc.dox.h:26