Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit056ba12

Browse files
committed
Updating and addign files...
1 parentfd0366e commit056ba12

File tree

3 files changed

+162
-79
lines changed

3 files changed

+162
-79
lines changed

‎src/corba/pgsql.idl‎

Lines changed: 96 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,96 @@
1-
#ifndef pgsql_idl
2-
#define pgsql_idl
3-
4-
#ifndef CosQuery_idl
5-
#include "CosQuery.idl"
6-
#endif
7-
8-
#ifndef CosQueryCollection_idl
9-
#include "CosQueryCollection.idl"
10-
#endif
11-
12-
module PostgreSQL {
13-
14-
// Built-in types
15-
16-
module Types {
17-
// Arrays in network order
18-
typedef short int2;
19-
typedef long int4;
20-
typedef long int8[2];
21-
};
22-
23-
24-
// NULL support
25-
26-
typedef boolean Null;
27-
28-
union Value switch (Null) {
29-
case false: any value;
30-
};
31-
32-
33-
// Row definition
34-
35-
typedef sequence<Value> Row;
36-
37-
// <info>
38-
// More about the application of COSS:
39-
//
40-
// A Table will be a QueryableCollection of Rows
41-
// A Database will be a QueryableCollection of Tables
42-
// (Currently Tables are not exported... maybe later.)
43-
// Both will be queryable via the Query Service
44-
//
45-
// Other relations will be representable using the Relationship Service
46-
// This includes primary/foreign keys and anything else :)
47-
//
48-
// GRANT/REVOKE can be supplied via the Security Service
49-
//
50-
// See a pattern here? The whole of SQL can be implemented by these services!
51-
// The statements go through a parser. Queries and subqueries are passed to the
52-
// database for processing. Returned items are handled appropriately:
53-
//
54-
// SELECT: return the items to the caller
55-
// UPDATE: modify the items (direct)
56-
// DELETE: call delete() on each Row (direct)
57-
// GRANT/REVOKE: modify ACLs (via Security Service)
58-
// ALTER: modify the items (direct) and/or the relations (via Relationship Service)
59-
// etc.
60-
//
61-
// I'm not sure yet about LOCK and UNLOCK.
62-
// </info>
63-
64-
65-
// Connected database object
66-
67-
interface Database : CosQuery::QueryableCollection {
68-
void disconnect();
69-
};
70-
71-
72-
// Server object (stateless)
73-
74-
interface Server {
75-
Database connect(in string db, in string user, in string password);
76-
};
77-
};
78-
79-
#endif // pgsql_idl
1+
#ifndef pgsql_idl
2+
#define pgsql_idl
3+
4+
#ifndef CosQuery_idl
5+
#include "CosQuery.idl"
6+
#endif
7+
8+
#ifndef CosQueryCollection_idl
9+
#include "CosQueryCollection.idl"
10+
#endif
11+
12+
#pragma prefix ""
13+
14+
module PostgreSQL {
15+
16+
// Built-in types
17+
18+
module Types {
19+
// Arrays in network order
20+
typedef short int2;
21+
typedef long int4;
22+
typedef long int8[2];
23+
};
24+
25+
26+
// NULL support
27+
28+
typedef boolean Null;
29+
30+
union Value switch (Null) {
31+
case FALSE: any value;
32+
};
33+
34+
35+
// Row definition
36+
37+
typedef sequence<Value> Row;
38+
39+
// <info>
40+
// More about the application of COSS:
41+
//
42+
// A Table will be a QueryableCollection of Rows
43+
// A Database will be a QueryableCollection of Tables
44+
// (Currently Tables are not exported... maybe later.)
45+
// Both will be queryable via the Query Service
46+
//
47+
// Other relations will be representable using the Relationship Service
48+
// This includes primary/foreign keys and anything else :)
49+
//
50+
// GRANT/REVOKE can be supplied via the Security Service
51+
//
52+
// See a pattern here? The whole of SQL can be implemented by these services!
53+
// The statements go through a parser. Queries and subqueries are passed to the
54+
// database for processing. Returned items are handled appropriately:
55+
//
56+
// SELECT: return the items to the caller
57+
// UPDATE: modify the items (direct)
58+
// DELETE: call delete() on each Row (direct)
59+
// GRANT/REVOKE: modify ACLs (via Security Service)
60+
// ALTER: modify the items (direct) and/or the relations (via Relationship Service)
61+
// etc.
62+
//
63+
// I'm not sure yet about LOCK and UNLOCK.
64+
// </info>
65+
66+
// Expirable object
67+
68+
interface Expirable {
69+
/* oneway? */ void keepalive();
70+
void remove();
71+
};
72+
73+
74+
// Upcall object
75+
76+
interface Upcall {
77+
void notice(in string message);
78+
void abort();
79+
};
80+
81+
82+
// Connected database object
83+
84+
interface Database : CosQuery::QueryableCollection, Expirable {
85+
void setupcall(in Upcall obj);
86+
};
87+
88+
89+
// Server object (stateless)
90+
91+
interface Server {
92+
Database connect(in string db, in string user, in string password);
93+
};
94+
};
95+
96+
#endif // pgsql_idl

‎src/corba/pgsql_int.idl‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Internal interfaces
2+
3+
#include "pgsql.idl"
4+
5+
module PostgreSQL {
6+
interface QueryResult : CosQueryCollection::Collection, Expirable {};
7+
};

‎src/corba/server.cc‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include<iostream>
2+
#include"pgsql_int.h"
3+
4+
bool terminate =false;
5+
6+
intmain(int argc,char *argv)
7+
{
8+
CORBA::ORB_var orb =CORBA::ORB_init(argc,argv,"");
9+
PortableManager::POA_var poa =PortableServer::POA::_narrow(orb->resolve_initial_references("RootPOA"));
10+
PortableManager::POAManager_var mgr = poa->the_POAManager();
11+
12+
Server_impl *server =new Server_impl;
13+
poa->activate_object(server);
14+
15+
CosNaming::NamingContext_var ctx =CosNaming::NamingContext::_narrow(orb->resolve_initial_references("NamingService"));
16+
CosNaming::Name_var n =newCosNaming::Name(1);
17+
n[0].id("PostgreSQL");
18+
n[0].name("service");
19+
bool bindok =false;
20+
21+
if (!CORBA::Object::is_nil(ctx)) {
22+
try {
23+
CosNaming::NamingContext_var myctx = ctx->bind_new_context(n);
24+
CosNaming::Name_var n2 =newCosNaming::Name(1);
25+
n2[0].id("Server");
26+
n2[0].name("Server");
27+
myctx->bind(n2,server->_this());
28+
bindok =true;
29+
}catch (CORBA::Exception &e) {
30+
cerr <<"Warning: Naming Service bind failed" << endl;
31+
bindok =false;
32+
}
33+
}else {
34+
cerr <<"Warning: Naming Service not found" << endl;
35+
}
36+
37+
mgr->activate();
38+
while (!terminate) {
39+
if (orb->work_pending())
40+
orb->perform_work();
41+
if (expiry_needed())
42+
expire_now();
43+
}
44+
45+
if (!CORBA::Object::is_nil(ctx) && bindok) {
46+
try {
47+
CosNaming::NamingContext myctx = ctx->resolve(n);
48+
ctx->unbind(n);
49+
myctx->destroy();
50+
}catch (CORBA::Exception &e) {
51+
cerr <<"Warning: Naming Service unbind failed" << endl;
52+
}
53+
}
54+
55+
orb->shutdown(true);
56+
57+
delete server;
58+
return0;
59+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp