0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

Merge branch 'master' of github.com:mongodb/mongo

This commit is contained in:
Aaron 2010-03-08 16:53:55 -08:00
commit f4170e6a86
3 changed files with 15 additions and 16 deletions

View File

@ -301,6 +301,8 @@ usejvm = not GetOption( "usejvm" ) is None
asio = not GetOption( "asio" ) is None
justClientLib = (COMMAND_LINE_TARGETS == ['mongoclient'])
env = Environment( MSVS_ARCH=msarch , tools = ["default", "gch"], toolpath = '.' )
if GetOption( "cxx" ) is not None:
env["CC"] = GetOption( "cxx" )
@ -332,7 +334,7 @@ if ( usesm and usejvm ):
print( "can't say usesm and usejvm at the same time" )
Exit(1)
if ( not ( usesm or usejvm or usev8 ) ):
if ( not ( usesm or usejvm or usev8 or justClientLib) ):
usesm = True
extraLibPlaces = []
@ -395,7 +397,7 @@ if usesm:
elif usev8:
commonFiles += [ Glob( "scripting/*v8*.cpp" ) ]
nojni = True
elif not nojni:
elif not (nojni or justClientLib) :
commonFiles += [ "scripting/engine_java.cpp" ]
else:
commonFiles += [ "scripting/engine_none.cpp" ]
@ -570,7 +572,7 @@ elif "win32" == os.sys.platform:
env.Append(CPPPATH=["../js/src/"])
env.Append(LIBPATH=["../js/src"])
env.Append( CPPDEFINES=[ "OLDJS" ] )
else:
elif not justClientLib:
javaHome = findVersion( "C:/Program Files/java/" ,
[ "jdk" , "jdk1.6.0_10" ] )
env.Append( CPPPATH=[ javaHome + "/include" , javaHome + "/include/win32" ] )

View File

@ -151,7 +151,7 @@ namespace mongo {
return s.str();
}
string escape( string s ) {
string escape( string s , bool escape_slash=false) {
stringstream ret;
for ( string::iterator i = s.begin(); i != s.end(); ++i ) {
switch ( *i ) {
@ -162,7 +162,7 @@ namespace mongo {
ret << "\\\\";
break;
case '/':
ret << "\\/";
ret << (escape_slash ? "\\/" : "/");
break;
case '\b':
ret << "\\b";
@ -301,17 +301,13 @@ namespace mongo {
s << " )";
break;
case RegEx:
if ( format == Strict )
s << "{ \"$regex\" : \"";
else
s << "/";
s << escape( regex() );
if ( format == Strict )
if ( format == Strict ){
s << "{ \"$regex\" : \"" << escape( regex() );
s << "\", \"$options\" : \"" << regexFlags() << "\" }";
else {
s << "/";
} else {
s << "/" << escape( regex() , true ) << "/";
// FIXME Worry about alpha order?
for ( const char *f = regexFlags(); *f; ++f )
for ( const char *f = regexFlags(); *f; ++f ){
switch ( *f ) {
case 'g':
case 'i':
@ -320,6 +316,7 @@ namespace mongo {
default:
break;
}
}
}
break;

View File

@ -47,7 +47,7 @@ namespace JsonTests {
void run() {
BSONObjBuilder b;
b.append( "a", "\" \\ / \b \f \n \r \t" );
ASSERT_EQUALS( "{ \"a\" : \"\\\" \\\\ \\/ \\b \\f \\n \\r \\t\" }", b.done().jsonString( Strict ) );
ASSERT_EQUALS( "{ \"a\" : \"\\\" \\\\ / \\b \\f \\n \\r \\t\" }", b.done().jsonString( Strict ) );
}
};
@ -304,7 +304,7 @@ namespace JsonTests {
BSONObjBuilder b;
b.appendRegex( "a", "/\"", "i" );
BSONObj built = b.done();
ASSERT_EQUALS( "{ \"a\" : { \"$regex\" : \"\\/\\\"\", \"$options\" : \"i\" } }",
ASSERT_EQUALS( "{ \"a\" : { \"$regex\" : \"/\\\"\", \"$options\" : \"i\" } }",
built.jsonString( Strict ) );
ASSERT_EQUALS( "{ \"a\" : /\\/\\\"/i }", built.jsonString( TenGen ) );
ASSERT_EQUALS( "{ \"a\" : /\\/\\\"/i }", built.jsonString( JS ) );