Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[MongoDB] Several fixes so we can create a simple BsonDocument and sa…

…ve it successfully to the DB
  • Loading branch information...
commit 32146e0395d57d96855d76b4cc892bf140166ee2 1 parent a09b843
Andrew Whitworth authored
5 Makefile
View
@@ -1,5 +1,4 @@
all: memcached mysql mongodb
- echo "MAKE ALL"
clean: clean_memcached clean_mongodb clean_mysql
@@ -20,9 +19,7 @@ parrotstore/memcached.pbc: memcached/
## MongoDB
-mongodb: mongodb/*.winxed mongodb/pmc/*.pmc mongodb/include/*.h dynext/mongodb_group.so
-
-dynext/mongodb_group.so:
+mongodb:
winxed setup.winxed mongodb build
clean_mongodb:
1  mongodb/include/ps_mongodb.h
View
@@ -1,6 +1,7 @@
#define STRING_TO_CSTRING(i, s, c, code) do { \
char * (c) = Parrot_str_to_cstring((i), (s)); \
+ fprintf(stderr, "Connecting to server '%s'", (c)); \
{ \
code \
} \
2  mongodb/pmc/bsondocument.pmc
View
@@ -57,7 +57,7 @@ pmclass BsonDocument dynpmc auto_attrs {
);
}
- METHOD append_finish_object(STRING *name)
+ METHOD append_finish_object()
{
bson_append_finish_object(GET_BSON(SELF));
}
8 mongodb/pmc/mongodbcontext.pmc
View
@@ -6,7 +6,7 @@ pmclass MongoDbContext dynpmc auto_attrs {
ATTR void *conn;
VTABLE void init() {
- mongo * conn = (mongo *)malloc(sizeof(conn));
+ mongo * conn = (mongo *)malloc(sizeof(mongo));
PARROT_MONGODBCONTEXT(SELF)->conn = conn;
}
@@ -21,10 +21,8 @@ pmclass MongoDbContext dynpmc auto_attrs {
METHOD connect(STRING * server, INTVAL port)
{
mongo * conn = GET_CONN(SELF);
- INTVAL stat;
- STRING_TO_CSTRING(INTERP, server, cserver, {
- stat = mongo_connect(conn, cserver, port);
- });
+ char * const cserver = Parrot_str_to_cstring(INTERP, server);
+ INTVAL stat = mongo_connect(conn, cserver, port);
if (stat) {
switch(conn->err) {
case MONGO_CONN_NO_SOCKET:
Please sign in to comment.
Something went wrong with that request. Please try again.