Guest User

Untitled

a guest
Jul 11th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #Code
  2. $p = SQL::Parser->new;
  3. $p->feature(valid_data_types => SERIAL => 1);
  4. $p->parse($good_line);
  5. print Data::Dumper->new([$p->structure])->Useqq(1)->Terse(1)->Dump;
  6.  
  7. #output
  8.  
  9. {
  10. "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))",
  11. "org_table_names" => [
  12. "\"area_parque\""
  13. ],
  14. "ORG_NAME" => {},
  15. "set_function" => undef,
  16. "column_names" => [
  17. "gid",
  18. "\"ind_nomenc\"",
  19. "\"nm_nome\"",
  20. "\"md_ar_poli\"",
  21. "\"cd_tipo_li\"",
  22. "\"cd_tipo\""
  23. ],
  24. "table_names" => [
  25. "\"area_parque\""
  26. ],
  27. "org_col_names" => [
  28. undef,
  29. undef,
  30. undef,
  31. undef,
  32. undef,
  33. undef
  34. ],
  35. "column_defs" => {
  36. "\"cd_tipo_li\"" => {
  37. "data_type" => "VARCHAR",
  38. "data_length" => 20
  39. },
  40. "\"cd_tipo\"" => {
  41. "data_type" => "VARCHAR",
  42. "data_length" => 50
  43. },
  44. "\"md_ar_poli\"" => {
  45. "data_type" => "NUMERIC",
  46. "data_length" => undef
  47. },
  48. "\"ind_nomenc\"" => {
  49. "data_type" => "VARCHAR",
  50. "data_length" => 18
  51. },
  52. "\"nm_nome\"" => {
  53. "data_type" => "VARCHAR",
  54. "data_length" => 50
  55. },
  56. "gid" => {
  57. "data_type" => "SERIAL",
  58. "constraints" => [
  59. "PRIMARY KEY"
  60. ],
  61. "data_length" => undef
  62. }
  63. },
  64. "command" => "CREATE"
  65. }
Add Comment
Please, Sign In to add comment