Skip to content

Commit

Permalink
upgrade to mongo-c-driver 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
gerald-lindsly committed Dec 22, 2012
1 parent 7ae20bf commit afd4441
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 27 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
x64/
Debug/
Release/
Release64/
ipch/
bson.c
bson.h
Expand All @@ -12,11 +13,9 @@ md5.c
md5.h
mongo.c
mongo.h
net.c
net.h
env.c
env.h
numbers.c
platform/
platform.h
MongoMatlabDriver.dll
MongoMatlabDriver.exp
MongoMatlabDriver.lib
Expand Down
4 changes: 2 additions & 2 deletions BsonIterator.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
function t = type(i)
% t = i.type() Returns the type of the field pointed to by this iterator. See BsonType.
if isempty(i.h) || isNull(i.h)
t = BsonType.EOO
t = BsonType.EOO;
else
t = BsonType(calllib('MongoMatlabDriver', 'mongo_bson_iterator_type', i.h));
end
Expand All @@ -44,7 +44,7 @@
% display(i.value());
% end
if isempty(i.h) || isNull(i.h)
t = BsonType.EOO
t = BsonType.EOO;
else
t = BsonType(calllib('MongoMatlabDriver', 'mongo_bson_iterator_next', i.h));
end
Expand Down
4 changes: 2 additions & 2 deletions DllMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
#include "bson.h"
#include <mex.h>

extern int mongo_sock_init();
extern int mongo_env_sock_init();

bson empty_bson;

int main(void)
{
mongo_sock_init();
mongo_env_sock_init();
bson_empty(&empty_bson);
bson_printf = mexPrintf;
bson_errprintf = mexPrintf;
Expand Down
2 changes: 1 addition & 1 deletion MongoMatlabDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef long long mxint64;

#include <matrix.h>

#include "platform.h"
#include "bson.h"

/* Define dummy structures for the interface with Matlab.
Provides a level of abstraction and hides the details
Expand Down
4 changes: 2 additions & 2 deletions MongoMatlabDriver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Global
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Debug|Win32.Build.0 = Debug|Win32
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Debug|x64.ActiveCfg = Debug|x64
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Debug|x64.Build.0 = Debug|x64
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|Win32.ActiveCfg = Release|Win32
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|Win32.Build.0 = Release|Win32
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|Win32.ActiveCfg = Release|x64
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|Win32.Build.0 = Release|x64
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|x64.ActiveCfg = Release|x64
{0F402EBC-FD55-4FB7-92B1-D1804FE4496E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
Expand Down
5 changes: 2 additions & 3 deletions MongoMatlabDriver.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,20 @@
<ClCompile Include="bson.c" />
<ClCompile Include="DllMain.c" />
<ClCompile Include="encoding.c" />
<ClCompile Include="env.c" />
<ClCompile Include="gridfs.c" />
<ClCompile Include="md5.c" />
<ClCompile Include="mongo.c" />
<ClCompile Include="net.c" />
<ClCompile Include="numbers.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="bson.h" />
<ClInclude Include="encoding.h" />
<ClInclude Include="env.h" />
<ClInclude Include="gridfs.h" />
<ClInclude Include="md5.h" />
<ClInclude Include="mongo.h" />
<ClInclude Include="MongoMatlabDriver.h" />
<ClInclude Include="net.h" />
<ClInclude Include="platform.h" />
</ItemGroup>
<ItemGroup>
<None Include=".gitignore" />
Expand Down
9 changes: 3 additions & 6 deletions MongoMatlabDriver.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
<ClCompile Include="mongo.c">
<Filter>mongo-c-driver-src</Filter>
</ClCompile>
<ClCompile Include="net.c">
<ClCompile Include="numbers.c">
<Filter>mongo-c-driver-src</Filter>
</ClCompile>
<ClCompile Include="numbers.c">
<ClCompile Include="env.c">
<Filter>mongo-c-driver-src</Filter>
</ClCompile>
</ItemGroup>
Expand All @@ -67,10 +67,7 @@
<ClInclude Include="mongo.h">
<Filter>mongo-c-driver-src</Filter>
</ClInclude>
<ClInclude Include="net.h">
<Filter>mongo-c-driver-src</Filter>
</ClInclude>
<ClInclude Include="platform.h">
<ClInclude Include="env.h">
<Filter>mongo-c-driver-src</Filter>
</ClInclude>
</ItemGroup>
Expand Down
Binary file modified MongoMatlabDriver32.dll
Binary file not shown.
Binary file modified MongoMatlabDriver64.dll
Binary file not shown.
12 changes: 6 additions & 6 deletions api_mongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
#include "MongoMatlabDriver.h"
#include "mongo.h"
#include "net.h"
#include "env.h"

#include <mex.h>

Expand All @@ -32,7 +32,7 @@ EXPORT void mmongo_connect(struct mongo_* conn, char* host) {
mongo* conn_ = (mongo*)conn;
mongo_host_port hp;
mongo_parse_host(host, &hp);
if (mongo_connect(conn_, hp.host, hp.port) != MONGO_OK)
if (mongo_client(conn_, hp.host, hp.port) != MONGO_OK)
mexPrintf("Unable to connect to %s:%d, error code = %d\n", hp.host, hp.port, conn_->err);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ EXPORT int mmongo_get_socket(struct mongo_* conn) {

EXPORT mxArray* mongo_get_hosts(struct mongo_* conn) {
mongo* conn_ = (mongo*)conn;
mongo_replset* r = conn_->replset;
mongo_replica_set* r = conn_->replica_set;
mxArray* ret;
mongo_host_port* hp;
int count = 0;
Expand Down Expand Up @@ -239,22 +239,22 @@ EXPORT int mongo_rename(struct mongo_* conn, char* from_ns, char* to_ns) {
EXPORT int mmongo_insert(struct mongo_* conn, char* ns, struct bson_* b) {
mongo* conn_ = (mongo*)conn;
bson* b_ = (bson*)b;
return (mongo_insert(conn_, ns, b_) == MONGO_OK);
return (mongo_insert(conn_, ns, b_, 0) == MONGO_OK);
}


EXPORT int mmongo_update(struct mongo_* conn, char* ns, struct bson_* criteria, struct bson_* objNew, int flags) {
mongo* conn_ = (mongo*)conn;
bson* criteria_ = (bson*) criteria;
bson* objNew_ = (bson*) objNew;
return (mongo_update(conn_, ns, criteria_, objNew_, flags) == MONGO_OK);
return (mongo_update(conn_, ns, criteria_, objNew_, flags, 0) == MONGO_OK);
}


EXPORT int mmongo_remove(struct mongo_* conn, char* ns, struct bson_* criteria) {
mongo* conn_ = (mongo*)conn;
bson* criteria_ = (bson*)criteria;
return (mongo_remove(conn_, ns, criteria_) == MONGO_OK);
return (mongo_remove(conn_, ns, criteria_, 0) == MONGO_OK);
}


Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OBJS=DllMain.o bson.o mongo.o net.o gridfs.o md5.o encoding.o numbers.o api_bson.o api_mongo.o api_gridfs.o
OBJS=DllMain.o bson.o mongo.o env.o gridfs.o md5.o encoding.o numbers.o api_bson.o api_mongo.o api_gridfs.o
CC=gcc-4.3
MATLAB=/usr/local/MATLAB/R2011b
INCPATH=$(MATLAB)/extern/include
Expand Down
Binary file modified mongo-c-driver-src.zip
Binary file not shown.

0 comments on commit afd4441

Please sign in to comment.