Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
53acd156
Commit
53acd156
authored
Jan 04, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed some NdbConnection to NdbTransaction
parent
abb926c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
34 deletions
+33
-34
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+5
-6
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+28
-28
No files found.
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
View file @
53acd156
...
...
@@ -30,7 +30,6 @@
*
* Ndb
* init()
* getDictionary()
* startTransaction()
* closeTransaction()
* sendPollNdb()
...
...
@@ -97,10 +96,10 @@ typedef struct {
}
async_callback_t
;
/**
* Structure used in "free list" to a Ndb
Conne
ction
* Structure used in "free list" to a Ndb
Transa
ction
*/
typedef
struct
{
Ndb
Conne
ction
*
conn
;
Ndb
Transa
ction
*
conn
;
int
used
;
}
transaction_t
;
...
...
@@ -123,7 +122,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData);
/**
* Error handler.
*/
bool
asynchErrorHandler
(
Ndb
Conne
ction
*
trans
,
Ndb
*
ndb
);
bool
asynchErrorHandler
(
Ndb
Transa
ction
*
trans
,
Ndb
*
ndb
);
/**
* Exit function
...
...
@@ -162,7 +161,7 @@ closeTransaction(Ndb * ndb , async_callback_t * cb)
* Callback executed when transaction has return from NDB
*/
static
void
callback
(
int
result
,
Ndb
Conne
ction
*
trans
,
void
*
aObject
)
callback
(
int
result
,
Ndb
Transa
ction
*
trans
,
void
*
aObject
)
{
async_callback_t
*
cbData
=
(
async_callback_t
*
)
aObject
;
if
(
result
<
0
)
...
...
@@ -232,7 +231,7 @@ void asynchExitHandler(Ndb * m_ndb)
/* returns true if is recoverable (temporary),
* false if it is an error that is permanent.
*/
bool
asynchErrorHandler
(
Ndb
Conne
ction
*
trans
,
Ndb
*
ndb
)
bool
asynchErrorHandler
(
Ndb
Transa
ction
*
trans
,
Ndb
*
ndb
)
{
NdbError
error
=
trans
->
getNdbError
();
switch
(
error
.
status
)
...
...
sql/ha_ndbcluster.cc
View file @
53acd156
...
...
@@ -154,7 +154,7 @@ static int ndb_to_mysql_error(const NdbError *err)
inline
int
execute_no_commit
(
ha_ndbcluster
*
h
,
Ndb
Conne
ction
*
trans
)
int
execute_no_commit
(
ha_ndbcluster
*
h
,
Ndb
Transa
ction
*
trans
)
{
int
m_batch_execute
=
0
;
#ifdef NOT_USED
...
...
@@ -165,7 +165,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
}
inline
int
execute_commit
(
ha_ndbcluster
*
h
,
Ndb
Conne
ction
*
trans
)
int
execute_commit
(
ha_ndbcluster
*
h
,
Ndb
Transa
ction
*
trans
)
{
int
m_batch_execute
=
0
;
#ifdef NOT_USED
...
...
@@ -176,7 +176,7 @@ int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
}
inline
int
execute_commit
(
THD
*
thd
,
Ndb
Conne
ction
*
trans
)
int
execute_commit
(
THD
*
thd
,
Ndb
Transa
ction
*
trans
)
{
int
m_batch_execute
=
0
;
#ifdef NOT_USED
...
...
@@ -187,7 +187,7 @@ int execute_commit(THD *thd, NdbConnection *trans)
}
inline
int
execute_no_commit_ie
(
ha_ndbcluster
*
h
,
Ndb
Conne
ction
*
trans
)
int
execute_no_commit_ie
(
ha_ndbcluster
*
h
,
Ndb
Transa
ction
*
trans
)
{
int
m_batch_execute
=
0
;
#ifdef NOT_USED
...
...
@@ -330,7 +330,7 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
*/
int
ha_ndbcluster
::
ndb_err
(
Ndb
Conne
ction
*
trans
)
int
ha_ndbcluster
::
ndb_err
(
Ndb
Transa
ction
*
trans
)
{
int
res
;
const
NdbError
err
=
trans
->
getNdbError
();
...
...
@@ -1091,7 +1091,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
DBUG_PRINT
(
"enter"
,
(
"key_len: %u"
,
key_len
));
DBUG_DUMP
(
"key"
,
(
char
*
)
key
,
key_len
);
uint
no_fields
=
table
->
fields
,
i
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
THD
*
thd
=
current_thd
;
...
...
@@ -1141,7 +1141,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
int
ha_ndbcluster
::
complemented_pk_read
(
const
byte
*
old_data
,
byte
*
new_data
)
{
uint
no_fields
=
table
->
fields
,
i
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"complemented_pk_read"
);
...
...
@@ -1204,7 +1204,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
int
ha_ndbcluster
::
peek_row
()
{
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"peek_row"
);
...
...
@@ -1235,7 +1235,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
uint
key_len
,
byte
*
buf
)
{
int
res
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbIndexOperation
*
op
;
DBUG_ENTER
(
"ha_ndbcluster::unique_index_read"
);
DBUG_PRINT
(
"enter"
,
(
"key_len: %u, index: %u"
,
key_len
,
active_index
));
...
...
@@ -1271,7 +1271,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
{
DBUG_ENTER
(
"fetch_next"
);
int
check
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
bool
contact_ndb
=
m_lock
.
type
<
TL_WRITE_ALLOW_WRITE
;
do
{
...
...
@@ -1551,7 +1551,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
{
uint
i
;
THD
*
thd
=
current_thd
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
DBUG_ENTER
(
"define_read_attrs"
);
...
...
@@ -1598,7 +1598,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
{
int
res
;
bool
restart
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbIndexScanOperation
*
op
;
DBUG_ENTER
(
"ha_ndbcluster::ordered_index_scan"
);
...
...
@@ -1668,7 +1668,7 @@ int ha_ndbcluster::filtered_scan(const byte *key, uint key_len,
enum
ha_rkey_function
find_flag
)
{
int
res
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbScanOperation
*
op
;
DBUG_ENTER
(
"filtered_scan"
);
...
...
@@ -1748,7 +1748,7 @@ int ha_ndbcluster::full_table_scan(byte *buf)
uint
i
;
int
res
;
NdbScanOperation
*
op
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
DBUG_ENTER
(
"full_table_scan"
);
DBUG_PRINT
(
"enter"
,
(
"Starting new scan on %s"
,
m_tabname
));
...
...
@@ -1776,7 +1776,7 @@ int ha_ndbcluster::write_row(byte *record)
{
bool
has_auto_increment
;
uint
i
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbOperation
*
op
;
int
res
;
THD
*
thd
=
current_thd
;
...
...
@@ -1945,7 +1945,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
int
ha_ndbcluster
::
update_row
(
const
byte
*
old_data
,
byte
*
new_data
)
{
THD
*
thd
=
current_thd
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbScanOperation
*
cursor
=
m_active_cursor
;
NdbOperation
*
op
;
uint
i
;
...
...
@@ -2063,7 +2063,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
int
ha_ndbcluster
::
delete_row
(
const
byte
*
record
)
{
THD
*
thd
=
current_thd
;
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
NdbScanOperation
*
cursor
=
m_active_cursor
;
NdbOperation
*
op
;
DBUG_ENTER
(
"delete_row"
);
...
...
@@ -2635,7 +2635,7 @@ int ha_ndbcluster::rnd_init(bool scan)
int
ha_ndbcluster
::
close_scan
()
{
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
DBUG_ENTER
(
"close_scan"
);
m_multi_cursor
=
0
;
...
...
@@ -2983,7 +2983,7 @@ int ha_ndbcluster::end_bulk_insert()
// Check if last inserts need to be flushed
if
(
m_bulk_insert_not_flushed
)
{
Ndb
Conne
ction
*
trans
=
m_active_trans
;
Ndb
Transa
ction
*
trans
=
m_active_trans
;
// Send rows to NDB
DBUG_PRINT
(
"info"
,
(
"Sending inserts to NDB, "
\
"rows_inserted:%d, bulk_insert_rows: %d"
,
...
...
@@ -3102,7 +3102,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
int
ha_ndbcluster
::
external_lock
(
THD
*
thd
,
int
lock_type
)
{
int
error
=
0
;
Ndb
Conne
ction
*
trans
=
NULL
;
Ndb
Transa
ction
*
trans
=
NULL
;
DBUG_ENTER
(
"external_lock"
);
/*
...
...
@@ -3189,8 +3189,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
// m_use_local_query_cache= thd->variables.ndb_use_local_query_cache;
m_active_trans
=
thd
->
transaction
.
all
.
ndb_tid
?
(
Ndb
Conne
ction
*
)
thd
->
transaction
.
all
.
ndb_tid
:
(
Ndb
Conne
ction
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
(
Ndb
Transa
ction
*
)
thd
->
transaction
.
all
.
ndb_tid
:
(
Ndb
Transa
ction
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
DBUG_ASSERT
(
m_active_trans
);
// Start of transaction
m_retrieve_all_fields
=
FALSE
;
...
...
@@ -3272,13 +3272,13 @@ int ha_ndbcluster::start_stmt(THD *thd)
DBUG_ENTER
(
"start_stmt"
);
PRINT_OPTION_FLAGS
(
thd
);
Ndb
Connection
*
trans
=
(
NdbConne
ction
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
Ndb
Transaction
*
trans
=
(
NdbTransa
ction
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
if
(
!
trans
){
Ndb
*
ndb
=
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
;
DBUG_PRINT
(
"trans"
,(
"Starting transaction stmt"
));
Ndb
Conne
ction
*
tablock_trans
=
(
Ndb
Conne
ction
*
)
thd
->
transaction
.
all
.
ndb_tid
;
Ndb
Transa
ction
*
tablock_trans
=
(
Ndb
Transa
ction
*
)
thd
->
transaction
.
all
.
ndb_tid
;
DBUG_PRINT
(
"info"
,
(
"tablock_trans: %x"
,
(
uint
)
tablock_trans
));
DBUG_ASSERT
(
tablock_trans
);
// trans= ndb->hupp(tablock_trans);
...
...
@@ -3307,7 +3307,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
{
int
res
=
0
;
Ndb
*
ndb
=
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
;
Ndb
Connection
*
trans
=
(
NdbConne
ction
*
)
ndb_transaction
;
Ndb
Transaction
*
trans
=
(
NdbTransa
ction
*
)
ndb_transaction
;
DBUG_ENTER
(
"ndbcluster_commit"
);
DBUG_PRINT
(
"transaction"
,(
"%s"
,
...
...
@@ -3337,7 +3337,7 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction)
{
int
res
=
0
;
Ndb
*
ndb
=
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
;
Ndb
Connection
*
trans
=
(
NdbConne
ction
*
)
ndb_transaction
;
Ndb
Transaction
*
trans
=
(
NdbTransa
ction
*
)
ndb_transaction
;
DBUG_ENTER
(
"ndbcluster_rollback"
);
DBUG_PRINT
(
"transaction"
,(
"%s"
,
...
...
@@ -4842,7 +4842,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
{
DBUG_ENTER
(
"ndb_get_table_statistics"
);
DBUG_PRINT
(
"enter"
,
(
"table: %s"
,
table
));
Ndb
Conne
ction
*
pTrans
=
ndb
->
startTransaction
();
Ndb
Transa
ction
*
pTrans
=
ndb
->
startTransaction
();
do
{
if
(
pTrans
==
NULL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment