From: Adriano d. S. F. <adr...@uo...> - 2008-11-23 15:11:21
|
Mark O'Donohue wrote: > 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. > I think octets is more correct. > 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? > } > See makeRevert: if (value->isBlob()) *result = *value; else result->makeVarying(value->getStringLength(), value->getTextType()); > > 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()) :-). > isUnknow() means a parameter (question mark). And this is where dynamic varchar length for parameters go. Current, things like this does not work: revert(?) But this works: revert(cast(? as varchar(10))) If this is the cast you are talking, it's ok for now. > > >> 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 ? There is nothing proposed yet. Just some discussions of things that we need to extend on SQLDA/VAR. Adriano |