Hi.

--On 30.07.2002 10:36 +0900 Sergei Dolmatov wrote:

>> >  - extra1: varchar(64000) instead of varchar(255)
>> Don't see any sense, use parameters for that.
>> 
> 
> Unfortunately, parameter fields (name and value) are varchar(255) too.
> Sometimes it isn't enough. Of course, we can create topic "cache" and
> use articles in it to store data, but it isn't very beautiful solution
> :)

What you can do is store other longtext data as plain/text attachments
to the object in question. I wrote such code once, it is not much load
and could be automated in a similar way like this:


http://www.nathan-syntronics.de/midgard/snippets/mgd_xxx_custom_fields_
param.html

Use this as a helper:

function mgd_save_var_as_attachment($object, $var, $name) {
  $att = $object->getattachment($name);
  
  if (!$att)
    $att = $object->createattachment($name, "mgd_save_var of $name",
      "text/plain");
  
  if (!$att)
    return false;
  
  $h_att = $object->openattachment($name);
  
  if (!$h_att)
    return false;
  
  $result = fwrite ($h_att, $var);
  
  if ($result == -1)
    return false;
  
  if (!fclose ($h_att))
    return false;
  
  return true;
}

function mgd_load_var_from_attachment($object, $name) {
  $att = $object->getattachment ($name);
  if (!$att)
    return false;
  
  $h_att = $object->openattachment($name, "r");
  
  if (!$h_att)
    return false;
  
  $stats = mgd_stat_attachment ($att->id);
  
  $result = fread ($h_att, $stats[7]);
  
  fclose ($h_att);
  return $result;
}



Live long and prosper!
Torben Nehmer

--
Torben Nehmer, Munich, Germany
http://www.nathan-syntronics.de, mailto:[EMAIL PROTECTED]
PGP Public Key ID on wwwkeys.(de.)pgp.net: 0x7E9DE456

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to