added: a new way: HEX format to saving/reading from PostgreSQL bytea columns
added: to Request: // binary page BinaryPage binary_page; // a compressed page ready to send to the client BinaryPage compressed_page; // if true then either page or ajaxpage will be sent to the client // if false then binary_page is sent // default: true bool use_text_page; BinaryPage is defined as (in requesttypes.h): typedef PT::TextStreamBase<char, 1, 4096> BinaryPage; added: to Compress: now it can gets BinaryPage as arguments (input, output) changed: winix version to: 0.5.0 added: in templates: TexTextStream class for taking input to the TeX typesetting system git-svn-id: svn://ttmath.org/publicrep/winix/trunk@884 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -470,8 +470,9 @@ return err;
|
||||
|
||||
/*
|
||||
converting from a bytea
|
||||
the old way (escape format)
|
||||
*/
|
||||
|
||||
/*
|
||||
int DbBase::CharToInt(char c)
|
||||
{
|
||||
return (int)(unsigned char)(c-'0');
|
||||
@@ -537,6 +538,53 @@ size_t i = 0;
|
||||
out += c;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
converting from a bytea
|
||||
the new way (hex format)
|
||||
*/
|
||||
|
||||
|
||||
char DbBase::UnescapeBinHexToDigit(char hex)
|
||||
{
|
||||
if( hex>='0' && hex<='9' )
|
||||
return hex - '0';
|
||||
|
||||
if( hex>='a' && hex<='z' )
|
||||
return hex - 'a' + 10;
|
||||
|
||||
if( hex>='A' && hex<='Z' )
|
||||
return hex - 'A' + 10;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void DbBase::UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out)
|
||||
{
|
||||
if( clear_out )
|
||||
out.clear();
|
||||
|
||||
if( len < 2 || str[0]!='\\' || str[1]!='x' )
|
||||
{
|
||||
log << log1 << "Db: unsupported binary format (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
for(size_t i=2 ; i + 1 < len ; i+=2 )
|
||||
{
|
||||
int c1 = UnescapeBinHexToDigit(str[i]);
|
||||
int c2 = UnescapeBinHexToDigit(str[i+1]);
|
||||
|
||||
out += ((c1 << 4) | c2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
end of converting from bytea
|
||||
|
Reference in New Issue
Block a user