Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Code
- $p = SQL::Parser->new;
- $p->feature(valid_data_types => SERIAL => 1);
- $p->parse($good_line);
- print Data::Dumper->new([$p->structure])->Useqq(1)->Terse(1)->Dump;
- #output
- {
- "original_string" => "CREATE TABLE \"area_parque\" (gid serial PRIMARY KEY,\"ind_nomenc\" varchar(18),\"nm_nome\" varchar(50),\"md_ar_poli\" numeric,\"cd_tipo_li\" varchar(20),\"cd_tipo\" varchar(50))",
- "org_table_names" => [
- "\"area_parque\""
- ],
- "ORG_NAME" => {},
- "set_function" => undef,
- "column_names" => [
- "gid",
- "\"ind_nomenc\"",
- "\"nm_nome\"",
- "\"md_ar_poli\"",
- "\"cd_tipo_li\"",
- "\"cd_tipo\""
- ],
- "table_names" => [
- "\"area_parque\""
- ],
- "org_col_names" => [
- undef,
- undef,
- undef,
- undef,
- undef,
- undef
- ],
- "column_defs" => {
- "\"cd_tipo_li\"" => {
- "data_type" => "VARCHAR",
- "data_length" => 20
- },
- "\"cd_tipo\"" => {
- "data_type" => "VARCHAR",
- "data_length" => 50
- },
- "\"md_ar_poli\"" => {
- "data_type" => "NUMERIC",
- "data_length" => undef
- },
- "\"ind_nomenc\"" => {
- "data_type" => "VARCHAR",
- "data_length" => 18
- },
- "\"nm_nome\"" => {
- "data_type" => "VARCHAR",
- "data_length" => 50
- },
- "gid" => {
- "data_type" => "SERIAL",
- "constraints" => [
- "PRIMARY KEY"
- ],
- "data_length" => undef
- }
- },
- "command" => "CREATE"
- }
Add Comment
Please, Sign In to add comment