last go at enabling using const NdbDictionary didn't work

+ some docs update on events
parent 79fb236b
...@@ -72,7 +72,7 @@ int main() ...@@ -72,7 +72,7 @@ int main()
} }
// Optionally connect and wait for the storage nodes (ndbd's) // Optionally connect and wait for the storage nodes (ndbd's)
if (cluster_connection.wait_until_ready(30,30)) if (cluster_connection.wait_until_ready(30,0) < 0)
{ {
std::cout << "Cluster was not ready within 30 secs.\n"; std::cout << "Cluster was not ready within 30 secs.\n";
exit(-1); exit(-1);
...@@ -92,7 +92,6 @@ int main() ...@@ -92,7 +92,6 @@ int main()
run_application(mysql, cluster_connection); run_application(mysql, cluster_connection);
} }
// ndb_end should not be called until all "Ndb" objects are deleted
ndb_end(0); ndb_end(0);
std::cout << "\nTo drop created table use:\n" std::cout << "\nTo drop created table use:\n"
......
...@@ -901,21 +901,32 @@ public: ...@@ -901,21 +901,32 @@ public:
*/ */
class Event : public Object { class Event : public Object {
public: public:
enum TableEvent { TE_INSERT=1, TE_DELETE=2, TE_UPDATE=4, TE_ALL=7 }; enum TableEvent {
TE_INSERT=1, ///< Insert event on table
TE_DELETE=2, ///< Delete event on table
TE_UPDATE=4, ///< Update event on table
TE_ALL=7 ///< Any/all event on table (not relevant when
///< events are received)
};
enum EventDurability { enum EventDurability {
ED_UNDEFINED = 0, ED_UNDEFINED
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
= 0
#endif
#if 0 // not supported #if 0 // not supported
ED_SESSION = 1, ,ED_SESSION = 1,
// Only this API can use it // Only this API can use it
// and it's deleted after api has disconnected or ndb has restarted // and it's deleted after api has disconnected or ndb has restarted
ED_TEMPORARY = 2, ED_TEMPORARY = 2
// All API's can use it, // All API's can use it,
// But's its removed when ndb is restarted // But's its removed when ndb is restarted
#endif #endif
ED_PERMANENT = 3 ,ED_PERMANENT ///< All API's can use it,
// All API's can use it, ///< It's still defined after a restart
// It's still defined after a restart #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
= 3
#endif
}; };
Event(const char *name); Event(const char *name);
...@@ -1010,7 +1021,7 @@ public: ...@@ -1010,7 +1021,7 @@ public:
* Fetch list of all objects, optionally restricted to given type. * Fetch list of all objects, optionally restricted to given type.
*/ */
int listObjects(List & list, Object::Type type = Object::TypeUndefined); int listObjects(List & list, Object::Type type = Object::TypeUndefined);
int listObjects(const List & list, int listObjects(List & list,
Object::Type type = Object::TypeUndefined) const; Object::Type type = Object::TypeUndefined) const;
/** /**
...@@ -1050,7 +1061,7 @@ public: ...@@ -1050,7 +1061,7 @@ public:
* @return 0 if successful, otherwise -1 * @return 0 if successful, otherwise -1
*/ */
int listIndexes(List & list, const char * tableName); int listIndexes(List & list, const char * tableName);
int listIndexes(const List & list, const char * tableName) const; int listIndexes(List & list, const char * tableName) const;
/** @} *******************************************************************/ /** @} *******************************************************************/
/** /**
......
...@@ -824,10 +824,9 @@ NdbDictionary::Dictionary::listObjects(List& list, Object::Type type) ...@@ -824,10 +824,9 @@ NdbDictionary::Dictionary::listObjects(List& list, Object::Type type)
} }
int int
NdbDictionary::Dictionary::listObjects(const List& list, NdbDictionary::Dictionary::listObjects(List& list, Object::Type type) const
Object::Type type) const
{ {
return m_impl.listObjects(*(List*)&list, type); return m_impl.listObjects(list, type);
} }
int int
...@@ -842,10 +841,15 @@ NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName) ...@@ -842,10 +841,15 @@ NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName)
} }
int int
NdbDictionary::Dictionary::listIndexes(const List& list, NdbDictionary::Dictionary::listIndexes(List& list,
const char * tableName) const const char * tableName) const
{ {
return listIndexes(*(List *)&list, tableName); const NdbDictionary::Table* tab= getTable(tableName);
if(tab == 0)
{
return -1;
}
return m_impl.listIndexes(list, tab->getTableId());
} }
const struct NdbError & const struct NdbError &
......
...@@ -101,7 +101,7 @@ int main(int argc, char** argv){ ...@@ -101,7 +101,7 @@ int main(int argc, char** argv){
if (pTab != 0){ if (pTab != 0){
ndbout << (* pTab) << endl; ndbout << (* pTab) << endl;
const NdbDictionary::Dictionary::List list; NdbDictionary::Dictionary::List list;
if (dict->listIndexes(list, argv[i]) != 0){ if (dict->listIndexes(list, argv[i]) != 0){
ndbout << argv[i] << ": " << dict->getNdbError() << endl; ndbout << argv[i] << ": " << dict->getNdbError() << endl;
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
static Ndb_cluster_connection *ndb_cluster_connection= 0; static Ndb_cluster_connection *ndb_cluster_connection= 0;
static Ndb* ndb = 0; static Ndb* ndb = 0;
static NdbDictionary::Dictionary * dic = 0; static const NdbDictionary::Dictionary * dic = 0;
static int _unqualified = 0; static int _unqualified = 0;
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment