Skip to content

Commit

Permalink
change example dub.json & fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuchun committed Sep 10, 2018
1 parent d2b2472 commit 8dc33f9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/mysql/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"authors": ["putao"],
"targetType": "executable",
"dependencies": {
"database": {"path":"../../"}
"hunt-database": {"path":"../../"}
},
"description": "A minimal D application.",
"copyright": "Copyright © 2017, Zhang",
Expand All @@ -12,7 +12,7 @@
{
"name": "default",
"subConfigurations": {
"database": "mysql"
"hunt-database": "mysql"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions examples/mysqlMultiThread/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"authors": ["putao"],
"targetType": "executable",
"dependencies": {
"database": {"path":"../../"}
"hunt-database": {"path":"../../"}
},
"description": "A minimal D application.",
"copyright": "Copyright © 2017, Zhang",
Expand All @@ -12,7 +12,7 @@
{
"name": "default",
"subConfigurations": {
"database": "mysql"
"hunt-database": "mysql"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions examples/postgresql/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"authors": ["putao"],
"targetType": "executable",
"dependencies": {
"database": {"path":"../../"}
"hunt-database": {"path":"../../"}
},
"description": "A minimal D application.",
"copyright": "Copyright © 2017, Zhang",
Expand All @@ -12,7 +12,7 @@
{
"name": "default",
"subConfigurations": {
"database": "postgresql"
"hunt-database": "postgresql"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions examples/sqlite/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"authors": ["putao"],
"targetType": "executable",
"dependencies": {
"database": {"path":"../../"}
"hunt-database": {"path":"../../"}
},
"description": "A minimal D application.",
"copyright": "Copyright ? 2017, Zhang",
Expand All @@ -12,7 +12,7 @@
{
"name": "default",
"subConfigurations": {
"database": "sqlite"
"hunt-database": "sqlite"
}
}
]
Expand Down
Binary file removed hunt-database-test-default
Binary file not shown.
11 changes: 10 additions & 1 deletion source/hunt/database/url.d
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,20 @@ bool tryParseURL(string value, out URL url) {

url.scheme = value[0 .. i - 1];

/// special
if(url.scheme == "sqlite")
{
url.path = value[i + 2 .. $];
return true;
}

value = value[i + 2 .. $];

i = value.indexOf("@");
if( i == -1) // no user or password
{
return false;
}

//user:password
auto userpass = value[0 .. i];
Expand Down Expand Up @@ -167,7 +176,7 @@ unittest {
writeln(parseURL("mysql://root@127.0.0.1:3435/test?charset=utf"));
writeln(parseURL("mysql://root:%324#4543sdf=@127.0.0.1:3435/test?charset=utf"));
writeln(parseURL("postgresql://user@host:123/database"));

writeln(parseURL("sqlite:///./testDB.db"));

}

0 comments on commit 8dc33f9

Please sign in to comment.