RE: [sqlite] sqlite_encode_binary problems

From: Date: Sat, 03 Jan 2004 03:45:50 +0000
Subject: RE: [sqlite] sqlite_encode_binary problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173669@lists.php.net to get a copy of this message
I do not know solution to your problem, but is it possible for u to use BASE64 coding to convert binary file into text file and save it as test field? Brona > -----Original Message----- > From: John Scott [mailto:fongmart@yahoo.com.tw] > Sent: Friday, January 02, 2004 2:35 PM > To: sqlite-users@sqlite.org > Subject: [sqlite] sqlite_encode_binary problems > > > Hi folks, > > I want to use sqlite_encode_binary to encode zip files into > sqlite databse. But somehow I don't get the wanted result of this > procedure. > Can someone tell me where i made a mistake?? > > > Encoding: > > wxFFile *load_file = new wxFFile(); > load_file->Open("pc.zip", "rb"); > size_t size = load_file->Length(); > > char in[size]; > unsigned long nLoadSize = load_file->Read((void *)in, size); > unsigned char out[2 +(257*nLoadSize)/254]; > sqlite_encode_binary((const unsigned char*)in, > 257*nLoadSize)/254, (unsigned char*)out); > > Decoding: > > query_result->Execute("select * from file where ID = '1'); > const char* binary = query_result->GetField(0, 2); > const char* out; > int nSize = strlen(binary); > unsigned char out[nSize]; > sqlite_decode_binary((const unsigned char*)binary, (unsigned char*)out); > > Result: > > The zip file is broken. > > > Please help me, > best regardes > Martin > > > > > --------------------------------- > 每天都 Yahoo!奇摩 > 海的顏色、風的氣息、愛你的溫度,盡在信紙底圖 > 信紙底圖

« previous php.general (#173669) next »