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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
87b22e8a
Commit
87b22e8a
authored
Aug 11, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add indexes to test toolkit
parent
63061c29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
38 deletions
+111
-38
ndb/test/include/NDBT_Table.hpp
ndb/test/include/NDBT_Table.hpp
+2
-3
ndb/test/include/NDBT_Tables.hpp
ndb/test/include/NDBT_Tables.hpp
+2
-1
ndb/test/src/NDBT_Tables.cpp
ndb/test/src/NDBT_Tables.cpp
+106
-33
ndb/test/src/NDBT_Test.cpp
ndb/test/src/NDBT_Test.cpp
+1
-1
No files found.
ndb/test/include/NDBT_Table.hpp
View file @
87b22e8a
...
@@ -50,13 +50,12 @@ public:
...
@@ -50,13 +50,12 @@ public:
NDBT_Table
(
const
char
*
name
,
NDBT_Table
(
const
char
*
name
,
int
noOfAttributes
,
int
noOfAttributes
,
const
NdbDictionary
::
Column
attributes
[],
const
NdbDictionary
::
Column
attributes
[])
bool
stored
=
true
)
:
NdbDictionary
::
Table
(
name
)
:
NdbDictionary
::
Table
(
name
)
{
{
assert
(
name
!=
0
);
assert
(
name
!=
0
);
setStoredTable
(
stored
);
//
setStoredTable(stored);
for
(
int
i
=
0
;
i
<
noOfAttributes
;
i
++
)
for
(
int
i
=
0
;
i
<
noOfAttributes
;
i
++
)
addColumn
(
attributes
[
i
]);
addColumn
(
attributes
[
i
]);
}
}
...
...
ndb/test/include/NDBT_Tables.hpp
View file @
87b22e8a
...
@@ -26,7 +26,8 @@
...
@@ -26,7 +26,8 @@
class
NDBT_Tables
{
class
NDBT_Tables
{
public:
public:
static
int
createTable
(
Ndb
*
pNdb
,
const
char
*
_name
,
bool
_temp
=
false
);
static
int
createTable
(
Ndb
*
pNdb
,
const
char
*
_name
,
bool
_temp
=
false
,
bool
existsOK
=
false
);
static
int
createAllTables
(
Ndb
*
pNdb
,
bool
_temp
,
bool
existsOK
=
false
);
static
int
createAllTables
(
Ndb
*
pNdb
,
bool
_temp
,
bool
existsOK
=
false
);
static
int
createAllTables
(
Ndb
*
pNdb
);
static
int
createAllTables
(
Ndb
*
pNdb
);
...
...
ndb/test/src/NDBT_Tables.cpp
View file @
87b22e8a
...
@@ -297,7 +297,7 @@ NDBT_Table T14("T14", sizeof(T14Attribs)/sizeof(NDBT_Attribute), T14Attribs);
...
@@ -297,7 +297,7 @@ NDBT_Table T14("T14", sizeof(T14Attribs)/sizeof(NDBT_Attribute), T14Attribs);
*/
*/
static
static
const
const
NDBT_Attribute
C2_PORTS_Attrib
s
[]
=
{
NDBT_Attribute
I1_Col
s
[]
=
{
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
...
@@ -310,11 +310,19 @@ NDBT_Attribute C2_PORTS_Attribs[] = {
...
@@ -310,11 +310,19 @@ NDBT_Attribute C2_PORTS_Attribs[] = {
};
};
static
static
NDBT_Table
C2_PORTS
(
"C2_PORTS"
,
sizeof
(
C2_PORTS_Attribs
)
/
sizeof
(
NDBT_Attribute
),
C2_PORTS_Attribs
);
const
char
*
I1_Indexes
[]
=
{
"UNIQUE"
,
"ID"
,
"PORT"
,
"ACCESSNODE"
,
"POP"
,
"PORTSTATE"
,
0
,
0
};
static
NDBT_Table
I1
(
"I1"
,
sizeof
(
I1_Cols
)
/
sizeof
(
NDBT_Attribute
),
I1_Cols
);
// ,I1_Indexes);
static
static
const
const
NDBT_Attribute
C2_SERVICES_Attrib
s
[]
=
{
NDBT_Attribute
I2_Col
s
[]
=
{
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
,
true
),
...
@@ -331,12 +339,20 @@ NDBT_Attribute C2_SERVICES_Attribs[] = {
...
@@ -331,12 +339,20 @@ NDBT_Attribute C2_SERVICES_Attribs[] = {
NDBT_Attribute
(
"UPDATES"
,
NdbDictionary
::
Column
::
Unsigned
)
NDBT_Attribute
(
"UPDATES"
,
NdbDictionary
::
Column
::
Unsigned
)
};
};
const
char
*
I2_Indexes
[]
=
{
"ORDERED"
,
"CUSTOMER_ID"
,
0
,
"ORDERED"
,
"NUM_IP"
,
0
,
0
};
static
static
NDBT_Table
C2_SERVICES
(
"C2_SERVICES"
,
sizeof
(
C2_SERVICES_Attribs
)
/
sizeof
(
NDBT_Attribute
),
C2_SERVICES_Attribs
);
NDBT_Table
I2
(
"I2"
,
sizeof
(
I2_Cols
)
/
sizeof
(
NDBT_Attribute
),
I2_Cols
);
//, I2_Indexes);
static
static
const
const
NDBT_Attribute
C2_CLIENTS_Attrib
s
[]
=
{
NDBT_Attribute
I3_Col
s
[]
=
{
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"ID"
,
NdbDictionary
::
Column
::
Unsigned
,
true
),
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
),
// SI2
NDBT_Attribute
(
"PORT"
,
NdbDictionary
::
Column
::
Char
,
16
),
// SI2
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
),
// SI2
NDBT_Attribute
(
"ACCESSNODE"
,
NdbDictionary
::
Column
::
Char
,
16
),
// SI2
...
@@ -355,8 +371,17 @@ NDBT_Attribute C2_CLIENTS_Attribs[] = {
...
@@ -355,8 +371,17 @@ NDBT_Attribute C2_CLIENTS_Attribs[] = {
NDBT_Attribute
(
"UPDATES"
,
NdbDictionary
::
Column
::
Unsigned
)
NDBT_Attribute
(
"UPDATES"
,
NdbDictionary
::
Column
::
Unsigned
)
};
};
const
char
*
I3_Indexes
[]
=
{
"UNIQUE"
,
"ID"
,
0
,
"ORDERED"
,
"MAC"
,
0
,
"ORDERED"
,
"GW"
,
0
,
0
};
static
static
NDBT_Table
C2_CLIENTS
(
"C2_CLIENTS"
,
sizeof
(
C2_CLIENTS_Attribs
)
/
sizeof
(
NDBT_Attribute
),
C2_CLIENTS_Attribs
);
NDBT_Table
I3
(
"I3"
,
sizeof
(
I3_Cols
)
/
sizeof
(
NDBT_Attribute
),
I3_Cols
);
// ,I3_Indexes);
// Define array with pointer to all tables
// Define array with pointer to all tables
static
static
...
@@ -377,10 +402,23 @@ NDBT_Table *test_tables[]=
...
@@ -377,10 +402,23 @@ NDBT_Table *test_tables[]=
&
T12
,
&
T12
,
&
T13
,
&
T13
,
&
T14
,
&
T14
,
&
C2_PORTS
,
&
I1
,
&
C2_SERVICES
,
&
I2
,
&
C2_CLIENTS
&
I3
};
struct
NDBT_IndexList
{
const
char
*
m_table
;
const
char
**
m_indexes
;
};
static
const
NDBT_IndexList
indexes
[]
=
{
"I1"
,
I1_Indexes
,
"I2"
,
I2_Indexes
,
"I3"
,
I3_Indexes
,
0
,
0
};
};
static
static
...
@@ -763,27 +801,12 @@ NDBT_Tables::getNumTables(){
...
@@ -763,27 +801,12 @@ NDBT_Tables::getNumTables(){
int
int
NDBT_Tables
::
createAllTables
(
Ndb
*
pNdb
,
bool
_temp
,
bool
existsOk
){
NDBT_Tables
::
createAllTables
(
Ndb
*
pNdb
,
bool
_temp
,
bool
existsOk
){
for
(
int
i
=
0
;
i
<
NDBT_Tables
::
getNumTables
();
i
++
){
for
(
int
i
=
0
;
i
<
NDBT_Tables
::
getNumTables
();
i
++
){
int
ret
=
createTable
(
pNdb
,
const
NdbDictionary
::
Table
*
tab
=
NDBT_Tables
::
getTable
(
i
);
NDBT_Tables
::
getTable
(
i
)
->
getName
(),
_temp
,
existsOk
);
if
(
tab
==
NULL
){
if
(
ret
)
return
NDBT_ProgramExit
(
NDBT_FAILED
);
return
ret
;
}
// Set temporary table
NdbDictionary
::
Table
tmpTab
(
*
tab
);
tmpTab
.
setStoredTable
(
_temp
?
0
:
1
);
int
r
=
pNdb
->
getDictionary
()
->
createTable
(
tmpTab
);
int
err
=
pNdb
->
getDictionary
()
->
getNdbError
().
code
;
if
(
r
==
-
1
){
if
(
existsOk
&&
err
==
721
)
;
else
{
return
NDBT_FAILED
;
}
}
}
}
return
NDBT_OK
;
return
NDBT_OK
;
}
}
...
@@ -794,7 +817,8 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
...
@@ -794,7 +817,8 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
}
}
int
int
NDBT_Tables
::
createTable
(
Ndb
*
pNdb
,
const
char
*
_name
,
bool
_temp
){
NDBT_Tables
::
createTable
(
Ndb
*
pNdb
,
const
char
*
_name
,
bool
_temp
,
bool
existsOk
){
const
NdbDictionary
::
Table
*
tab
=
NDBT_Tables
::
getTable
(
_name
);
const
NdbDictionary
::
Table
*
tab
=
NDBT_Tables
::
getTable
(
_name
);
if
(
tab
==
NULL
){
if
(
tab
==
NULL
){
...
@@ -804,10 +828,59 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp){
...
@@ -804,10 +828,59 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp){
return
NDBT_WRONGARGS
;
return
NDBT_WRONGARGS
;
}
}
NdbDictionary
::
Table
tmpTab
(
*
tab
);
int
r
=
0
;
tmpTab
.
setStoredTable
(
_temp
?
0
:
1
);
do
{
NdbDictionary
::
Table
tmpTab
(
*
tab
);
tmpTab
.
setStoredTable
(
_temp
?
0
:
1
);
r
=
pNdb
->
getDictionary
()
->
createTable
(
tmpTab
);
if
(
r
==
-
1
){
if
(
!
existsOk
)
break
;
if
(
pNdb
->
getDictionary
()
->
getNdbError
().
code
!=
721
){
ndbout
<<
pNdb
->
getDictionary
()
->
getNdbError
()
<<
endl
;
break
;
}
r
=
0
;
}
Uint32
i
=
0
;
for
(
Uint32
i
=
0
;
indexes
[
i
].
m_table
!=
0
;
i
++
){
if
(
strcmp
(
indexes
[
i
].
m_table
,
_name
)
!=
0
)
continue
;
Uint32
j
=
0
;
while
(
indexes
[
i
].
m_indexes
[
j
]
!=
0
){
NdbDictionary
::
Index
tmpIndx
;
BaseString
name
;
name
.
assfmt
(
"%s$NDBT_IDX%d"
,
_name
,
j
);
tmpIndx
.
setName
(
name
.
c_str
());
tmpIndx
.
setTable
(
_name
);
bool
logging
=
!
_temp
;
if
(
strcmp
(
indexes
[
i
].
m_indexes
[
j
],
"ORDERED"
)
==
0
){
logging
=
false
;
tmpIndx
.
setType
(
NdbDictionary
::
Index
::
OrderedIndex
);
}
else
if
(
strcmp
(
indexes
[
i
].
m_indexes
[
j
],
"UNIQUE"
)
==
0
){
tmpIndx
.
setType
(
NdbDictionary
::
Index
::
UniqueHashIndex
);
}
else
{
ndbout
<<
"Unknown index type"
;
abort
();
}
tmpIndx
.
setLogging
(
logging
);
j
++
;
while
(
indexes
[
i
].
m_indexes
[
j
]
!=
0
){
tmpIndx
.
addIndexColumn
(
indexes
[
i
].
m_indexes
[
j
]);
j
++
;
}
j
++
;
if
(
pNdb
->
getDictionary
()
->
createIndex
(
tmpIndx
)
!=
0
){
ndbout
<<
pNdb
->
getDictionary
()
->
getNdbError
()
<<
endl
;
return
NDBT_FAILED
;
}
}
}
}
while
(
false
);
int
r
=
pNdb
->
getDictionary
()
->
createTable
(
tmpTab
);
return
r
;
return
r
;
}
}
...
...
ndb/test/src/NDBT_Test.cpp
View file @
87b22e8a
...
@@ -828,7 +828,7 @@ void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab,
...
@@ -828,7 +828,7 @@ void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab,
continue
;
continue
;
}
}
if
(
pDict
->
createTable
(
*
pTab
)
!=
0
){
if
(
NDBT_Tables
::
createTable
(
ndb
,
pTab
->
getName
()
)
!=
0
){
numTestsFail
++
;
numTestsFail
++
;
numTestsExecuted
++
;
numTestsExecuted
++
;
g_err
<<
"ERROR1: Failed to create table "
<<
pTab
->
getName
()
g_err
<<
"ERROR1: Failed to create table "
<<
pTab
->
getName
()
...
...
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