Provided by: libparse-dia-sql-perl_0.30-1_all bug

NAME

       Parse::Dia::SQL::Utils - Helper class for Parse::Dia::SQL.

SYNOPSIS

         Not to be used directly.

DESCRIPTION

       Utility functions for Parse::Dia::SQL.

   set_default_pk
       Define primary key column names and types for automatic generation of primary keys in
       tables that need them, but do not have them defined.

   new
       The constructor.  No arguments.

   new
   get_node_attribute_values
       Given a node with dia:attribute nodes inside it, go through the dia:attribute nodes with
       attribute "name='...'" and return the string values

       @infosToGet is an array of strings, where the first character is the data type to get, and
       the remaining characters are the name to parse for. first character legal values are:

          a = alpha
          9 = numeric
          b = boolean

       example:   aname, 9dollars, bkillOrNot

   get_string_from_node
       If it looks like <thingy><dia:string>value</dia:string></thingy> then we will get the
       'value' part out given the node is 'thingy'.

   get_value_from_object
       Given an object, node name, attribute name, attribute value, and value to retrieve type,
       find the info and return it.

   get_node_from_object
       Given an object, node name, attribute name, and attribute value, return the node that has
       all these things.

   name_case
       Transform case for name comparisons to that of the database; leave unchanged if -C
       (preserve case) is in effect. Only sybase is known to be case sensitive.

   get_num_from_node
       Return value part of <dia:enum val="value"></thingy>.

   get_bool_from_node
       Return value part of <thingy><dia:boolean val="value"></thingy>.

   classify_multiplicity
       Look at a multiplicity descriptor and classify it as 'one' (1, or 1..1), 'zone' (0..1),
       'many' (n..m, n..*, where n > 1, m >= n) and 'zmany' (0..n, 0..*, where n > 1)

   attlist_from_names
       Generate a list of attributes from a comma-separated list of names by looking up a class'
       attribute table.

   names_from_attlist
       Generate a comma-separated list of attribute names from a list of attributes.

   check_att_list_types
       Check that a list of primary key attributes has types corresponding to the types in a list
       of foreign key attributes

   get_base_type
       Check that a list of primary key attributes has types corresponding to the types in a list
       of foreign key attributes.

       Returns base type of some DMBS specific types (eg in PostgreSQL serial is integer).

       AFF note:  This is better implemented in each sql formatter class.

   make_name
       Generate a longer name from parts supplied. Except for the first part, the first letter of
       each part is capitalised. If lcFirstWord is set, then any initial string of capitals in
       the first part is made lower case; otherwise the first part is left unchanged.

       Dies if $self->{db} is not set.

       The @parts_org values are save for "Desperation time" :)

   name_scramble
       PSuda: Name scrambling helper function, for code which auto-generates names.  Takes one
       arg, which is string to use for md5 hashing. This returns names which consist entirely of
       underscores and alphanumeric characters, and starts with one or more alpha characters.

   mangle_name
       Get a name to mangle and mangle it to the length specified -- avoid too much
       manglification if the name is only slightly long, but mangle lots if it's a lot longer
       than the specified length.

   add_default_pk
       For -p - add a default primary key to a parsed table definition

       TODO : Add a meaningful return value.

   add_default_fk
       For -f - add missing parts of a default foreign key to a parsed table definition.