Skip to content
Snippets Groups Projects
Commit 056ba128 authored by Marc G. Fournier's avatar Marc G. Fournier
Browse files

Updating and addign files...
parent fd0366e1
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "CosQueryCollection.idl" #include "CosQueryCollection.idl"
#endif #endif
#pragma prefix ""
module PostgreSQL { module PostgreSQL {
// Built-in types // Built-in types
...@@ -26,7 +28,7 @@ module PostgreSQL { ...@@ -26,7 +28,7 @@ module PostgreSQL {
typedef boolean Null; typedef boolean Null;
union Value switch (Null) { union Value switch (Null) {
case false: any value; case FALSE: any value;
}; };
...@@ -61,11 +63,26 @@ module PostgreSQL { ...@@ -61,11 +63,26 @@ module PostgreSQL {
// I'm not sure yet about LOCK and UNLOCK. // I'm not sure yet about LOCK and UNLOCK.
// </info> // </info>
// Expirable object
interface Expirable {
/* oneway? */ void keepalive();
void remove();
};
// Upcall object
interface Upcall {
void notice(in string message);
void abort();
};
// Connected database object // Connected database object
interface Database : CosQuery::QueryableCollection { interface Database : CosQuery::QueryableCollection, Expirable {
void disconnect(); void setupcall(in Upcall obj);
}; };
......
// Internal interfaces
#include "pgsql.idl"
module PostgreSQL {
interface QueryResult : CosQueryCollection::Collection, Expirable {};
};
#include <iostream>
#include "pgsql_int.h"
bool terminate = false;
int main(int argc, char *argv)
{
CORBA::ORB_var orb = CORBA::ORB_init(argc,argv,"");
PortableManager::POA_var poa = PortableServer::POA::_narrow(orb->resolve_initial_references("RootPOA"));
PortableManager::POAManager_var mgr = poa->the_POAManager();
Server_impl *server = new Server_impl;
poa->activate_object(server);
CosNaming::NamingContext_var ctx = CosNaming::NamingContext::_narrow(orb->resolve_initial_references("NamingService"));
CosNaming::Name_var n = new CosNaming::Name(1);
n[0].id("PostgreSQL");
n[0].name("service");
bool bindok = false;
if (!CORBA::Object::is_nil(ctx)) {
try {
CosNaming::NamingContext_var myctx = ctx->bind_new_context(n);
CosNaming::Name_var n2 = new CosNaming::Name(1);
n2[0].id("Server");
n2[0].name("Server");
myctx->bind(n2,server->_this());
bindok = true;
} catch (CORBA::Exception &e) {
cerr << "Warning: Naming Service bind failed" << endl;
bindok = false;
}
} else {
cerr << "Warning: Naming Service not found" << endl;
}
mgr->activate();
while (!terminate) {
if (orb->work_pending())
orb->perform_work();
if (expiry_needed())
expire_now();
}
if (!CORBA::Object::is_nil(ctx) && bindok) {
try {
CosNaming::NamingContext myctx = ctx->resolve(n);
ctx->unbind(n);
myctx->destroy();
} catch (CORBA::Exception &e) {
cerr << "Warning: Naming Service unbind failed" << endl;
}
}
orb->shutdown(true);
delete server;
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment