ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 80 00 00 00 80 08 04 00 00 00 69 37 a9 | .PNG........IHDR.............i7. |
0020 | 40 00 00 00 02 73 42 49 54 08 08 55 ec 46 04 00 00 00 09 70 48 59 73 00 00 03 b1 00 00 03 b1 01 | @....sBIT..U.F.....pHYs......... |
0040 | f5 83 ed 49 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 77 77 77 2e 69 6e 6b 73 63 61 70 | ...I....tEXtSoftware.www.inkscap |
0060 | 65 2e 6f 72 67 9b ee 3c 1a 00 00 06 c1 49 44 41 54 78 01 ed c1 5f 6c 55 85 01 c7 f1 df bd 2d 42 | e.org..<.....IDATx..._lU......-B |
0080 | 69 4b 56 d7 87 31 4c 41 2c c4 41 c2 32 41 fe 2c 1a 13 8d 46 1f 16 26 99 cd 10 14 1c c6 b0 2c 59 | iKV..1LA,.A.2A.,...F..&.......,Y |
00a0 | b6 99 cd 07 37 b3 bd f8 e0 03 0f 8d 2e 8e 2d 4a 22 ca f8 a7 2c ea 83 0f 4d ed 6d 2f 5e fa f7 42 | ....7.........-J"...,...M.m/^..B |
00c0 | 0b fd 77 e9 ff 5a 4a 49 84 b6 b4 5c 42 cf 77 90 60 bc f7 dc 73 db 7b 6e cf bd 3d b5 e7 f3 91 c7 | ..w..ZJI...\B.w.`...s.{n..=..... |
00e0 | e3 f1 78 3c 1e 8f c7 e3 f1 78 3c 1e 8f c7 e3 f1 64 07 6f 70 8e 8b 5c e4 1c 6f 68 e1 a1 94 3e be | ..x<.....x<.....d.op..\..oh...>. |
0100 | d5 47 a9 16 1a 8e 13 eb a8 16 16 8a e8 22 56 17 3f d4 f7 09 3e 7c 9a 06 07 30 3b a0 69 e0 c7 a7 | .G..........."V.?...>|...0;.i... |
0120 | f9 82 1c 7e 4f 3d f5 ec 53 52 d4 60 56 a3 a4 d8 47 3d f5 fc 81 1c b9 1f 6b f8 8a 9b dc 31 c6 29 | ...~O=..SR.`V...G=......k....1.) |
0140 | 0a 65 81 02 7a 30 eb a1 40 16 28 e4 7f 8c 71 c7 4d 4e b3 46 6e 47 23 b1 9a d9 a2 04 6c 25 8a 59 | .e..z0..@.(...q.MN.FnG#.....l%.Y |
0160 | 94 ad 4a c0 56 9a 89 d5 28 b7 a3 85 78 dd 6c 95 09 4f 63 60 66 f0 b4 4c d8 46 37 f1 5a e4 76 84 | ..J.V...(...x.l..Oc`f..L.F7.Z.v. |
0180 | 31 8b b0 56 71 58 c1 25 cc 2e b1 4/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef DATABASE_POSTGRESQL_HEADER
#define DATABASE_POSTGRESQL_HEADER
#include <string>
#include <libpq-fe.h>
#include "database.h"
#include "util/basic_macros.h"
class Settings;
class Database_PostgreSQL : public Database
{
public:
Database_PostgreSQL(const Settings &conf);
~Database_PostgreSQL();
void beginSave();
void endSave();
bool saveBlock(const v3s16 &pos, const std::string &data);
void loadBlock(const v3s16 &pos, std::string *block);
bool deleteBlock(const v3s16 &pos);
void listAllLoadableBlocks(std::vector<v3s16> &dst);
bool initialized() const;
private:
// Database initialization
void connectToDatabase();
void initStatements();
void createDatabase();
inline void prepareStatement(const std::string &name, const std::string &sql)
{
checkResults(PQprepare(m_conn, name.c_str(), sql.c_str(), 0, NULL));
}
// Database connectivity checks
void ping();
void verifyDatabase();
// Database usage
PGresult *checkResults(PGresult *res, bool clear = true);
inline PGresult *execPrepared(const char *stmtName, const int paramsNumber,
const void **params,
const int *paramsLengths = NULL, const int *paramsFormats = NULL,
bool clear = true, bool nobinary = true)
{
return checkResults(PQexecPrepared(m_conn, stmtName, paramsNumber,
(const char* const*) params, paramsLengths, paramsFormats,
nobinary ? 1 : 0), clear);
}
// Conversion helpers
inline int pg_to_int( | It...v..........u.S.>...r;>'...* |
0660 | 0e 11 cc 22 8a c3 83 8c 90 e8 73 b9 1d 01 12 05 14 87 c5 f4 62 d6 cb 62 c5 21 40 a2 80 dc 8e 30 | ..."......s.........b..b.!@....0 |
0680 | 66 9d 3c a0 38 dc c7 30 66 c3 dc a7 38 3c 40 27 66 61 b9 1d 2d c4 bb c8 26 99 f0 0c 06 66 06 cf | f.<.8..0f...8<@'fa..-...&....f.. |
06a0 | c8 84 4d 5c 24 5e 8b dc 8e 06 be 63 10 e6 21 25 60 0b 51 cc a2 6c 51 02 1e 22 8c c1 77 1a e4 76 | ..M\$^.....c..!%`.Q..lQ.."..w..v |
06c0 | ac a2 9a 28 77 5c e3 38 4b 65 81 7c ba 31 eb 26 5f 16 58 ca 71 ae 71 47 94 6a 56 c9 fd f0 f3 0a | ...(w\.8Ke.|.1.&_.X.q.qG.jV..... |
06e0 | 67 08 b1 53 49 51 8d 59 b5 92 62 27 21 ce f0 0a 7e 7d 5f f0 16 66 6f 69 21 61 19 11 62 45 f8 81 | g..SIQ.Y..b'!...~}_..foi!a..bE.. |
0700 | 16 16 3e 22 d6 61 2d 34 dc 4f 2f df ea e5 7e 2d 3c bc 46 13 9d 74 d2 c4 6b f2 78 3c 1e 8f c7 e3 | ..>".a-4.O/...~-<.F..t..k.x<.... |
0720 | f1 78 3c 1e 8f c7 e3 f1 78 3c 9e ac f8 3f 4d 95 ea 96 77 e1 af 91 00 00 00 00 49 45 4e 44 ae 42 | .x<.....x<...?M...w.......IEND.B |
0740 | 60 82 | `. |