[development] Why is Block table delta field only 32 chars?

Jacob Singh jacob at civicactions.com
Tue Aug 28 07:35:54 UTC 2007


I totally prefer string based deltas.  It's much more maintainable and has no 
real overhead.

Here is my typical module_block:

case "list"
$blocks['list_of_nice_users']['info'] = "Nice Users List"
break;

case 'view':
$function_name = '_mymodule_blocks_' . $delta;
if ( function_exists( $function_name) ) {
  return $function_name();
}
break;

then I have all my functions named nicely, plus I then can just create a 
template file called:

block-mymodule-list_of_nice_users.tpl.php

which makes it much easier to work with themers and other jr. developers than 
having files like block-mymodule-3.tpl.php (wtf is that?).

I don't see how increasing this would impact performance at all.

Best,
Jacob
On Tuesday 28 August 2007 00:27, FGM wrote:
> Actually, most modules use a short integer starting for the deltas, so
> varchar(32) is awfully big for this.
>
> The question is rather: why is it actually a vc32 if all examples in core
> and docs use integer deltas.
>
> ----- Original Message -----
> From: "Jacob Singh" <jacob at civicactions.com>
> To: <development at drupal.org>
> Cc: <ca-dev at lists.civicactions.net>
> Sent: Tuesday, August 28, 2007 8:49 AM
> Subject: [development] Why is Block table delta field only 32 chars?
>
> > I spent a good long while trying to figure out why my 38 char delta block
> > would show up in the admin_display but would not get assigned to a
> > region.
>
> I
>
> > realized that UPDATE ... WHERE delta= "full 38 chars" was not going to
>
> find
>
> > my truncated entry created by _block_rehash :(
> >
> > Is there a reason to limit the length of this field?
> >
> > Should I submit a patch to check for this in _block_rehash and alert the
>
> user?
>
> > Best,
> > Jacob


More information about the development mailing list