8 |
|
|
9 |
|
#include <dbi/connection.hpp> |
10 |
|
#include <dbi/driver.hpp> |
11 |
+ |
#include <dbi/resultset.hpp> |
12 |
|
|
13 |
|
#include "Blog.hpp" |
14 |
|
|
21 |
|
|
22 |
|
void Blog::Entries(const api::Path &directory, const cse::String &base) |
23 |
|
{ |
24 |
+ |
{ |
25 |
+ |
cse::String blog(client.GetProperty(_B("GoogleTron:Blog"), directory.GetPath())); |
26 |
+ |
|
27 |
+ |
if (blog != _B("MovableType")) |
28 |
+ |
throw ext::NotImplementedException(_S<ios::String>(_B("unknown blog ")) << blog); |
29 |
+ |
} |
30 |
+ |
|
31 |
|
_R<dbi::Driver> driver(dbi::GetDriver(client.GetProperty(_B("GoogleTron:Driver"), directory.GetPath()))); |
32 |
|
_R<dbi::Connection> connection(driver->Connect(client.GetProperty(_B("GoogleTron:Host"), directory.GetPath()), client.GetProperty(_B("GoogleTron:User"), directory.GetPath()), GetPassword(directory), client.GetProperty(_B("GoogleTron:Database"), directory.GetPath()))); |
33 |
+ |
int32_t id; |
34 |
+ |
|
35 |
+ |
{ |
36 |
+ |
_R<dbi::ResultSet> set(connection->Parse(_B("SELECT blog_id FROM mt_blog WHERE blog_site_url = ?"))->Execute(base)); |
37 |
+ |
|
38 |
+ |
if (set->MoveNext()) |
39 |
+ |
id = set->Get<int32_t>(0); |
40 |
+ |
else |
41 |
+ |
throw ext::StringException(_S<ios::String>("no blog ") << base); |
42 |
+ |
} |
43 |
|
} |