Parse:...:Utils(3pm)
π Parse::Dia::SQL::Utils π
okay bestie, so this is a page from the User Contributed Perl Documentation collection β it's Parse:...:Utils(3pm), aka the little helper squad that lives inside Parse::Dia::SQL and does the boring-but-essential jobs so the main class can be its main character. β¨
NAME
Parse::Dia::SQL::Utils β the helper class for Parse::Dia::SQL. that's it, that's the job. π«Ά
SYNOPSIS
Not to be used directly.
like literally. do not touch. this is backstage. you do not go backstage. π
DESCRIPTION
utility functions for Parse::Dia::SQL. a whole lil toolbox of them. let's go one by one, no skipping, we do NOT skip. π
set_default_pk
defines the primary key column names AND types, so that primary keys can be auto-generated in tables that need one but were too lazy to define one themselves. we love a helpful default. π
new
the constructor. no arguments. that's it. just vibes. β¨
new
yes bestie it's listed twice on this page. iconic behavior, we don't question it, we simply respect it. π
get_node_attribute_values
so picture this: you hand it a node that has dia:attribute nodes chilling inside it. it walks through those dia:attribute nodes, finds the ones with attribute name='...', and hands you back 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. legal first characters 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 pull the value part out for you, given that the node is thingy. extraction queen. π§
get_value_from_object
give it an object, a node name, an attribute name, an attribute value, and the type of value you want back β it finds the info and returns it. π₯
get_node_from_object
give it an object, a node name, an attribute name, and an attribute value β it returns the node that has all of those things. the full package. β
name_case
transforms the case of names for name comparisons, matching whatever the database is doing. it leaves the name unchanged if -C (preserve case) is in effect. heads up: only sybase is known to be case sensitive. iykyk. πΈ
get_num_from_node
returns the value part of <dia:enum val="value"></thingy>. π
get_bool_from_node
returns the value part of <thingy><dia:boolean val="value"></thingy>. π
classify_multiplicity
looks at a multiplicity descriptor and classifies it as one of these four:
'one'β1, or1..1'zone'β0..1'many'βn..m,n..*, wheren > 1,m >= n'zmany'β0..n,0..*, wheren > 1
vibe check complete. π
attlist_from_names
generates a list of attributes from a comma-separated list of names, by looking up a class' attribute table. π
names_from_attlist
the glow-up in reverse: generates a comma-separated list of attribute names from a list of attributes. π
check_att_list_types
checks that a list of primary key attributes has types corresponding to the types in a list of foreign key attributes. making sure everybody matches. π
get_base_type
checks that a list of primary key attributes has types corresponding to the types in a list of foreign key attributes. (yes, same sentence as above β that's what the page says, fr fr.)
returns the base type of some DMBS specific types β for example, in PostgreSQL serial is integer.
AFF note: this is better implemented in each sql formatter class. π
make_name
generates a longer name from the parts you supply. except for the first part, the first letter of each part gets capitalised. if lcFirstWord is set, then any initial string of capitals in the first part gets made lower case; otherwise the first part is left exactly as it is.
dies if $self->{db} is not set. no db, no name, no mercy. π
the @parts_org values are saved for "Desperation time" :) β yes, that's the actual quote, we keep it. π«Ά
name_scramble
PSuda: a name scrambling helper function, for code that auto-generates names. takes one arg, which is the string to use for md5 hashing. it returns names that consist entirely of underscores and alphanumeric characters, and that start 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 a lot if it's a lot longer than the specified length. proportionate mangling, bestie. π
add_default_pk
for -p β adds a default primary key to a parsed table definition.
TODO: add a meaningful return value. π
add_default_fk
for -f β adds the missing parts of a default foreign key to a parsed table definition. β¨
and that's the whole page, no notes, we ate. π½οΈπ
cute lil sign-off time: this one's riding with perl v5.36.0, dated 2022-11-19, and it's filed under Parse:...:Utils(3pm). go forth and parse, my love. π¦π
π¦ where this page comes from
- debian bookworm: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- debian trixie: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu noble: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu resolute: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu stonking: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms