From: Mark O'D. <mar...@gm...> - 2008-11-23 11:37:36
|
Hi Adriano I will get back to the bigger picture stuff in a bit, but in the meantime, for nuts and bolts stuff. But just a bit of background, previously in Firebird, I was focusing on small picture stuff, c++ compiler errors - there were lots, compilation dependencies, and build and install issues, putting in readline, or whatever the bsd equivalent was, that sort of thing. I had my hands full, and was happy to leave the engine stuff to someone who had the time to really look at it. I certainly have an strong aversion to changing what I don't understand. I am glad you guys have the opportunity to learn most of the details, and I am happy to piggyback off you to get my fairly trivial function working right. I am certain there are still some things not quite right yet, like the chunking, which I misunderstood, but I am equally sure it wont take too much straightening to get right, and I appreciate the help. So in the vein, just a few answers and questions below. On Sun, Nov 23, 2008 at 12:08 PM, Adriano dos Santos Fernandes <adr...@uo...> wrote: > Mark O'Donohue wrote: >> Hi Adriano >> > This is problematic. We current do this only when it's not possible to > work in chunks. For example, in some operations with MBCS. > a) Sure, I am happy to update what I have to work in chunks, sounds a good idea. > Not sure if we are talking about the same thing... I mean, crypt(blob) > should return a blob, no problem. > But crypt(string) should return a string of *some* length. b) For encrypt(x) it is easy, the return type is based on input type, so text returns text (although unsigned char, charset none, but could be octets), and blob returns blob. And as you said, the return type for text is varchar : length = len(arg[2]) + maxblocksize. The actual eval call will return a string of up to that length. c) In makeEncrypt to build the result I currently have : const dsc* value = args[2]; if (value->isBlob()) { // make blob return type } else (value->isText()) { // make varchar return type len(value) + maxblocksize. } else { ?? now what best to do here, throw an exception? } d) Opps, I had a empty function for setParamsEncrypt() lets rectify that now. setParamsEncrypt() presumably checks the input parameters, I need parameters 1) cypher: [text, 2) key : text, 3 data : blob|text now from other instances of setXXX all I see are: if (argsCount >= 1 && args[0]->isUnknown()) args[0]->makeText(GUID_BODY_SIZE, ttype_ascii); So is this only handling unknown types?, and whats best to do for the three parameters I have (do I need to invent a max size for cypherName and key, can I declare them as varying (there is no sample like that in all the other functions)?, and what about arg[2] do I just check its unknown, or can I enforce its blob|text here? btw: one wonders if it was an ex-pascal programmer who did : if (argsCount >= 1 && args[0]->isUnknown()) :-). > > On v3, we could have variable (dynamic) length parameters and output values. > Maybe I need to look at that, can you give a brief overview, or point me to something ? Cheers - Mark |