ide: rudimentary css highlighting support, PGSQL: support for hex blobs

git-svn-id: svn://ultimatepp.org/upp/trunk@5078 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-06-26 19:13:33 +00:00
commit dd8fb364d3
7 changed files with 48 additions and 10 deletions

View file

@ -371,7 +371,12 @@ bool PostgreSQLSession::Open(const char *connect)
DoKeepAlive();
LLOG( String("Postgresql client encoding: ") + pg_encoding_to_char( PQclientEncoding(conn) ) );
Sql sql(*this);
if(sql.Execute("select setting from pg_settings where name = 'bytea_output'") && sql[0] == "hex")
hex_blobs = true;
return true;
}
@ -627,10 +632,14 @@ void PostgreSQLConnection::GetColumn(int i, Ref f) const
break;
default: {
if(oid[i] == PGSQL_BYTEAOID) {
size_t len;
unsigned char *q = PQunescapeBytea((const unsigned char *)s, &len);
f.SetValue(String(q, len));
PQfreemem(q);
if(session.hex_blobs)
f.SetValue(ScanHexString(s, strlen(s)));
else {
size_t len;
unsigned char *q = PQunescapeBytea((const unsigned char *)s, &len);
f.SetValue(String(q, len));
PQfreemem(q);
}
}
else
f.SetValue(FromCharset(String(s)));

View file

@ -54,6 +54,7 @@ private:
String conns;
bool keepalive;
bool hex_blobs;
void ExecTrans(const char * statement);
Vector<String> EnumData(char type, const char *schema = NULL);
@ -88,7 +89,7 @@ public:
virtual void Rollback();
virtual int GetTransactionLevel() const;
PostgreSQLSession() { conn = NULL; Dialect(PGSQL); level = 0; keepalive = false; }
PostgreSQLSession() { conn = NULL; Dialect(PGSQL); level = 0; keepalive = hex_blobs = false; }
~PostgreSQLSession() { Close(); }
PGconn * GetPGConn() { return conn; }
};