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
da340ede
Commit
da340ede
authored
May 19, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed global variable fullyQualifiedNames
parent
ad49bb78
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
89 additions
and
71 deletions
+89
-71
ndb/include/ndb_global.h
ndb/include/ndb_global.h
+2
-0
ndb/include/ndbapi/Ndb.hpp
ndb/include/ndbapi/Ndb.hpp
+6
-2
ndb/src/common/portlib/unix/NdbThread.c
ndb/src/common/portlib/unix/NdbThread.c
+1
-1
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+35
-27
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+18
-18
ndb/src/ndbapi/NdbDictionaryImpl.hpp
ndb/src/ndbapi/NdbDictionaryImpl.hpp
+8
-7
ndb/src/ndbapi/Ndbinit.cpp
ndb/src/ndbapi/Ndbinit.cpp
+6
-2
ndb/src/rep/adapters/AppNDB.cpp
ndb/src/rep/adapters/AppNDB.cpp
+5
-3
ndb/src/rep/state/Channel.cpp
ndb/src/rep/state/Channel.cpp
+4
-4
ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
+1
-4
ndb/tools/list_tables/listTables.cpp
ndb/tools/list_tables/listTables.cpp
+3
-3
No files found.
ndb/include/ndb_global.h
View file @
da340ede
...
@@ -49,6 +49,8 @@
...
@@ -49,6 +49,8 @@
#endif
#endif
static
const
char
table_name_separator
=
'/'
;
#ifdef NDB_VC98
#ifdef NDB_VC98
#define STATIC_CONST(x) enum { x }
#define STATIC_CONST(x) enum { x }
#else
#else
...
...
ndb/include/ndbapi/Ndb.hpp
View file @
da340ede
...
@@ -1384,9 +1384,9 @@ public:
...
@@ -1384,9 +1384,9 @@ public:
* index names as DATABASENAME/SCHEMANAME/TABLENAME/INDEXNAME
* index names as DATABASENAME/SCHEMANAME/TABLENAME/INDEXNAME
* @param turnNamingOn bool true - turn naming on, false - turn naming off
* @param turnNamingOn bool true - turn naming on, false - turn naming off
*/
*/
static
void
useFullyQualifiedNames
(
bool
turnNamingOn
=
true
);
void
useFullyQualifiedNames
(
bool
turnNamingOn
=
true
);
static
bool
usingFullyQualifiedNames
();
bool
usingFullyQualifiedNames
();
/** @} *********************************************************************/
/** @} *********************************************************************/
...
@@ -1558,10 +1558,12 @@ private:
...
@@ -1558,10 +1558,12 @@ private:
void
abortTransactionsAfterNodeFailure
(
Uint16
aNodeId
);
void
abortTransactionsAfterNodeFailure
(
Uint16
aNodeId
);
static
static
const
char
*
externalizeTableName
(
const
char
*
internalTableName
,
bool
fullyQualifiedNames
);
const
char
*
externalizeTableName
(
const
char
*
internalTableName
);
const
char
*
externalizeTableName
(
const
char
*
internalTableName
);
const
char
*
internalizeTableName
(
const
char
*
externalTableName
);
const
char
*
internalizeTableName
(
const
char
*
externalTableName
);
static
static
const
char
*
externalizeIndexName
(
const
char
*
internalIndexName
,
bool
fullyQualifiedNames
);
const
char
*
externalizeIndexName
(
const
char
*
internalIndexName
);
const
char
*
externalizeIndexName
(
const
char
*
internalIndexName
);
const
char
*
internalizeIndexName
(
const
NdbTableImpl
*
table
,
const
char
*
internalizeIndexName
(
const
NdbTableImpl
*
table
,
const
char
*
externalIndexName
);
const
char
*
externalIndexName
);
...
@@ -1598,6 +1600,8 @@ private:
...
@@ -1598,6 +1600,8 @@ private:
NdbWaiter
theWaiter
;
NdbWaiter
theWaiter
;
bool
fullyQualifiedNames
;
// Ndb database name.
// Ndb database name.
char
theDataBase
[
NDB_MAX_DATABASE_NAME_SIZE
];
char
theDataBase
[
NDB_MAX_DATABASE_NAME_SIZE
];
// Ndb database schema name.
// Ndb database schema name.
...
...
ndb/src/common/portlib/unix/NdbThread.c
View file @
da340ede
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#define MAX_THREAD_NAME 16
#define MAX_THREAD_NAME 16
/
/#define USE_PTHREAD_EXTRAS
/
*#define USE_PTHREAD_EXTRAS*/
struct
NdbThread
struct
NdbThread
{
{
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
da340ede
...
@@ -40,8 +40,6 @@ Name: Ndb.cpp
...
@@ -40,8 +40,6 @@ Name: Ndb.cpp
#include <NdbEnv.h>
#include <NdbEnv.h>
#include <BaseString.hpp>
#include <BaseString.hpp>
static
bool
fullyQualifiedNames
=
true
;
/****************************************************************************
/****************************************************************************
void connect();
void connect();
...
@@ -1020,10 +1018,10 @@ void Ndb::setCatalogName(const char * a_catalog_name)
...
@@ -1020,10 +1018,10 @@ void Ndb::setCatalogName(const char * a_catalog_name)
uint
schema_len
=
uint
schema_len
=
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
prefixName
[
db_len
]
=
'/'
;
prefixName
[
db_len
]
=
table_name_separator
;
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
prefixName
[
db_len
+
schema_len
+
1
]
=
'/'
;
prefixName
[
db_len
+
schema_len
+
1
]
=
table_name_separator
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
}
}
...
@@ -1043,10 +1041,10 @@ void Ndb::setSchemaName(const char * a_schema_name)
...
@@ -1043,10 +1041,10 @@ void Ndb::setSchemaName(const char * a_schema_name)
uint
schema_len
=
uint
schema_len
=
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
prefixName
[
db_len
]
=
'/'
;
prefixName
[
db_len
]
=
table_name_separator
;
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
prefixName
[
db_len
+
schema_len
+
1
]
=
'/'
;
prefixName
[
db_len
+
schema_len
+
1
]
=
table_name_separator
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
}
}
...
@@ -1086,43 +1084,36 @@ bool Ndb::usingFullyQualifiedNames()
...
@@ -1086,43 +1084,36 @@ bool Ndb::usingFullyQualifiedNames()
}
}
const
char
*
const
char
*
Ndb
::
externalizeTableName
(
const
char
*
internalTableName
)
Ndb
::
externalizeTableName
(
const
char
*
internalTableName
,
bool
fullyQualifiedNames
)
{
{
if
(
fullyQualifiedNames
)
{
if
(
fullyQualifiedNames
)
{
register
const
char
*
ptr
=
internalTableName
;
register
const
char
*
ptr
=
internalTableName
;
// Skip database name
// Skip database name
while
(
*
ptr
&&
*
ptr
++
!=
'/'
);
while
(
*
ptr
&&
*
ptr
++
!=
table_name_separator
);
// Skip schema name
// Skip schema name
while
(
*
ptr
&&
*
ptr
++
!=
'/'
);
while
(
*
ptr
&&
*
ptr
++
!=
table_name_separator
);
return
ptr
;
return
ptr
;
}
}
else
else
return
internalTableName
;
return
internalTableName
;
}
}
const
char
*
const
char
*
Ndb
::
internalizeTableName
(
const
char
*
ex
ternalTableName
)
Ndb
::
externalizeTableName
(
const
char
*
in
ternalTableName
)
{
{
if
(
fullyQualifiedNames
)
{
return
externalizeTableName
(
internalTableName
,
usingFullyQualifiedNames
());
strncpy
(
prefixEnd
,
externalTableName
,
NDB_MAX_TAB_NAME_SIZE
);
return
prefixName
;
}
else
return
externalTableName
;
}
}
const
char
*
const
char
*
Ndb
::
externalizeIndexName
(
const
char
*
internalIndexName
)
Ndb
::
externalizeIndexName
(
const
char
*
internalIndexName
,
bool
fullyQualifiedNames
)
{
{
if
(
fullyQualifiedNames
)
{
if
(
fullyQualifiedNames
)
{
register
const
char
*
ptr
=
internalIndexName
;
register
const
char
*
ptr
=
internalIndexName
;
// Scan name from the end
// Scan name from the end
while
(
*
ptr
++
);
ptr
--
;
// strend
while
(
*
ptr
++
);
ptr
--
;
// strend
while
(
ptr
>=
internalIndexName
&&
*
ptr
!=
'/'
)
while
(
ptr
>=
internalIndexName
&&
*
ptr
!=
table_name_separator
)
ptr
--
;
ptr
--
;
return
ptr
+
1
;
return
ptr
+
1
;
...
@@ -1130,6 +1121,23 @@ Ndb::externalizeIndexName(const char * internalIndexName)
...
@@ -1130,6 +1121,23 @@ Ndb::externalizeIndexName(const char * internalIndexName)
else
else
return
internalIndexName
;
return
internalIndexName
;
}
}
const
char
*
Ndb
::
externalizeIndexName
(
const
char
*
internalIndexName
)
{
return
externalizeIndexName
(
internalIndexName
,
usingFullyQualifiedNames
());
}
const
char
*
Ndb
::
internalizeTableName
(
const
char
*
externalTableName
)
{
if
(
fullyQualifiedNames
)
{
strncpy
(
prefixEnd
,
externalTableName
,
NDB_MAX_TAB_NAME_SIZE
);
return
prefixName
;
}
else
return
externalTableName
;
}
const
char
*
const
char
*
Ndb
::
internalizeIndexName
(
const
NdbTableImpl
*
table
,
Ndb
::
internalizeIndexName
(
const
NdbTableImpl
*
table
,
...
@@ -1140,7 +1148,7 @@ Ndb::internalizeIndexName(const NdbTableImpl * table,
...
@@ -1140,7 +1148,7 @@ Ndb::internalizeIndexName(const NdbTableImpl * table,
sprintf
(
tableId
,
"%d"
,
table
->
m_tableId
);
sprintf
(
tableId
,
"%d"
,
table
->
m_tableId
);
Uint32
tabIdLen
=
strlen
(
tableId
);
Uint32
tabIdLen
=
strlen
(
tableId
);
strncpy
(
prefixEnd
,
tableId
,
tabIdLen
);
strncpy
(
prefixEnd
,
tableId
,
tabIdLen
);
prefixEnd
[
tabIdLen
]
=
'/'
;
prefixEnd
[
tabIdLen
]
=
table_name_separator
;
strncpy
(
prefixEnd
+
tabIdLen
+
1
,
strncpy
(
prefixEnd
+
tabIdLen
+
1
,
externalIndexName
,
NDB_MAX_TAB_NAME_SIZE
);
externalIndexName
,
NDB_MAX_TAB_NAME_SIZE
);
return
prefixName
;
return
prefixName
;
...
@@ -1156,8 +1164,8 @@ Ndb::getDatabaseFromInternalName(const char * internalName)
...
@@ -1156,8 +1164,8 @@ Ndb::getDatabaseFromInternalName(const char * internalName)
strcpy
(
databaseName
,
internalName
);
strcpy
(
databaseName
,
internalName
);
register
char
*
ptr
=
databaseName
;
register
char
*
ptr
=
databaseName
;
/* Scan name for the first
'/'
*/
/* Scan name for the first
table_name_separator
*/
while
(
*
ptr
&&
*
ptr
!=
'/'
)
while
(
*
ptr
&&
*
ptr
!=
table_name_separator
)
ptr
++
;
ptr
++
;
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
BaseString
ret
=
BaseString
(
databaseName
);
BaseString
ret
=
BaseString
(
databaseName
);
...
@@ -1171,12 +1179,12 @@ Ndb::getSchemaFromInternalName(const char * internalName)
...
@@ -1171,12 +1179,12 @@ Ndb::getSchemaFromInternalName(const char * internalName)
char
*
schemaName
=
new
char
[
strlen
(
internalName
)];
char
*
schemaName
=
new
char
[
strlen
(
internalName
)];
register
const
char
*
ptr1
=
internalName
;
register
const
char
*
ptr1
=
internalName
;
/* Scan name for the second
'/'
*/
/* Scan name for the second
table_name_separator
*/
while
(
*
ptr1
&&
*
ptr1
!=
'/'
)
while
(
*
ptr1
&&
*
ptr1
!=
table_name_separator
)
ptr1
++
;
ptr1
++
;
strcpy
(
schemaName
,
ptr1
+
1
);
strcpy
(
schemaName
,
ptr1
+
1
);
register
char
*
ptr
=
schemaName
;
register
char
*
ptr
=
schemaName
;
while
(
*
ptr
&&
*
ptr
!=
'/'
)
while
(
*
ptr
&&
*
ptr
!=
table_name_separator
)
ptr
++
;
ptr
++
;
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
BaseString
ret
=
BaseString
(
schemaName
);
BaseString
ret
=
BaseString
(
schemaName
);
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
da340ede
...
@@ -622,7 +622,7 @@ NdbDictionaryImpl::getIndexTable(NdbIndexImpl * index,
...
@@ -622,7 +622,7 @@ NdbDictionaryImpl::getIndexTable(NdbIndexImpl * index,
const
char
*
internalName
=
const
char
*
internalName
=
m_ndb
.
internalizeIndexName
(
table
,
index
->
getName
());
m_ndb
.
internalizeIndexName
(
table
,
index
->
getName
());
return
getTable
(
Ndb
::
externalizeTableName
(
internalName
));
return
getTable
(
m_ndb
.
externalizeTableName
(
internalName
));
}
}
bool
bool
...
@@ -863,7 +863,7 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
...
@@ -863,7 +863,7 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
* get tab info
* get tab info
*/
*/
NdbTableImpl
*
NdbTableImpl
*
NdbDictInterface
::
getTable
(
int
tableId
)
NdbDictInterface
::
getTable
(
int
tableId
,
bool
fullyQualifiedNames
)
{
{
NdbApiSignal
tSignal
(
m_reference
);
NdbApiSignal
tSignal
(
m_reference
);
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
...
@@ -877,11 +877,11 @@ NdbDictInterface::getTable(int tableId)
...
@@ -877,11 +877,11 @@ NdbDictInterface::getTable(int tableId)
tSignal
.
theVerId_signalNumber
=
GSN_GET_TABINFOREQ
;
tSignal
.
theVerId_signalNumber
=
GSN_GET_TABINFOREQ
;
tSignal
.
theLength
=
GetTabInfoReq
::
SignalLength
;
tSignal
.
theLength
=
GetTabInfoReq
::
SignalLength
;
return
getTable
(
&
tSignal
,
0
,
0
);
return
getTable
(
&
tSignal
,
0
,
0
,
fullyQualifiedNames
);
}
}
NdbTableImpl
*
NdbTableImpl
*
NdbDictInterface
::
getTable
(
const
char
*
name
)
NdbDictInterface
::
getTable
(
const
char
*
name
,
bool
fullyQualifiedNames
)
{
{
NdbApiSignal
tSignal
(
m_reference
);
NdbApiSignal
tSignal
(
m_reference
);
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
GetTabInfoReq
*
const
req
=
CAST_PTR
(
GetTabInfoReq
,
tSignal
.
getDataPtrSend
());
...
@@ -905,13 +905,13 @@ NdbDictInterface::getTable(const char * name)
...
@@ -905,13 +905,13 @@ NdbDictInterface::getTable(const char * name)
ptr
[
0
].
p
=
(
Uint32
*
)
name
;
ptr
[
0
].
p
=
(
Uint32
*
)
name
;
ptr
[
0
].
sz
=
strLen
;
ptr
[
0
].
sz
=
strLen
;
return
getTable
(
&
tSignal
,
ptr
,
1
);
return
getTable
(
&
tSignal
,
ptr
,
1
,
fullyQualifiedNames
);
}
}
NdbTableImpl
*
NdbTableImpl
*
NdbDictInterface
::
getTable
(
class
NdbApiSignal
*
signal
,
NdbDictInterface
::
getTable
(
class
NdbApiSignal
*
signal
,
LinearSectionPtr
ptr
[
3
],
LinearSectionPtr
ptr
[
3
],
Uint32
noOfSections
)
Uint32
noOfSections
,
bool
fullyQualifiedNames
)
{
{
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
int
r
=
dictSignal
(
signal
,
ptr
,
noOfSections
,
int
r
=
dictSignal
(
signal
,
ptr
,
noOfSections
,
...
@@ -925,7 +925,7 @@ NdbDictInterface::getTable(class NdbApiSignal * signal,
...
@@ -925,7 +925,7 @@ NdbDictInterface::getTable(class NdbApiSignal * signal,
NdbTableImpl
*
rt
=
0
;
NdbTableImpl
*
rt
=
0
;
m_error
.
code
=
parseTableInfo
(
&
rt
,
m_error
.
code
=
parseTableInfo
(
&
rt
,
(
Uint32
*
)
m_buffer
.
get_data
(),
(
Uint32
*
)
m_buffer
.
get_data
(),
m_buffer
.
length
()
/
4
);
m_buffer
.
length
()
/
4
,
fullyQualifiedNames
);
rt
->
buildColumnHash
();
rt
->
buildColumnHash
();
return
rt
;
return
rt
;
}
}
...
@@ -1082,7 +1082,8 @@ columnTypeMapping[] = {
...
@@ -1082,7 +1082,8 @@ columnTypeMapping[] = {
int
int
NdbDictInterface
::
parseTableInfo
(
NdbTableImpl
**
ret
,
NdbDictInterface
::
parseTableInfo
(
NdbTableImpl
**
ret
,
const
Uint32
*
data
,
Uint32
len
)
const
Uint32
*
data
,
Uint32
len
,
bool
fullyQualifiedNames
)
{
{
SimplePropertiesLinearReader
it
(
data
,
len
);
SimplePropertiesLinearReader
it
(
data
,
len
);
DictTabInfo
::
Table
tableDesc
;
tableDesc
.
init
();
DictTabInfo
::
Table
tableDesc
;
tableDesc
.
init
();
...
@@ -1096,7 +1097,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
...
@@ -1096,7 +1097,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
return
703
;
return
703
;
}
}
const
char
*
internalName
=
tableDesc
.
TableName
;
const
char
*
internalName
=
tableDesc
.
TableName
;
const
char
*
externalName
=
Ndb
::
externalizeTableName
(
internalName
);
const
char
*
externalName
=
Ndb
::
externalizeTableName
(
internalName
,
fullyQualifiedNames
);
NdbTableImpl
*
impl
=
new
NdbTableImpl
();
NdbTableImpl
*
impl
=
new
NdbTableImpl
();
impl
->
m_tableId
=
tableDesc
.
TableId
;
impl
->
m_tableId
=
tableDesc
.
TableId
;
...
@@ -1125,7 +1126,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
...
@@ -1125,7 +1126,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
if
(
impl
->
m_indexType
==
NdbDictionary
::
Index
::
Undefined
){
if
(
impl
->
m_indexType
==
NdbDictionary
::
Index
::
Undefined
){
}
else
{
}
else
{
const
char
*
externalPrimary
=
const
char
*
externalPrimary
=
Ndb
::
externalizeTableName
(
tableDesc
.
PrimaryTable
);
Ndb
::
externalizeTableName
(
tableDesc
.
PrimaryTable
,
fullyQualifiedNames
);
impl
->
m_primaryTable
.
assign
(
externalPrimary
);
impl
->
m_primaryTable
.
assign
(
externalPrimary
);
}
}
...
@@ -1867,7 +1868,7 @@ int
...
@@ -1867,7 +1868,7 @@ int
NdbDictionaryImpl
::
dropIndex
(
NdbIndexImpl
&
impl
,
const
char
*
tableName
)
NdbDictionaryImpl
::
dropIndex
(
NdbIndexImpl
&
impl
,
const
char
*
tableName
)
{
{
const
char
*
indexName
=
impl
.
getName
();
const
char
*
indexName
=
impl
.
getName
();
if
(
tableName
||
Ndb
::
usingFullyQualifiedNames
())
{
if
(
tableName
||
m_ndb
.
usingFullyQualifiedNames
())
{
NdbTableImpl
*
timpl
=
impl
.
m_table
;
NdbTableImpl
*
timpl
=
impl
.
m_table
;
if
(
timpl
==
0
)
{
if
(
timpl
==
0
)
{
...
@@ -2572,14 +2573,13 @@ NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type)
...
@@ -2572,14 +2573,13 @@ NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type)
req
.
requestData
=
0
;
req
.
requestData
=
0
;
req
.
setTableType
(
getKernelConstant
(
type
,
objectTypeMapping
,
0
));
req
.
setTableType
(
getKernelConstant
(
type
,
objectTypeMapping
,
0
));
req
.
setListNames
(
true
);
req
.
setListNames
(
true
);
return
m_receiver
.
listObjects
(
list
,
req
.
requestData
);
return
m_receiver
.
listObjects
(
list
,
req
.
requestData
,
m_ndb
.
usingFullyQualifiedNames
()
);
}
}
int
int
NdbDictionaryImpl
::
listIndexes
(
List
&
list
,
const
char
*
tableName
)
NdbDictionaryImpl
::
listIndexes
(
List
&
list
,
const
char
*
tableName
)
{
{
ListTablesReq
ListTablesReq
req
;
req
;
NdbTableImpl
*
impl
=
getTable
(
tableName
);
NdbTableImpl
*
impl
=
getTable
(
tableName
);
if
(
impl
==
0
)
if
(
impl
==
0
)
return
-
1
;
return
-
1
;
...
@@ -2587,12 +2587,12 @@ NdbDictionaryImpl::listIndexes(List& list, const char * tableName)
...
@@ -2587,12 +2587,12 @@ NdbDictionaryImpl::listIndexes(List& list, const char * tableName)
req
.
setTableId
(
impl
->
m_tableId
);
req
.
setTableId
(
impl
->
m_tableId
);
req
.
setListNames
(
true
);
req
.
setListNames
(
true
);
req
.
setListIndexes
(
true
);
req
.
setListIndexes
(
true
);
return
m_receiver
.
listObjects
(
list
,
req
.
requestData
);
return
m_receiver
.
listObjects
(
list
,
req
.
requestData
,
m_ndb
.
usingFullyQualifiedNames
()
);
}
}
int
int
NdbDictInterface
::
listObjects
(
NdbDictionary
::
Dictionary
::
List
&
list
,
NdbDictInterface
::
listObjects
(
NdbDictionary
::
Dictionary
::
List
&
list
,
Uint32
requestData
)
Uint32
requestData
,
bool
fullyQualifiedNames
)
{
{
NdbApiSignal
tSignal
(
m_reference
);
NdbApiSignal
tSignal
(
m_reference
);
ListTablesReq
*
const
req
=
CAST_PTR
(
ListTablesReq
,
tSignal
.
getDataPtrSend
());
ListTablesReq
*
const
req
=
CAST_PTR
(
ListTablesReq
,
tSignal
.
getDataPtrSend
());
...
@@ -2657,7 +2657,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
...
@@ -2657,7 +2657,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
memcpy
(
indexName
,
&
data
[
pos
],
n
<<
2
);
memcpy
(
indexName
,
&
data
[
pos
],
n
<<
2
);
databaseName
=
Ndb
::
getDatabaseFromInternalName
(
indexName
);
databaseName
=
Ndb
::
getDatabaseFromInternalName
(
indexName
);
schemaName
=
Ndb
::
getSchemaFromInternalName
(
indexName
);
schemaName
=
Ndb
::
getSchemaFromInternalName
(
indexName
);
objectName
=
BaseString
(
Ndb
::
externalizeIndexName
(
indexName
));
objectName
=
BaseString
(
Ndb
::
externalizeIndexName
(
indexName
,
fullyQualifiedNames
));
delete
[]
indexName
;
delete
[]
indexName
;
}
else
if
((
element
.
type
==
NdbDictionary
::
Object
::
SystemTable
)
||
}
else
if
((
element
.
type
==
NdbDictionary
::
Object
::
SystemTable
)
||
(
element
.
type
==
NdbDictionary
::
Object
::
UserTable
))
{
(
element
.
type
==
NdbDictionary
::
Object
::
UserTable
))
{
...
@@ -2665,7 +2665,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
...
@@ -2665,7 +2665,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
memcpy
(
tableName
,
&
data
[
pos
],
n
<<
2
);
memcpy
(
tableName
,
&
data
[
pos
],
n
<<
2
);
databaseName
=
Ndb
::
getDatabaseFromInternalName
(
tableName
);
databaseName
=
Ndb
::
getDatabaseFromInternalName
(
tableName
);
schemaName
=
Ndb
::
getSchemaFromInternalName
(
tableName
);
schemaName
=
Ndb
::
getSchemaFromInternalName
(
tableName
);
objectName
=
BaseString
(
Ndb
::
externalizeTableName
(
tableName
));
objectName
=
BaseString
(
Ndb
::
externalizeTableName
(
tableName
,
fullyQualifiedNames
));
delete
[]
tableName
;
delete
[]
tableName
;
}
}
else
{
else
{
...
...
ndb/src/ndbapi/NdbDictionaryImpl.hpp
View file @
da340ede
...
@@ -283,17 +283,18 @@ public:
...
@@ -283,17 +283,18 @@ public:
int
stopSubscribeEvent
(
class
Ndb
&
ndb
,
NdbEventImpl
&
);
int
stopSubscribeEvent
(
class
Ndb
&
ndb
,
NdbEventImpl
&
);
int
stopSubscribeEvent
(
NdbApiSignal
*
signal
,
LinearSectionPtr
ptr
[
3
]);
int
stopSubscribeEvent
(
NdbApiSignal
*
signal
,
LinearSectionPtr
ptr
[
3
]);
int
listObjects
(
NdbDictionary
::
Dictionary
::
List
&
list
,
Uint32
requestData
);
int
listObjects
(
NdbDictionary
::
Dictionary
::
List
&
list
,
Uint32
requestData
,
bool
fullyQualifiedNames
);
int
listObjects
(
NdbApiSignal
*
signal
);
int
listObjects
(
NdbApiSignal
*
signal
);
NdbTableImpl
*
getTable
(
int
tableId
);
NdbTableImpl
*
getTable
(
int
tableId
,
bool
fullyQualifiedNames
);
NdbTableImpl
*
getTable
(
const
char
*
name
);
NdbTableImpl
*
getTable
(
const
char
*
name
,
bool
fullyQualifiedNames
);
NdbTableImpl
*
getTable
(
class
NdbApiSignal
*
signal
,
NdbTableImpl
*
getTable
(
class
NdbApiSignal
*
signal
,
LinearSectionPtr
ptr
[
3
],
LinearSectionPtr
ptr
[
3
],
Uint32
noOfSections
);
Uint32
noOfSections
,
bool
fullyQualifiedNames
);
static
int
parseTableInfo
(
NdbTableImpl
**
dst
,
static
int
parseTableInfo
(
NdbTableImpl
**
dst
,
const
Uint32
*
data
,
Uint32
len
);
const
Uint32
*
data
,
Uint32
len
,
bool
fullyQualifiedNames
);
NdbError
&
m_error
;
NdbError
&
m_error
;
private:
private:
...
@@ -601,7 +602,7 @@ NdbDictionaryImpl::getTableImpl(const char * internalTableName)
...
@@ -601,7 +602,7 @@ NdbDictionaryImpl::getTableImpl(const char * internalTableName)
m_globalHash
->
unlock
();
m_globalHash
->
unlock
();
if
(
ret
==
0
){
if
(
ret
==
0
){
ret
=
m_receiver
.
getTable
(
internalTableName
);
ret
=
m_receiver
.
getTable
(
internalTableName
,
m_ndb
.
usingFullyQualifiedNames
()
);
m_globalHash
->
lock
();
m_globalHash
->
lock
();
m_globalHash
->
put
(
internalTableName
,
ret
);
m_globalHash
->
put
(
internalTableName
,
ret
);
...
@@ -624,7 +625,7 @@ NdbIndexImpl *
...
@@ -624,7 +625,7 @@ NdbIndexImpl *
NdbDictionaryImpl
::
getIndex
(
const
char
*
indexName
,
NdbDictionaryImpl
::
getIndex
(
const
char
*
indexName
,
const
char
*
tableName
)
const
char
*
tableName
)
{
{
if
(
tableName
||
Ndb
::
usingFullyQualifiedNames
())
{
if
(
tableName
||
m_ndb
.
usingFullyQualifiedNames
())
{
const
char
*
internalIndexName
=
0
;
const
char
*
internalIndexName
=
0
;
if
(
tableName
)
{
if
(
tableName
)
{
NdbTableImpl
*
t
=
getTable
(
tableName
);
NdbTableImpl
*
t
=
getTable
(
tableName
);
...
...
ndb/src/ndbapi/Ndbinit.cpp
View file @
da340ede
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include "NdbApiSignal.hpp"
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
#include "NdbImpl.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbSchemaOp.hpp"
...
@@ -92,6 +94,8 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
...
@@ -92,6 +94,8 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
theNdbBlockNumber
(
-
1
),
theNdbBlockNumber
(
-
1
),
theInitState
(
NotConstructed
)
theInitState
(
NotConstructed
)
{
{
fullyQualifiedNames
=
true
;
cgetSignals
=
0
;
cgetSignals
=
0
;
cfreeSignals
=
0
;
cfreeSignals
=
0
;
cnewSignals
=
0
;
cnewSignals
=
0
;
...
@@ -126,10 +130,10 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
...
@@ -126,10 +130,10 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
uint
schema_len
=
uint
schema_len
=
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
MIN
(
strlen
(
theDataBaseSchema
),
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
strncpy
(
prefixName
,
theDataBase
,
NDB_MAX_DATABASE_NAME_SIZE
-
1
);
prefixName
[
db_len
]
=
'/'
;
prefixName
[
db_len
]
=
table_name_separator
;
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
strncpy
(
prefixName
+
db_len
+
1
,
theDataBaseSchema
,
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
NDB_MAX_SCHEMA_NAME_SIZE
-
1
);
prefixName
[
db_len
+
schema_len
+
1
]
=
'/'
;
prefixName
[
db_len
+
schema_len
+
1
]
=
table_name_separator
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixName
[
db_len
+
schema_len
+
2
]
=
'\0'
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
prefixEnd
=
prefixName
+
db_len
+
schema_len
+
2
;
...
...
ndb/src/rep/adapters/AppNDB.cpp
View file @
da340ede
...
@@ -50,9 +50,10 @@ void
...
@@ -50,9 +50,10 @@ void
AppNDB
::
init
(
const
char
*
connectString
)
{
AppNDB
::
init
(
const
char
*
connectString
)
{
// NdbThread_SetConcurrencyLevel(1+ 2);
// NdbThread_SetConcurrencyLevel(1+ 2);
Ndb
::
useFullyQualifiedNames
(
false
);
m_ndb
=
new
Ndb
(
""
);
m_ndb
=
new
Ndb
(
""
);
m_ndb
->
useFullyQualifiedNames
(
false
);
m_ndb
->
setConnectString
(
connectString
);
m_ndb
->
setConnectString
(
connectString
);
/**
/**
* @todo Set proper max no of transactions?? needed?? Default 12??
* @todo Set proper max no of transactions?? needed?? Default 12??
...
@@ -539,7 +540,8 @@ AppNDB::prepareMetaRecord(MetaRecord* mr) {
...
@@ -539,7 +540,8 @@ AppNDB::prepareMetaRecord(MetaRecord* mr) {
NdbTableImpl
*
tmp
=
0
;
NdbTableImpl
*
tmp
=
0
;
NdbDictionary
::
Table
*
table
=
0
;
NdbDictionary
::
Table
*
table
=
0
;
Uint32
*
data
=
(
Uint32
*
)(
((
char
*
)
mr
+
sizeof
(
Uint32
)
*
6
));
Uint32
*
data
=
(
Uint32
*
)(
((
char
*
)
mr
+
sizeof
(
Uint32
)
*
6
));
int
res
=
NdbDictInterface
::
parseTableInfo
(
&
tmp
,
data
,
mr
->
dataLen
);
int
res
=
NdbDictInterface
::
parseTableInfo
(
&
tmp
,
data
,
mr
->
dataLen
,
m_ndb
->
usingFullyQualifiedNames
());
if
(
res
==
0
)
{
if
(
res
==
0
)
{
table
=
tmp
;
table
=
tmp
;
return
table
;
return
table
;
...
...
ndb/src/rep/state/Channel.cpp
View file @
da340ede
...
@@ -273,7 +273,7 @@ Channel::addTable(const char * tableName)
...
@@ -273,7 +273,7 @@ Channel::addTable(const char * tableName)
if
(
strlen
(
tableName
)
>
MAX_TAB_NAME_SIZE
)
if
(
strlen
(
tableName
)
>
MAX_TAB_NAME_SIZE
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
/**
/**
* No of separators are the number of
'/'
found in tableName
* No of separators are the number of
table_name_separator
found in tableName
* since a table is defined as <db>/<schema>/tablename.
* since a table is defined as <db>/<schema>/tablename.
* if noOfSeparators is not equal to 2, then it is not a valid
* if noOfSeparators is not equal to 2, then it is not a valid
* table name.
* table name.
...
@@ -282,7 +282,7 @@ Channel::addTable(const char * tableName)
...
@@ -282,7 +282,7 @@ Channel::addTable(const char * tableName)
if
(
strlen
(
tableName
)
<
5
)
if
(
strlen
(
tableName
)
<
5
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
for
(
Uint32
i
=
0
;
i
<
strlen
(
tableName
);
i
++
)
for
(
Uint32
i
=
0
;
i
<
strlen
(
tableName
);
i
++
)
if
(
tableName
[
i
]
==
'/'
)
if
(
tableName
[
i
]
==
table_name_separator
)
noOfSeps
++
;
noOfSeps
++
;
if
(
noOfSeps
!=
2
)
if
(
noOfSeps
!=
2
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
...
@@ -301,7 +301,7 @@ Channel::removeTable(const char * tableName)
...
@@ -301,7 +301,7 @@ Channel::removeTable(const char * tableName)
if
(
strlen
(
tableName
)
>
MAX_TAB_NAME_SIZE
)
if
(
strlen
(
tableName
)
>
MAX_TAB_NAME_SIZE
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
/**
/**
* No of separators are the number of
'/'
found in tableName
* No of separators are the number of
table_name_separator
found in tableName
* since a table is defined as <db>/<schema>/tablename.
* since a table is defined as <db>/<schema>/tablename.
* If noOfSeparators is not equal to 2,
* If noOfSeparators is not equal to 2,
* then it is not a valid table name.
* then it is not a valid table name.
...
@@ -310,7 +310,7 @@ Channel::removeTable(const char * tableName)
...
@@ -310,7 +310,7 @@ Channel::removeTable(const char * tableName)
if
(
strlen
(
tableName
)
<
5
)
if
(
strlen
(
tableName
)
<
5
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
for
(
Uint32
i
=
0
;
i
<
strlen
(
tableName
);
i
++
)
for
(
Uint32
i
=
0
;
i
<
strlen
(
tableName
);
i
++
)
if
(
tableName
[
i
]
==
'/'
)
if
(
tableName
[
i
]
==
table_name_separator
)
noOfSeps
++
;
noOfSeps
++
;
if
(
noOfSeps
!=
2
)
if
(
noOfSeps
!=
2
)
return
GrepError
::
REP_NOT_PROPER_TABLE
;
return
GrepError
::
REP_NOT_PROPER_TABLE
;
...
...
ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
View file @
da340ede
...
@@ -74,16 +74,13 @@ int main(int argc, const char** argv){
...
@@ -74,16 +74,13 @@ int main(int argc, const char** argv){
if
(
table
==
0
)
if
(
table
==
0
)
return
NDBT_ProgramExit
(
NDBT_WRONGARGS
);
return
NDBT_ProgramExit
(
NDBT_WRONGARGS
);
Ndb
::
useFullyQualifiedNames
(
false
);
Ndb
*
m_ndb
=
new
Ndb
(
""
);
Ndb
*
m_ndb
=
new
Ndb
(
""
);
m_ndb
->
useFullyQualifiedNames
(
false
);
m_ndb
->
setConnectString
(
connectString
);
m_ndb
->
setConnectString
(
connectString
);
Ndb
::
useFullyQualifiedNames
(
false
);
/**
/**
* @todo Set proper max no of transactions?? needed?? Default 12??
* @todo Set proper max no of transactions?? needed?? Default 12??
*/
*/
m_ndb
->
init
(
2048
);
m_ndb
->
init
(
2048
);
Ndb
::
useFullyQualifiedNames
(
false
);
if
(
m_ndb
->
waitUntilReady
()
!=
0
){
if
(
m_ndb
->
waitUntilReady
()
!=
0
){
ndbout_c
(
"NDB Cluster not ready for connections"
);
ndbout_c
(
"NDB Cluster not ready for connections"
);
}
}
...
...
ndb/tools/list_tables/listTables.cpp
View file @
da340ede
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
static
Ndb
*
ndb
=
0
;
static
Ndb
*
ndb
=
0
;
static
NdbDictionary
::
Dictionary
*
dic
=
0
;
static
NdbDictionary
::
Dictionary
*
dic
=
0
;
static
int
_unqualified
=
0
;
static
void
static
void
fatal
(
char
const
*
fmt
,
...)
fatal
(
char
const
*
fmt
,
...)
...
@@ -59,7 +60,7 @@ list(const char * tabname,
...
@@ -59,7 +60,7 @@ list(const char * tabname,
if
(
dic
->
listIndexes
(
list
,
tabname
)
==
-
1
)
if
(
dic
->
listIndexes
(
list
,
tabname
)
==
-
1
)
fatal
(
"listIndexes"
);
fatal
(
"listIndexes"
);
}
}
if
(
Ndb
::
usingFullyQualifiedNames
())
if
(
ndb
->
usingFullyQualifiedNames
())
ndbout_c
(
"%-5s %-20s %-8s %-7s %-12s %-8s %s"
,
"id"
,
"type"
,
"state"
,
"logging"
,
"database"
,
"schema"
,
"name"
);
ndbout_c
(
"%-5s %-20s %-8s %-7s %-12s %-8s %s"
,
"id"
,
"type"
,
"state"
,
"logging"
,
"database"
,
"schema"
,
"name"
);
else
else
ndbout_c
(
"%-5s %-20s %-8s %-7s %s"
,
"id"
,
"type"
,
"state"
,
"logging"
,
"name"
);
ndbout_c
(
"%-5s %-20s %-8s %-7s %s"
,
"id"
,
"type"
,
"state"
,
"logging"
,
"name"
);
...
@@ -137,7 +138,7 @@ list(const char * tabname,
...
@@ -137,7 +138,7 @@ list(const char * tabname,
break
;
break
;
}
}
}
}
if
(
Ndb
::
usingFullyQualifiedNames
())
if
(
ndb
->
usingFullyQualifiedNames
())
ndbout_c
(
"%-5d %-20s %-8s %-7s %-12s %-8s %s"
,
elt
.
id
,
type
,
state
,
store
,
(
elt
.
database
)
?
elt
.
database
:
""
,
(
elt
.
schema
)
?
elt
.
schema
:
""
,
elt
.
name
);
ndbout_c
(
"%-5d %-20s %-8s %-7s %-12s %-8s %s"
,
elt
.
id
,
type
,
state
,
store
,
(
elt
.
database
)
?
elt
.
database
:
""
,
(
elt
.
schema
)
?
elt
.
schema
:
""
,
elt
.
name
);
else
else
ndbout_c
(
"%-5d %-20s %-8s %-7s %s"
,
elt
.
id
,
type
,
state
,
store
,
elt
.
name
);
ndbout_c
(
"%-5d %-20s %-8s %-7s %s"
,
elt
.
id
,
type
,
state
,
store
,
elt
.
name
);
...
@@ -148,7 +149,6 @@ int main(int argc, const char** argv){
...
@@ -148,7 +149,6 @@ int main(int argc, const char** argv){
int
_loops
=
1
;
int
_loops
=
1
;
const
char
*
_tabname
=
NULL
;
const
char
*
_tabname
=
NULL
;
const
char
*
_dbname
=
"TEST_DB"
;
const
char
*
_dbname
=
"TEST_DB"
;
int
_unqualified
=
0
;
int
_type
=
0
;
int
_type
=
0
;
int
_help
=
0
;
int
_help
=
0
;
...
...
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