The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::FormEngine::DBSQL::PGSQL - PostgreSQL driver for FormEngine::DBSQL

REQUIREMENTS

You need to execute the following command in your PostgreSQL database:

CREATE VIEW "column_info" AS SELECT relname, attname, atttypmod, attnotnull, typname, adsrc, description FROM ((((pg_class LEFT JOIN pg_attribute ON ((pg_class.relfilenode = pg_attribute.attrelid))) LEFT JOIN pg_type ON ((atttypid = pg_type.oid))) LEFT JOIN pg_attrdef ON (((attrelid = pg_attrdef.adrelid) AND (attnum = pg_attrdef.adnum)))) LEFT JOIN pg_description ON (((attrelid = pg_description.objoid) AND (attnum = pg_description.objsubid)))) WHERE (((((((attname <> 'tableoid'::name) AND (attname <> 'oid'::name)) AND (attname <> 'ctid'::name)) AND (attname <> 'xmax'::name)) AND (attname <> 'xmin'::name)) AND (attname <> 'cmax'::name)) AND (attname <> 'cmin'::name)) ORDER BY attnum;

This will create a view called column_info, it is needed to extract information about the table columns.

_dbsql_initialize_child

This method is called for every child of FormEngine::DBSQL. A DBMS driver has to load the datatype handler configuration from its Config.pm here!

get_tbl_struct ( HASHREF )

This method is called by the dbsql_conf method of FormEngine::DBSQL to get information about the columns of the specified database table. Every DBMS driver has to implement it!

This method must return a reference to an array which must contain an hash reference for every column, except those in the committed HASHREF. These referenced hashes must support the following information:

  • name - the columns name

  • notnull - 1 if the column has the NOT NULL attribute, 0 if not

  • dtyp - the name of the columns datatype

  • default - the columns default value

  • description - the columns comment

The hash might also support DBMS specific information which then is only used by the DBMS specific datatype handlers. For PostgreSQL this is:

    dtypmod - datatype modification information, this is used by PostgreSQLs string handler.