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
c0f99659
Commit
c0f99659
authored
Jan 03, 2005
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
parents
881b3a02
c14ebf52
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
377 additions
and
306 deletions
+377
-306
ndb/examples/Makefile
ndb/examples/Makefile
+2
-3
ndb/examples/ndbapi_example1/Makefile
ndb/examples/ndbapi_example1/Makefile
+10
-8
ndb/examples/ndbapi_example1/ndbapi_example1.cpp
ndb/examples/ndbapi_example1/ndbapi_example1.cpp
+173
-140
ndb/examples/ndbapi_example2/Makefile
ndb/examples/ndbapi_example2/Makefile
+2
-2
ndb/examples/ndbapi_example2/ndbapi_example2.cpp
ndb/examples/ndbapi_example2/ndbapi_example2.cpp
+32
-18
ndb/examples/ndbapi_example3/Makefile
ndb/examples/ndbapi_example3/Makefile
+2
-2
ndb/examples/ndbapi_example3/ndbapi_example3.cpp
ndb/examples/ndbapi_example3/ndbapi_example3.cpp
+43
-35
ndb/examples/ndbapi_example4/Makefile
ndb/examples/ndbapi_example4/Makefile
+2
-2
ndb/examples/ndbapi_example4/ndbapi_example4.cpp
ndb/examples/ndbapi_example4/ndbapi_example4.cpp
+58
-50
ndb/examples/ndbapi_example5/Makefile
ndb/examples/ndbapi_example5/Makefile
+2
-2
ndb/examples/ndbapi_example5/ndbapi_example5.cpp
ndb/examples/ndbapi_example5/ndbapi_example5.cpp
+38
-33
ndb/examples/ndbapi_scan_example/Makefile
ndb/examples/ndbapi_scan_example/Makefile
+2
-2
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+7
-5
ndb/include/ndbapi/Ndb.hpp
ndb/include/ndbapi/Ndb.hpp
+3
-2
ndb/include/ndbapi/NdbRecAttr.hpp
ndb/include/ndbapi/NdbRecAttr.hpp
+1
-2
No files found.
ndb/examples/Makefile
View file @
c0f99659
# XXX ndbapi_example4, select_all commented out until fixed
BIN_DIRS
:=
ndbapi_example1 ndbapi_example3 ndbapi_example4
\
BIN_DIRS
:=
ndbapi_example1 ndbapi_example2 ndbapi_example3
$(ndbapi_example4)
\
ndbapi_example5 ndbapi_scan_example
ndbapi_example5
$(select_all)
ndbapi_scan_example
bins
:
$(patsubst %
,
_bins_%
,
$(BIN_DIRS))
bins
:
$(patsubst %
,
_bins_%
,
$(BIN_DIRS))
...
...
ndb/examples/ndbapi_example1/Makefile
View file @
c0f99659
TARGET
=
ndbapi_example1
TARGET
=
ndbapi_example1
SRCS
=
ndbapi_example1
.cpp
SRCS
=
$(TARGET)
.cpp
OBJS
=
ndbapi_example1
.o
OBJS
=
$(TARGET)
.o
CXX
=
g++
CXX
=
g++
CFLAGS
=
-c
-Wall
-fno-rtti
-fno-exceptions
CFLAGS
=
-c
-Wall
-fno-rtti
-fno-exceptions
CXXFLAGS
=
DEBUG
=
DEBUG
=
LFLAGS
=
-Wall
LFLAGS
=
-Wall
INCLUDE_DIR
=
../../include
TOP_SRCDIR
=
../../..
LIB_DIR
=
-L
../../src/.libs
\
INCLUDE_DIR
=
$(TOP_SRCDIR)
-L
../../../libmysql_r/.libs
\
LIB_DIR
=
-L
$(TOP_SRCDIR)
/ndb/src/.libs
\
-L
../../../mysys
-L
$(TOP_SRCDIR)
/libmysql_r/.libs
\
-L
$(TOP_SRCDIR)
/mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(
CXXFLAGS)
$(
LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
/include
-I
$(INCLUDE_DIR)
/ndb/include
-I
$(INCLUDE_DIR)
/ndb/include
/ndbapi
$(SRCS)
clean
:
clean
:
rm
-f
*
.o
$(TARGET)
rm
-f
*
.o
$(TARGET)
ndb/examples/ndbapi_example1/ndbapi_example1.cpp
View file @
c0f99659
...
@@ -14,209 +14,242 @@
...
@@ -14,209 +14,242 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
//
/*
// ndbapi_example1.cpp: Using synchronous transactions in NDB API
* ndbapi_example1.cpp: Using synchronous transactions in NDB API
//
*
// Correct output from this program is:
* Correct output from this program is:
//
*
// ATTR1 ATTR2
* ATTR1 ATTR2
// 0 10
* 0 10
// 1 1
* 1 1
// 2 12
* 2 12
// Detected that deleted tuple doesn't exist!
* Detected that deleted tuple doesn't exist!
// 4 14
* 4 14
// 5 5
* 5 5
// 6 16
* 6 16
// 7 7
* 7 7
// 8 18
* 8 18
// 9 9
* 9 9
*
*/
#include <mysql.h>
#include <NdbApi.hpp>
#include <NdbApi.hpp>
// Used for cout
// Used for cout
#include <stdio.h>
#include <stdio.h>
#include <iostream>
#include <iostream>
#define APIERROR(error) \
static
void
run_application
(
MYSQL
&
,
Ndb_cluster_connection
&
);
{ std::cout << "Error in " << __FILE__ << ", line:" << __LINE__ << ", code:" \
<< error.code << ", msg: " << error.message << "." << std::endl; \
#define PRINT_ERROR(code,msg) \
exit(-1); }
std::cout << "Error in " << __FILE__ << ", line: " << __LINE__ \
<< ", code: " << code \
<< ", msg: " << msg << "." << std::endl
#define MYSQLERROR(mysql) { \
PRINT_ERROR(mysql_errno(&mysql),mysql_error(&mysql)); \
exit(-1); }
#define APIERROR(error) { \
PRINT_ERROR(error.code,error.message); \
exit(-1); }
int
main
()
int
main
()
{
{
// ndb_init must be called first
ndb_init
();
ndb_init
();
Ndb_cluster_connection
*
cluster_connection
=
// connect to mysql server and cluster and run application
new
Ndb_cluster_connection
();
// Object representing the cluster
int
r
=
cluster_connection
->
connect
(
5
/* retries */
,
3
/* delay between retries */
,
1
/* verbose */
);
if
(
r
>
0
)
{
std
::
cout
<<
"Cluster connect failed, possibly resolved with more retries.
\n
"
;
exit
(
-
1
);
}
else
if
(
r
<
0
)
{
{
std
::
cout
// Object representing the cluster
<<
"Cluster connect failed.
\n
"
;
Ndb_cluster_connection
cluster_connection
;
exit
(
-
1
);
}
// Connect to cluster management server (ndb_mgmd)
if
(
cluster_connection
.
connect
(
4
/* retries */
,
5
/* delay between retries */
,
1
/* verbose */
))
{
std
::
cout
<<
"Cluster management server was not ready within 30 secs.
\n
"
;
exit
(
-
1
);
}
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
// Optionally connect and wait for the storage nodes (ndbd's)
{
if
(
cluster_connection
.
wait_until_ready
(
30
,
30
))
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
{
exit
(
-
1
);
std
::
cout
<<
"Cluster was not ready within 30 secs.
\n
"
;
exit
(
-
1
);
}
// connect to mysql server
MYSQL
mysql
;
if
(
!
mysql_init
(
&
mysql
)
)
{
std
::
cout
<<
"mysql_init failed
\n
"
;
exit
(
-
1
);
}
if
(
!
mysql_real_connect
(
&
mysql
,
"localhost"
,
"root"
,
""
,
""
,
3306
,
"/tmp/mysql.sock"
,
0
)
)
MYSQLERROR
(
mysql
);
// run the application code
run_application
(
mysql
,
cluster_connection
);
}
}
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
// ndb_end should not be called until all "Ndb" objects are deleted
"TEST_DB_1"
);
// Object representing the database
ndb_end
(
0
);
NdbDictionary
::
Table
myTable
;
NdbDictionary
::
Column
myColumn
;
NdbConnection
*
myConnection
;
// For other transactions
std
::
cout
<<
"
\n
To drop created table use:
\n
"
NdbOperation
*
myOperation
;
// For other operations
<<
"echo
\"
drop table MYTABLENAME
\"
| mysql TEST_DB_1 -u root
\n
"
;
NdbRecAttr
*
myRecAttr
;
// Result of reading attribute value
return
0
;
}
static
void
create_table
(
MYSQL
&
);
static
void
do_insert
(
Ndb
&
);
static
void
do_update
(
Ndb
&
);
static
void
do_delete
(
Ndb
&
);
static
void
do_read
(
Ndb
&
);
static
void
run_application
(
MYSQL
&
mysql
,
Ndb_cluster_connection
&
cluster_connection
)
{
/********************************************
/********************************************
*
Initialize NDB and wait until it's ready
*
*
Connect to database via mysql-c
*
********************************************/
********************************************/
if
(
myNdb
->
init
())
{
mysql_query
(
&
mysql
,
"CREATE DATABASE TEST_DB_1"
);
APIERROR
(
myNdb
->
getNdbError
());
if
(
mysql_query
(
&
mysql
,
"USE TEST_DB_1"
)
!=
0
)
MYSQLERROR
(
mysql
);
exit
(
-
1
);
create_table
(
mysql
);
}
NdbDictionary
::
Dictionary
*
myDict
=
myNdb
->
getDictionary
();
/********************************************
* Connect to database via NdbApi *
/*********************************************************
********************************************/
* Create a table named MYTABLENAME if it does not exist *
// Object representing the database
*********************************************************/
Ndb
myNdb
(
&
cluster_connection
,
"TEST_DB_1"
);
if
(
myDict
->
getTable
(
"MYTABLENAME"
)
!=
NULL
)
{
if
(
myNdb
.
init
())
APIERROR
(
myNdb
.
getNdbError
());
std
::
cout
<<
"NDB already has example table: MYTABLENAME."
<<
std
::
endl
;
exit
(
-
1
);
/*
}
* Do different operations on database
*/
myTable
.
setName
(
"MYTABLENAME"
);
do_insert
(
myNdb
);
do_update
(
myNdb
);
myColumn
.
setName
(
"ATTR1"
);
do_delete
(
myNdb
);
myColumn
.
setType
(
NdbDictionary
::
Column
::
Unsigned
);
do_read
(
myNdb
);
myColumn
.
setLength
(
1
);
}
myColumn
.
setPrimaryKey
(
true
);
myColumn
.
setNullable
(
false
);
/*********************************************************
myTable
.
addColumn
(
myColumn
);
* Create a table named MYTABLENAME if it does not exist *
*********************************************************/
myColumn
.
setName
(
"ATTR2"
);
static
void
create_table
(
MYSQL
&
mysql
)
myColumn
.
setType
(
NdbDictionary
::
Column
::
Unsigned
);
{
myColumn
.
setLength
(
1
);
if
(
mysql_query
(
&
mysql
,
myColumn
.
setPrimaryKey
(
false
);
"CREATE TABLE"
myColumn
.
setNullable
(
false
);
" MYTABLENAME"
myTable
.
addColumn
(
myColumn
);
" (ATTR1 INT UNSIGNED PRIMARY KEY,"
" ATTR2 INT UNSIGNED)"
if
(
myDict
->
createTable
(
myTable
)
==
-
1
)
" ENGINE=NDB"
))
APIERROR
(
myDict
->
getNdbError
());
MYSQLERROR
(
mysql
);
}
/**************************************************************************
* Using 5 transactions, insert 10 tuples in table: (0,0),(1,1),...,(9,9) *
/**************************************************************************
**************************************************************************/
* Using 5 transactions, insert 10 tuples in table: (0,0),(1,1),...,(9,9) *
**************************************************************************/
static
void
do_insert
(
Ndb
&
myNdb
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
myConnection
=
myNdb
->
startTransaction
();
NdbTransaction
*
myTransaction
=
myNdb
.
startTransaction
();
if
(
my
Connection
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transaction
==
NULL
)
APIERROR
(
myNdb
.
getNdbError
());
myOperation
=
myConnection
->
getNdbOperation
(
"MYTABLENAME"
);
NdbOperation
*
myOperation
=
myTransaction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
insertTuple
();
myOperation
->
insertTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
);
myOperation
=
myConnection
->
getNdbOperation
(
"MYTABLENAME"
);
myOperation
=
myTransaction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
insertTuple
();
myOperation
->
insertTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myNdb
->
closeTransaction
(
myConne
ction
);
myNdb
.
closeTransaction
(
myTransa
ction
);
}
}
}
/*****************************************************************
* Update the second attribute in half of the tuples (adding 10) *
/*****************************************************************
*****************************************************************/
* Update the second attribute in half of the tuples (adding 10) *
*****************************************************************/
static
void
do_update
(
Ndb
&
myNdb
)
{
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
myConnection
=
myNdb
->
startTransaction
();
NdbTransaction
*
myTransaction
=
myNdb
.
startTransaction
();
if
(
my
Connection
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transaction
==
NULL
)
APIERROR
(
myNdb
.
getNdbError
());
myOperation
=
myConnection
->
getNdbOperation
(
"MYTABLENAME"
);
NdbOperation
*
myOperation
=
myTransaction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
updateTuple
();
myOperation
->
updateTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myNdb
->
closeTransaction
(
myConne
ction
);
myNdb
.
closeTransaction
(
myTransa
ction
);
}
}
}
/*************************************************
/*************************************************
* Delete one tuple (the one with primary key 3) *
* Delete one tuple (the one with primary key 3) *
*************************************************/
*************************************************/
myConnection
=
myNdb
->
startTransaction
();
static
void
do_delete
(
Ndb
&
myNdb
)
if
(
myConnection
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
{
NdbTransaction
*
myTransaction
=
myNdb
.
startTransaction
();
if
(
myTransaction
==
NULL
)
APIERROR
(
myNdb
.
getNdbError
());
myOperation
=
myConnection
->
getNdbOperation
(
"MYTABLENAME"
);
NdbOperation
*
myOperation
=
myTransaction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
if
(
myOperation
==
NULL
)
APIERROR
(
myTransaction
->
getNdbError
());
APIERROR
(
myConnection
->
getNdbError
());
myOperation
->
deleteTuple
();
myOperation
->
deleteTuple
();
myOperation
->
equal
(
"ATTR1"
,
3
);
myOperation
->
equal
(
"ATTR1"
,
3
);
if
(
myConnection
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
myConnection
->
getNdbError
());
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
->
closeTransaction
(
myConnection
);
/*****************************
myNdb
.
closeTransaction
(
myTransaction
);
* Read and print all tuples *
}
*****************************/
/*****************************
* Read and print all tuples *
*****************************/
static
void
do_read
(
Ndb
&
myNdb
)
{
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
myConnection
=
myNdb
->
startTransaction
();
NdbTransaction
*
myTransaction
=
myNdb
.
startTransaction
();
if
(
my
Connection
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transaction
==
NULL
)
APIERROR
(
myNdb
.
getNdbError
());
myOperation
=
myConnection
->
getNdbOperation
(
"MYTABLENAME"
);
NdbOperation
*
myOperation
=
myTransaction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
readTuple
();
myOperation
->
readTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
equal
(
"ATTR1"
,
i
);
NdbRecAttr
*
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
myTransaction
->
getNdbError
());
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myRecAttr
==
NULL
)
APIERROR
(
myConnection
->
getNdbError
());
if
(
myConnection
->
execute
(
Commit
)
==
-
1
)
if
(
i
==
3
)
{
if
(
i
==
3
)
{
std
::
cout
<<
"Detected that deleted tuple doesn't exist!"
<<
std
::
endl
;
std
::
cout
<<
"Detected that deleted tuple doesn't exist!"
<<
std
::
endl
;
}
else
{
}
else
{
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
}
}
if
(
i
!=
3
)
{
if
(
i
!=
3
)
{
printf
(
" %2d %2d
\n
"
,
i
,
myRecAttr
->
u_32_value
());
printf
(
" %2d %2d
\n
"
,
i
,
myRecAttr
->
u_32_value
());
}
}
myNdb
->
closeTransaction
(
myConne
ction
);
myNdb
.
closeTransaction
(
myTransa
ction
);
}
}
delete
myNdb
;
delete
cluster_connection
;
ndb_end
(
0
);
return
0
;
}
}
ndb/examples/ndbapi_example2/Makefile
View file @
c0f99659
...
@@ -7,12 +7,12 @@ DEBUG =
...
@@ -7,12 +7,12 @@ DEBUG =
LFLAGS
=
-Wall
LFLAGS
=
-Wall
INCLUDE_DIR
=
../../include
INCLUDE_DIR
=
../../include
LIB_DIR
=
-L
../../src/.libs
\
LIB_DIR
=
-L
../../src/.libs
\
-L
../../../libmysql/.libs
\
-L
../../../libmysql
_r
/.libs
\
-L
../../../mysys
-L
../../../mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
-lmysys
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
...
...
ndb/examples/ndbapi_example2/ndbapi_example2.cpp
View file @
c0f99659
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<< error.code << ", msg: " << error.message << "." << std::endl; \
<< error.code << ", msg: " << error.message << "." << std::endl; \
exit(-1); }
exit(-1); }
static
void
callback
(
int
result
,
Ndb
Conne
ction
*
NdbObject
,
void
*
aObject
);
static
void
callback
(
int
result
,
Ndb
Transa
ction
*
NdbObject
,
void
*
aObject
);
int
main
()
int
main
()
{
{
...
@@ -50,42 +50,56 @@ int main()
...
@@ -50,42 +50,56 @@ int main()
exit
(
-
1
);
exit
(
-
1
);
}
}
int
r
=
cluster_connection
->
connect
(
5
/* retries */
,
3
/* delay between retries */
,
1
/* verbose */
);
if
(
r
>
0
)
{
std
::
cout
<<
"Cluster connect failed, possibly resolved with more retries.
\n
"
;
exit
(
-
1
);
}
else
if
(
r
<
0
)
{
std
::
cout
<<
"Cluster connect failed.
\n
"
;
exit
(
-
1
);
}
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
{
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
exit
(
-
1
);
}
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
"TEST_DB_2"
);
// Object representing the database
"TEST_DB_2"
);
// Object representing the database
Ndb
Connection
*
myNdbConne
ction
[
2
];
// For transactions
Ndb
Transaction
*
myNdbTransa
ction
[
2
];
// For transactions
NdbOperation
*
myNdbOperation
;
// For operations
NdbOperation
*
myNdbOperation
;
// For operations
/*******************************************
* Initialize NDB and wait until its ready *
*******************************************/
if
(
myNdb
->
init
(
2
)
==
-
1
)
{
// Want two parallel insert transactions
if
(
myNdb
->
init
(
2
)
==
-
1
)
{
// Want two parallel insert transactions
APIERROR
(
myNdb
->
getNdbError
());
APIERROR
(
myNdb
->
getNdbError
());
exit
(
-
1
);
exit
(
-
1
);
}
}
if
(
myNdb
->
waitUntilReady
(
30
)
!=
0
)
{
std
::
cout
<<
"NDB was not ready within 30 secs."
<<
std
::
endl
;
exit
(
-
1
);
}
/******************************************************
/******************************************************
* Insert (we do two insert transactions in parallel) *
* Insert (we do two insert transactions in parallel) *
******************************************************/
******************************************************/
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
myNdb
Conne
ction
[
i
]
=
myNdb
->
startTransaction
();
myNdb
Transa
ction
[
i
]
=
myNdb
->
startTransaction
();
if
(
myNdb
Conne
ction
[
i
]
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
myNdb
Transa
ction
[
i
]
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myNdbOperation
=
myNdb
Conne
ction
[
i
]
->
getNdbOperation
(
"MYTABLENAME"
);
myNdbOperation
=
myNdb
Transa
ction
[
i
]
->
getNdbOperation
(
"MYTABLENAME"
);
// Error check. If error, then maybe table MYTABLENAME is not in database
// Error check. If error, then maybe table MYTABLENAME is not in database
if
(
myNdbOperation
==
NULL
)
APIERROR
(
myNdb
Conne
ction
[
i
]
->
getNdbError
());
if
(
myNdbOperation
==
NULL
)
APIERROR
(
myNdb
Transa
ction
[
i
]
->
getNdbError
());
myNdbOperation
->
insertTuple
();
myNdbOperation
->
insertTuple
();
myNdbOperation
->
equal
(
"ATTR1"
,
20
+
i
);
myNdbOperation
->
equal
(
"ATTR1"
,
20
+
i
);
myNdbOperation
->
setValue
(
"ATTR2"
,
20
+
i
);
myNdbOperation
->
setValue
(
"ATTR2"
,
20
+
i
);
// Prepare transaction (the transaction is NOT yet sent to NDB)
// Prepare transaction (the transaction is NOT yet sent to NDB)
myNdb
Conne
ction
[
i
]
->
executeAsynchPrepare
(
Commit
,
&
callback
,
NULL
);
myNdb
Transa
ction
[
i
]
->
executeAsynchPrepare
(
Commit
,
&
callback
,
NULL
);
}
}
// Send all transactions to NDB
// Send all transactions to NDB
...
@@ -96,7 +110,7 @@ int main()
...
@@ -96,7 +110,7 @@ int main()
// Close all transactions
// Close all transactions
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
i
=
0
;
i
<
2
;
i
++
)
myNdb
->
closeTransaction
(
myNdb
Conne
ction
[
i
]);
myNdb
->
closeTransaction
(
myNdb
Transa
ction
[
i
]);
delete
myNdb
;
delete
myNdb
;
delete
cluster_connection
;
delete
cluster_connection
;
...
@@ -110,12 +124,12 @@ int main()
...
@@ -110,12 +124,12 @@ int main()
*
*
* (This function must have three arguments:
* (This function must have three arguments:
* - The result of the transaction,
* - The result of the transaction,
* - The Ndb
Conne
ction object, and
* - The Ndb
Transa
ction object, and
* - A pointer to an arbitrary object.)
* - A pointer to an arbitrary object.)
*/
*/
static
void
static
void
callback
(
int
result
,
Ndb
Conne
ction
*
myTrans
,
void
*
aObject
)
callback
(
int
result
,
Ndb
Transa
ction
*
myTrans
,
void
*
aObject
)
{
{
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
std
::
cout
<<
"Poll error: "
<<
std
::
endl
;
std
::
cout
<<
"Poll error: "
<<
std
::
endl
;
...
...
ndb/examples/ndbapi_example3/Makefile
View file @
c0f99659
...
@@ -7,12 +7,12 @@ DEBUG =
...
@@ -7,12 +7,12 @@ DEBUG =
LFLAGS
=
-Wall
LFLAGS
=
-Wall
INCLUDE_DIR
=
../../include
INCLUDE_DIR
=
../../include
LIB_DIR
=
-L
../../src/.libs
\
LIB_DIR
=
-L
../../src/.libs
\
-L
../../../libmysql/.libs
\
-L
../../../libmysql
_r
/.libs
\
-L
../../../mysys
-L
../../../mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
-lmysys
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
...
...
ndb/examples/ndbapi_example3/ndbapi_example3.cpp
View file @
c0f99659
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
//
//
// There are many ways to program using the NDB API. In this example
// There are many ways to program using the NDB API. In this example
// we execute two inserts in the same transaction using
// we execute two inserts in the same transaction using
// NdbConnection::
Ndb
execute(NoCommit).
// NdbConnection::execute(NoCommit).
//
//
// Transaction failing is handled by re-executing the transaction
// Transaction failing is handled by re-executing the transaction
// in case of non-permanent transaction errors.
// in case of non-permanent transaction errors.
...
@@ -52,28 +52,28 @@
...
@@ -52,28 +52,28 @@
}
}
//
//
//
CONERROR prints all error info regarding an NdbConne
ction
//
TRANSERROR prints all error info regarding an NdbTransa
ction
//
//
#define
CONERROR(ndbConne
ction) \
#define
TRANSERROR(ndbTransa
ction) \
{ NdbError error = ndb
Conne
ction->getNdbError(); \
{ NdbError error = ndb
Transa
ction->getNdbError(); \
std::cout << "
CON
ERROR: " << error.code << " " << error.message \
std::cout << "
TRANS
ERROR: " << error.code << " " << error.message \
<< std::endl \
<< std::endl \
<< " " << "Status: " << error.status \
<< " " << "Status: " << error.status \
<< ", Classification: " << error.classification << std::endl \
<< ", Classification: " << error.classification << std::endl \
<< " " << "File: " << __FILE__ \
<< " " << "File: " << __FILE__ \
<< " (Line: " << __LINE__ << ")" << std::endl \
<< " (Line: " << __LINE__ << ")" << std::endl \
; \
; \
printTransactionError(ndb
Conne
ction); \
printTransactionError(ndb
Transa
ction); \
}
}
void
printTransactionError
(
Ndb
Connection
*
ndbConne
ction
)
{
void
printTransactionError
(
Ndb
Transaction
*
ndbTransa
ction
)
{
const
NdbOperation
*
ndbOp
=
NULL
;
const
NdbOperation
*
ndbOp
=
NULL
;
int
i
=
0
;
int
i
=
0
;
/****************************************************************
/****************************************************************
* Print NdbError object of every operations in the transaction *
* Print NdbError object of every operations in the transaction *
****************************************************************/
****************************************************************/
while
((
ndbOp
=
ndb
Conne
ction
->
getNextCompletedOperation
(
ndbOp
))
!=
NULL
)
{
while
((
ndbOp
=
ndb
Transa
ction
->
getNextCompletedOperation
(
ndbOp
))
!=
NULL
)
{
NdbError
error
=
ndbOp
->
getNdbError
();
NdbError
error
=
ndbOp
->
getNdbError
();
std
::
cout
<<
" OPERATION "
<<
i
+
1
<<
": "
std
::
cout
<<
" OPERATION "
<<
i
+
1
<<
": "
<<
error
.
code
<<
" "
<<
error
.
message
<<
std
::
endl
<<
error
.
code
<<
" "
<<
error
.
message
<<
std
::
endl
...
@@ -86,15 +86,15 @@ void printTransactionError(NdbConnection *ndbConnection) {
...
@@ -86,15 +86,15 @@ void printTransactionError(NdbConnection *ndbConnection) {
//
//
// Example insert
// Example insert
// @param myNdb Ndb object representing NDB Cluster
// @param myNdb
Ndb object representing NDB Cluster
// @param my
Connection NdbConne
ction used for transaction
// @param my
Transaction NdbTransa
ction used for transaction
// @param error NdbError object returned in case of errors
// @param error
NdbError object returned in case of errors
// @return -1 in case of failures, 0 otherwise
// @return -1 in case of failures, 0 otherwise
//
//
int
insert
(
int
transactionId
,
Ndb
Connection
*
myConne
ction
)
{
int
insert
(
int
transactionId
,
Ndb
Transaction
*
myTransa
ction
)
{
NdbOperation
*
myOperation
;
// For other operations
NdbOperation
*
myOperation
;
// For other operations
myOperation
=
my
Conne
ction
->
getNdbOperation
(
"MYTABLENAME"
);
myOperation
=
my
Transa
ction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
return
-
1
;
if
(
myOperation
==
NULL
)
return
-
1
;
if
(
myOperation
->
insertTuple
()
||
if
(
myOperation
->
insertTuple
()
||
...
@@ -104,7 +104,7 @@ int insert(int transactionId, NdbConnection* myConnection) {
...
@@ -104,7 +104,7 @@ int insert(int transactionId, NdbConnection* myConnection) {
exit
(
-
1
);
exit
(
-
1
);
}
}
return
my
Conne
ction
->
execute
(
NoCommit
);
return
my
Transa
ction
->
execute
(
NoCommit
);
}
}
...
@@ -116,7 +116,7 @@ int insert(int transactionId, NdbConnection* myConnection) {
...
@@ -116,7 +116,7 @@ int insert(int transactionId, NdbConnection* myConnection) {
int
executeInsertTransaction
(
int
transactionId
,
Ndb
*
myNdb
)
{
int
executeInsertTransaction
(
int
transactionId
,
Ndb
*
myNdb
)
{
int
result
=
0
;
// No result yet
int
result
=
0
;
// No result yet
int
noOfRetriesLeft
=
10
;
int
noOfRetriesLeft
=
10
;
Ndb
Connection
*
myConne
ction
;
// For other transactions
Ndb
Transaction
*
myTransa
ction
;
// For other transactions
NdbError
ndberror
;
NdbError
ndberror
;
while
(
noOfRetriesLeft
>
0
&&
!
result
)
{
while
(
noOfRetriesLeft
>
0
&&
!
result
)
{
...
@@ -124,16 +124,16 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
...
@@ -124,16 +124,16 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
/*********************************
/*********************************
* Start and execute transaction *
* Start and execute transaction *
*********************************/
*********************************/
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
{
if
(
my
Transa
ction
==
NULL
)
{
APIERROR
(
myNdb
->
getNdbError
());
APIERROR
(
myNdb
->
getNdbError
());
ndberror
=
myNdb
->
getNdbError
();
ndberror
=
myNdb
->
getNdbError
();
result
=
-
1
;
// Failure
result
=
-
1
;
// Failure
}
else
if
(
insert
(
transactionId
,
my
Conne
ction
)
||
}
else
if
(
insert
(
transactionId
,
my
Transa
ction
)
||
insert
(
10000
+
transactionId
,
my
Conne
ction
)
||
insert
(
10000
+
transactionId
,
my
Transa
ction
)
||
my
Conne
ction
->
execute
(
Commit
))
{
my
Transa
ction
->
execute
(
Commit
))
{
CONERROR
(
myConne
ction
);
TRANSERROR
(
myTransa
ction
);
ndberror
=
my
Conne
ction
->
getNdbError
();
ndberror
=
my
Transa
ction
->
getNdbError
();
result
=
-
1
;
// Failure
result
=
-
1
;
// Failure
}
else
{
}
else
{
result
=
1
;
// Success
result
=
1
;
// Success
...
@@ -164,8 +164,8 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
...
@@ -164,8 +164,8 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
/*********************
/*********************
* Close transaction *
* Close transaction *
*********************/
*********************/
if
(
my
Conne
ction
!=
NULL
)
{
if
(
my
Transa
ction
!=
NULL
)
{
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
}
}
}
}
...
@@ -181,28 +181,36 @@ int main()
...
@@ -181,28 +181,36 @@ int main()
Ndb_cluster_connection
*
cluster_connection
=
Ndb_cluster_connection
*
cluster_connection
=
new
Ndb_cluster_connection
();
// Object representing the cluster
new
Ndb_cluster_connection
();
// Object representing the cluster
int
r
=
cluster_connection
->
connect
(
5
/* retries */
,
3
/* delay between retries */
,
1
/* verbose */
);
if
(
r
>
0
)
{
std
::
cout
<<
"Cluster connect failed, possibly resolved with more retries.
\n
"
;
exit
(
-
1
);
}
else
if
(
r
<
0
)
{
std
::
cout
<<
"Cluster connect failed.
\n
"
;
exit
(
-
1
);
}
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
{
{
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
exit
(
-
1
);
exit
(
-
1
);
}
}
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
"TEST_DB_1"
);
// Object representing the database
"TEST_DB_1"
);
// Object representing the database
/*******************************************
if
(
myNdb
->
init
()
==
-
1
)
{
* Initialize NDB and wait until its ready *
*******************************************/
if
(
myNdb
->
init
()
==
-
1
)
{
APIERROR
(
myNdb
->
getNdbError
());
APIERROR
(
myNdb
->
getNdbError
());
exit
(
-
1
);
exit
(
-
1
);
}
}
if
(
myNdb
->
waitUntilReady
(
30
)
!=
0
)
{
std
::
cout
<<
"NDB was not ready within 30 secs."
<<
std
::
endl
;
exit
(
-
1
);
}
/************************************
/************************************
* Execute some insert transactions *
* Execute some insert transactions *
************************************/
************************************/
...
...
ndb/examples/ndbapi_example4/Makefile
View file @
c0f99659
...
@@ -7,12 +7,12 @@ DEBUG =
...
@@ -7,12 +7,12 @@ DEBUG =
LFLAGS
=
-Wall
LFLAGS
=
-Wall
INCLUDE_DIR
=
../../include
INCLUDE_DIR
=
../../include
LIB_DIR
=
-L
../../src/.libs
\
LIB_DIR
=
-L
../../src/.libs
\
-L
../../../libmysql/.libs
\
-L
../../../libmysql
_r
/.libs
\
-L
../../../mysys
-L
../../../mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
-lmysys
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
...
...
ndb/examples/ndbapi_example4/ndbapi_example4.cpp
View file @
c0f99659
...
@@ -49,6 +49,22 @@ int main()
...
@@ -49,6 +49,22 @@ int main()
Ndb_cluster_connection
*
cluster_connection
=
Ndb_cluster_connection
*
cluster_connection
=
new
Ndb_cluster_connection
();
// Object representing the cluster
new
Ndb_cluster_connection
();
// Object representing the cluster
int
r
=
cluster_connection
->
connect
(
5
/* retries */
,
3
/* delay between retries */
,
1
/* verbose */
);
if
(
r
>
0
)
{
std
::
cout
<<
"Cluster connect failed, possibly resolved with more retries.
\n
"
;
exit
(
-
1
);
}
else
if
(
r
<
0
)
{
std
::
cout
<<
"Cluster connect failed.
\n
"
;
exit
(
-
1
);
}
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
{
{
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
...
@@ -61,24 +77,16 @@ int main()
...
@@ -61,24 +77,16 @@ int main()
NdbDictionary
::
Column
myColumn
;
NdbDictionary
::
Column
myColumn
;
NdbDictionary
::
Index
myIndex
;
NdbDictionary
::
Index
myIndex
;
Ndb
Connection
*
myConne
ction
;
// For transactions
Ndb
Transaction
*
myTransa
ction
;
// For transactions
NdbOperation
*
myOperation
;
// For primary key operations
NdbOperation
*
myOperation
;
// For primary key operations
NdbIndexOperation
*
myIndexOperation
;
// For index operations
NdbIndexOperation
*
myIndexOperation
;
// For index operations
NdbRecAttr
*
myRecAttr
;
// Result of reading attribute value
NdbRecAttr
*
myRecAttr
;
// Result of reading attribute value
/********************************************
* Initialize NDB and wait until it's ready *
********************************************/
if
(
myNdb
->
init
()
==
-
1
)
{
if
(
myNdb
->
init
()
==
-
1
)
{
APIERROR
(
myNdb
->
getNdbError
());
APIERROR
(
myNdb
->
getNdbError
());
exit
(
-
1
);
exit
(
-
1
);
}
}
if
(
myNdb
->
waitUntilReady
(
30
)
!=
0
)
{
std
::
cout
<<
"NDB was not ready within 30 secs."
<<
std
::
endl
;
exit
(
-
1
);
}
/*********************************************************
/*********************************************************
* Create a table named MYTABLENAME if it does not exist *
* Create a table named MYTABLENAME if it does not exist *
*********************************************************/
*********************************************************/
...
@@ -130,27 +138,27 @@ int main()
...
@@ -130,27 +138,27 @@ int main()
* Using 5 transactions, insert 10 tuples in table: (0,0),(1,1),...,(9,9) *
* Using 5 transactions, insert 10 tuples in table: (0,0),(1,1),...,(9,9) *
**************************************************************************/
**************************************************************************/
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transa
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myOperation
=
my
Conne
ction
->
getNdbOperation
(
"MYTABLENAME"
);
myOperation
=
my
Transa
ction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
insertTuple
();
myOperation
->
insertTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
);
myOperation
=
my
Conne
ction
->
getNdbOperation
(
"MYTABLENAME"
);
myOperation
=
my
Transa
ction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
insertTuple
();
myOperation
->
insertTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
}
}
/*****************************************
/*****************************************
...
@@ -159,63 +167,63 @@ int main()
...
@@ -159,63 +167,63 @@ int main()
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transa
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myIndexOperation
=
my
Conne
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
myIndexOperation
=
my
Transa
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
"MYTABLENAME"
);
"MYTABLENAME"
);
if
(
myIndexOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myIndexOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myIndexOperation
->
readTuple
();
myIndexOperation
->
readTuple
();
myIndexOperation
->
equal
(
"ATTR2"
,
i
);
myIndexOperation
->
equal
(
"ATTR2"
,
i
);
myRecAttr
=
myIndexOperation
->
getValue
(
"ATTR1"
,
NULL
);
myRecAttr
=
myIndexOperation
->
getValue
(
"ATTR1"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myRecAttr
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
if
(
my
Conne
ction
->
execute
(
Commit
)
!=
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
!=
-
1
)
printf
(
" %2d %2d
\n
"
,
myRecAttr
->
u_32_value
(),
i
);
printf
(
" %2d %2d
\n
"
,
myRecAttr
->
u_32_value
(),
i
);
}
}
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
/*****************************************************************
/*****************************************************************
* Update the second attribute in half of the tuples (adding 10) *
* Update the second attribute in half of the tuples (adding 10) *
*****************************************************************/
*****************************************************************/
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transa
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myIndexOperation
=
my
Conne
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
myIndexOperation
=
my
Transa
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
"MYTABLENAME"
);
"MYTABLENAME"
);
if
(
myIndexOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myIndexOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myIndexOperation
->
updateTuple
();
myIndexOperation
->
updateTuple
();
myIndexOperation
->
equal
(
"ATTR2"
,
i
);
myIndexOperation
->
equal
(
"ATTR2"
,
i
);
myIndexOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
myIndexOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
}
}
/*************************************************
/*************************************************
* Delete one tuple (the one with primary key 3) *
* Delete one tuple (the one with primary key 3) *
*************************************************/
*************************************************/
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transa
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myIndexOperation
=
my
Conne
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
myIndexOperation
=
my
Transa
ction
->
getNdbIndexOperation
(
"MYINDEXNAME"
,
"MYTABLENAME"
);
"MYTABLENAME"
);
if
(
myIndexOperation
==
NULL
)
if
(
myIndexOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myIndexOperation
->
deleteTuple
();
myIndexOperation
->
deleteTuple
();
myIndexOperation
->
equal
(
"ATTR2"
,
3
);
myIndexOperation
->
equal
(
"ATTR2"
,
3
);
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
/*****************************
/*****************************
* Read and print all tuples *
* Read and print all tuples *
...
@@ -223,29 +231,29 @@ int main()
...
@@ -223,29 +231,29 @@ int main()
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
std
::
cout
<<
"ATTR1 ATTR2"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
my
Conne
ction
=
myNdb
->
startTransaction
();
my
Transa
ction
=
myNdb
->
startTransaction
();
if
(
my
Conne
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
my
Transa
ction
==
NULL
)
APIERROR
(
myNdb
->
getNdbError
());
myOperation
=
my
Conne
ction
->
getNdbOperation
(
"MYTABLENAME"
);
myOperation
=
my
Transa
ction
->
getNdbOperation
(
"MYTABLENAME"
);
if
(
myOperation
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myOperation
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
myOperation
->
readTuple
();
myOperation
->
readTuple
();
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
equal
(
"ATTR1"
,
i
);
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
my
Conne
ction
->
getNdbError
());
if
(
myRecAttr
==
NULL
)
APIERROR
(
my
Transa
ction
->
getNdbError
());
if
(
my
Conne
ction
->
execute
(
Commit
)
==
-
1
)
if
(
my
Transa
ction
->
execute
(
Commit
)
==
-
1
)
if
(
i
==
3
)
{
if
(
i
==
3
)
{
std
::
cout
<<
"Detected that deleted tuple doesn't exist!"
<<
std
::
endl
;
std
::
cout
<<
"Detected that deleted tuple doesn't exist!"
<<
std
::
endl
;
}
else
{
}
else
{
APIERROR
(
my
Conne
ction
->
getNdbError
());
APIERROR
(
my
Transa
ction
->
getNdbError
());
}
}
if
(
i
!=
3
)
{
if
(
i
!=
3
)
{
printf
(
" %2d %2d
\n
"
,
i
,
myRecAttr
->
u_32_value
());
printf
(
" %2d %2d
\n
"
,
i
,
myRecAttr
->
u_32_value
());
}
}
myNdb
->
closeTransaction
(
my
Conne
ction
);
myNdb
->
closeTransaction
(
my
Transa
ction
);
}
}
/**************
/**************
...
...
ndb/examples/ndbapi_example5/Makefile
View file @
c0f99659
...
@@ -9,12 +9,12 @@ LFLAGS = -Wall
...
@@ -9,12 +9,12 @@ LFLAGS = -Wall
TOP_SRCDIR
=
../../..
TOP_SRCDIR
=
../../..
INCLUDE_DIR
=
$(TOP_SRCDIR)
/ndb/include
INCLUDE_DIR
=
$(TOP_SRCDIR)
/ndb/include
LIB_DIR
=
-L
$(TOP_SRCDIR)
/ndb/src/.libs
\
LIB_DIR
=
-L
$(TOP_SRCDIR)
/ndb/src/.libs
\
-L
$(TOP_SRCDIR)
/libmysql/.libs
\
-L
$(TOP_SRCDIR)
/libmysql
_r
/.libs
\
-L
$(TOP_SRCDIR)
/mysys
-L
$(TOP_SRCDIR)
/mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(CXXFLAGS)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
-lmysys
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(CXXFLAGS)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
...
...
ndb/examples/ndbapi_example5/ndbapi_example5.cpp
View file @
c0f99659
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
*/
*/
#include <NdbApi.hpp>
#include <NdbApi.hpp>
#include <NdbEventOperation.hpp>
// Used for cout
// Used for cout
#include <stdio.h>
#include <stdio.h>
...
@@ -59,8 +58,8 @@
...
@@ -59,8 +58,8 @@
int
myCreateEvent
(
Ndb
*
myNdb
,
int
myCreateEvent
(
Ndb
*
myNdb
,
const
char
*
eventName
,
const
char
*
eventName
,
const
char
*
eventTableName
,
const
char
*
eventTableName
,
const
char
**
eventCo
m
lumnName
,
const
char
**
eventColumnName
,
const
int
noEventCo
m
lumnName
);
const
int
noEventColumnName
);
int
main
()
int
main
()
{
{
...
@@ -69,6 +68,22 @@ int main()
...
@@ -69,6 +68,22 @@ int main()
Ndb_cluster_connection
*
cluster_connection
=
Ndb_cluster_connection
*
cluster_connection
=
new
Ndb_cluster_connection
();
// Object representing the cluster
new
Ndb_cluster_connection
();
// Object representing the cluster
int
r
=
cluster_connection
->
connect
(
5
/* retries */
,
3
/* delay between retries */
,
1
/* verbose */
);
if
(
r
>
0
)
{
std
::
cout
<<
"Cluster connect failed, possibly resolved with more retries.
\n
"
;
exit
(
-
1
);
}
else
if
(
r
<
0
)
{
std
::
cout
<<
"Cluster connect failed.
\n
"
;
exit
(
-
1
);
}
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
if
(
cluster_connection
->
wait_until_ready
(
30
,
30
))
{
{
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
std
::
cout
<<
"Cluster was not ready within 30 secs."
<<
std
::
endl
;
...
@@ -78,39 +93,30 @@ int main()
...
@@ -78,39 +93,30 @@ int main()
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
Ndb
*
myNdb
=
new
Ndb
(
cluster_connection
,
"TEST_DB"
);
// Object representing the database
"TEST_DB"
);
// Object representing the database
if
(
myNdb
->
init
()
==
-
1
)
{
if
(
myNdb
->
init
()
==
-
1
)
APIERROR
(
myNdb
->
getNdbError
());
APIERROR
(
myNdb
->
getNdbError
());
exit
(
-
1
);
}
NdbDictionary
::
Dictionary
*
myDict
;
const
char
*
eventName
=
"CHNG_IN_TAB0"
;
const
char
*
eventName
=
"CHNG_IN_TAB0"
;
const
char
*
eventTableName
=
"TAB0"
;
const
char
*
eventTableName
=
"TAB0"
;
const
int
noEventColumnName
=
3
;
const
int
noEventColumnName
=
3
;
const
char
*
eventColumnName
[
noEventColumnName
]
=
const
char
*
eventColumnName
[
noEventColumnName
]
=
{
"COL0"
,
{
"COL0"
,
"COL1"
,
"COL1"
,
"COL11"
};
"COL11"
};
myDict
=
myNdb
->
getDictionary
();
// Create events
// Create events
myCreateEvent
(
myNdb
,
myCreateEvent
(
myNdb
,
eventName
,
eventName
,
eventTableName
,
eventTableName
,
eventColumnName
,
eventColumnName
,
noEventColumnName
);
noEventColumnName
);
int
j
=
0
;
int
j
=
0
;
while
(
j
<
5
)
{
while
(
j
<
5
)
{
// Start "transaction" for handling events
// Start "transaction" for handling events
NdbEventOperation
*
op
;
NdbEventOperation
*
op
;
printf
(
"create EventOperation
\n
"
);
printf
(
"create EventOperation
\n
"
);
if
((
op
=
myNdb
->
createEventOperation
(
eventName
,
100
))
==
NULL
)
{
if
((
op
=
myNdb
->
createEventOperation
(
eventName
,
100
))
==
NULL
)
printf
(
"Event operation creation failed
\n
"
);
APIERROR
(
myNdb
->
getNdbError
());
exit
(
-
1
);
}
printf
(
"get values
\n
"
);
printf
(
"get values
\n
"
);
NdbRecAttr
*
recAttr
[
noEventColumnName
];
NdbRecAttr
*
recAttr
[
noEventColumnName
];
...
@@ -124,22 +130,21 @@ int main()
...
@@ -124,22 +130,21 @@ int main()
// set up the callbacks
// set up the callbacks
printf
(
"execute
\n
"
);
printf
(
"execute
\n
"
);
if
(
op
->
execute
())
{
// This starts changes to "start flowing"
if
(
op
->
execute
())
{
// This starts changes to "start flowing"
printf
(
"operation
d
execution failed
\n
"
);
printf
(
"operation execution failed
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
int
i
=
0
;
int
i
=
0
;
while
(
i
<
40
)
{
while
(
i
<
40
)
{
//printf("now waiting for event...\n");
//
printf("now waiting for event...\n");
int
r
=
myNdb
->
pollEvents
(
1000
);
// wait for event or 1000 ms
int
r
=
myNdb
->
pollEvents
(
1000
);
// wait for event or 1000 ms
if
(
r
>
0
)
{
if
(
r
>
0
)
{
//printf("got data! %d\n", r);
//
printf("got data! %d\n", r);
int
overrun
;
int
overrun
;
while
(
op
->
next
(
&
overrun
)
>
0
)
{
while
(
op
->
next
(
&
overrun
)
>
0
)
{
i
++
;
i
++
;
if
(
!
op
->
isConsistent
())
if
(
!
op
->
isConsistent
())
printf
(
"A node fail
i
ure has occured and events might be missing
\n
"
);
printf
(
"A node failure has occured and events might be missing
\n
"
);
switch
(
op
->
getEventType
())
{
switch
(
op
->
getEventType
())
{
case
NdbDictionary
:
:
Event
::
TE_INSERT
:
case
NdbDictionary
:
:
Event
::
TE_INSERT
:
printf
(
"%u INSERT: "
,
i
);
printf
(
"%u INSERT: "
,
i
);
...
@@ -175,13 +180,17 @@ int main()
...
@@ -175,13 +180,17 @@ int main()
}
else
}
else
;
//printf("timed out\n");
;
//printf("timed out\n");
}
}
// don't want to listen to eventsanymore
// don't want to listen to events
anymore
myNdb
->
dropEventOperation
(
op
);
myNdb
->
dropEventOperation
(
op
);
j
++
;
j
++
;
}
}
myDict
->
dropEvent
(
eventName
);
// remove event from database
{
NdbDictionary
::
Dictionary
*
myDict
=
myNdb
->
getDictionary
();
if
(
!
myDict
)
APIERROR
(
myNdb
->
getNdbError
());
myDict
->
dropEvent
(
eventName
);
// remove event from database
}
delete
myNdb
;
delete
myNdb
;
delete
cluster_connection
;
delete
cluster_connection
;
...
@@ -195,12 +204,8 @@ int myCreateEvent(Ndb* myNdb,
...
@@ -195,12 +204,8 @@ int myCreateEvent(Ndb* myNdb,
const
char
**
eventColumnName
,
const
char
**
eventColumnName
,
const
int
noEventColumnName
)
const
int
noEventColumnName
)
{
{
NdbDictionary
::
Dictionary
*
myDict
=
myNdb
->
getDictionary
();
NdbDictionary
::
Dictionary
*
myDict
=
myNdb
->
getDictionary
();
if
(
!
myDict
)
APIERROR
(
myNdb
->
getNdbError
());
if
(
!
myDict
)
{
printf
(
"Event Creation failedDictionary not found"
);
exit
(
-
1
);
}
NdbDictionary
::
Event
myEvent
(
eventName
);
NdbDictionary
::
Event
myEvent
(
eventName
);
myEvent
.
setTable
(
eventTableName
);
myEvent
.
setTable
(
eventTableName
);
...
...
ndb/examples/ndbapi_scan_example/Makefile
View file @
c0f99659
...
@@ -9,12 +9,12 @@ LFLAGS = -Wall
...
@@ -9,12 +9,12 @@ LFLAGS = -Wall
TOP_SRCDIR
=
../../..
TOP_SRCDIR
=
../../..
INCLUDE_DIR
=
$(TOP_SRCDIR)
/ndb/include
INCLUDE_DIR
=
$(TOP_SRCDIR)
/ndb/include
LIB_DIR
=
-L
$(TOP_SRCDIR)
/ndb/src/.libs
\
LIB_DIR
=
-L
$(TOP_SRCDIR)
/ndb/src/.libs
\
-L
$(TOP_SRCDIR)
/libmysql/.libs
\
-L
$(TOP_SRCDIR)
/libmysql
_r
/.libs
\
-L
$(TOP_SRCDIR)
/mysys
-L
$(TOP_SRCDIR)
/mysys
SYS_LIB
=
SYS_LIB
=
$(TARGET)
:
$(OBJS)
$(TARGET)
:
$(OBJS)
$(CXX)
$(CXXFLAGS)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
-lmysys
$(SYS_LIB)
-o
$(TARGET)
$(CXX)
$(CXXFLAGS)
$(LFLAGS)
$(LIB_DIR)
$(OBJS)
-lndbclient
-lmysqlclient
_r
-lmysys
-lz
$(SYS_LIB)
-o
$(TARGET)
$(TARGET).o
:
$(SRCS)
$(TARGET).o
:
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
$(CXX)
$(CFLAGS)
-I
$(INCLUDE_DIR)
-I
$(INCLUDE_DIR)
/ndbapi
$(SRCS)
...
...
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
View file @
c0f99659
...
@@ -24,9 +24,12 @@
...
@@ -24,9 +24,12 @@
*
*
* Classes and methods used in this example:
* Classes and methods used in this example:
*
*
* Ndb_cluster_connection
* connect()
* wait_until_ready()
*
* Ndb
* Ndb
* init()
* init()
* waitUntilRead()
* getDictionary()
* getDictionary()
* startTransaction()
* startTransaction()
* closeTransaction()
* closeTransaction()
...
@@ -74,7 +77,6 @@
...
@@ -74,7 +77,6 @@
#include <NdbApi.hpp>
#include <NdbApi.hpp>
#include <NdbScanFilter.hpp>
// Used for cout
// Used for cout
#include <iostream>
#include <iostream>
...
@@ -235,7 +237,7 @@ int scan_delete(Ndb* myNdb,
...
@@ -235,7 +237,7 @@ int scan_delete(Ndb* myNdb,
int
deletedRows
=
0
;
int
deletedRows
=
0
;
int
check
;
int
check
;
NdbError
err
;
NdbError
err
;
Ndb
Connection
*
myTrans
;
Ndb
Transaction
*
myTrans
;
NdbScanOperation
*
myScanOp
;
NdbScanOperation
*
myScanOp
;
/**
/**
...
@@ -407,7 +409,7 @@ int scan_update(Ndb* myNdb,
...
@@ -407,7 +409,7 @@ int scan_update(Ndb* myNdb,
int
updatedRows
=
0
;
int
updatedRows
=
0
;
int
check
;
int
check
;
NdbError
err
;
NdbError
err
;
Ndb
Connection
*
myTrans
;
Ndb
Transaction
*
myTrans
;
NdbScanOperation
*
myScanOp
;
NdbScanOperation
*
myScanOp
;
/**
/**
...
@@ -588,7 +590,7 @@ int scan_print(Ndb * myNdb)
...
@@ -588,7 +590,7 @@ int scan_print(Ndb * myNdb)
int
fetchedRows
=
0
;
int
fetchedRows
=
0
;
int
check
;
int
check
;
NdbError
err
;
NdbError
err
;
Ndb
Connection
*
myTrans
;
Ndb
Transaction
*
myTrans
;
NdbScanOperation
*
myScanOp
;
NdbScanOperation
*
myScanOp
;
/* Result of reading attribute value, three columns:
/* Result of reading attribute value, three columns:
REG_NO, BRAND, and COLOR
REG_NO, BRAND, and COLOR
...
...
ndb/include/ndbapi/Ndb.hpp
View file @
c0f99659
...
@@ -122,8 +122,7 @@
...
@@ -122,8 +122,7 @@
// 4. Attribute Actions
// 4. Attribute Actions
MyRecAttr= MyOperation->getValue("ATTR2", NULL);
MyRecAttr= MyOperation->getValue("ATTR2", NULL);
@endcode
@endcode
For additional examples of this sort, see @ref ndbapi_example1.cpp and
For additional examples of this sort, see @ref ndbapi_example1.cpp.
@ref ndbapi_example2.cpp.
The second example uses an NdbIndexOperation:
The second example uses an NdbIndexOperation:
@code
@code
...
@@ -428,10 +427,12 @@
...
@@ -428,10 +427,12 @@
* @include ndbapi_example1.cpp
* @include ndbapi_example1.cpp
*/
*/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
/**
* @page ndbapi_example2.cpp ndbapi_example2.cpp
* @page ndbapi_example2.cpp ndbapi_example2.cpp
* @include ndbapi_example2.cpp
* @include ndbapi_example2.cpp
*/
*/
#endif
/**
/**
* @page ndbapi_example3.cpp ndbapi_example3.cpp
* @page ndbapi_example3.cpp ndbapi_example3.cpp
...
...
ndb/include/ndbapi/NdbRecAttr.hpp
View file @
c0f99659
...
@@ -39,8 +39,7 @@ class NdbOperation;
...
@@ -39,8 +39,7 @@ class NdbOperation;
* ndbout << MyRecAttr->u_32_value();
* ndbout << MyRecAttr->u_32_value();
* @endcode
* @endcode
* For more examples, see
* For more examples, see
* @ref ndbapi_example1.cpp and
* @ref ndbapi_example1.cpp.
* @ref ndbapi_example2.cpp.
*
*
* @note The NdbRecAttr object is instantiated with its value when
* @note The NdbRecAttr object is instantiated with its value when
* NdbTransaction::execute is called. Before this, the value is
* NdbTransaction::execute is called. Before this, the value is
...
...
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