<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: Pg.pm
===================================================================
RCS file: /usr/local/cvsroot/dbdpg/dbdpg/Pg.pm,v
retrieving revision 1.25
diff -c -r1.25 Pg.pm
*** Pg.pm	28 Mar 2003 04:57:08 -0000	1.25
--- Pg.pm	28 Mar 2003 20:56:30 -0000
***************
*** 1065,1070 ****
--- 1087,1241 ----
  		$str =~ s/(['\\\0])/$esc{$1}/g;
  		return "'$str'";
      }
+ 
+    sub get_info {
+ 
+ 
+ my ($dbh,$type) = @_;
+ 
+ return undef unless defined $type and length $type;
+ 
+ my $version = DBD::Pg::_pg_server_version($dbh);
+ 
+ my %type = (
+ 
+ ## Basic information:
+ 
+     6 =&gt; ["SQL_DRIVER_NAME",                'DBD/Pg.pm',         ],
+    17 =&gt; ["SQL_DBMS_NAME",                  'PostgreSQL'         ],
+    18 =&gt; ["SQL_DBMS_VER",                   $version             ],
+    29 =&gt; ["SQL_IDENTIFIER_QUOTE_CHAR",      '\"'                 ],
+    41 =&gt; ["SQL_CATALOG_NAME_SEPARATOR",     ''                   ],
+    47 =&gt; ["SQL_USER_NAME",                  $dbh-&gt;{CURRENT_USER} ],
+ 
+ ## Size limits
+ 
+    30 =&gt; ["SQL_MAX_COLUMN_NAME_LEN",        'NAMEDATALEN'        ],
+    32 =&gt; ["SQL_MAX_SCHEMA_NAME_LEN",        'NAMEDATALEN'        ],
+    34 =&gt; ["SQL_MAX_CATALOG_NAME_LEN",       0                    ],
+    35 =&gt; ["SQL_MAX_TABLE_NAME_LEN",         'NAMEDATALEN'        ],
+    97 =&gt; ["SQL_MAX_COLUMNS_IN_GROUP_BY",    0                    ],
+    98 =&gt; ["SQL_MAX_COLUMNS_IN_INDEX",       0                    ],
+    99 =&gt; ["SQL_MAX_COLUMNS_IN_ORDER_BY",    0                    ],
+   100 =&gt; ["SQL_MAX_COLUMNS_IN_SELECT",      0                    ],
+   101 =&gt; ["SQL_MAX_COLUMNS_IN_TABLE",       0                    ],
+   102 =&gt; ["SQL_MAX_INDEX_SIZE",             0                    ],
+   104 =&gt; ["SQL_MAX_ROW_SIZE",               0                    ],
+   105 =&gt; ["SQL_MAX_STATEMENT_LEN",          0                    ],
+   106 =&gt; ["SQL_MAX_TABLES_IN_SELECT",       0                    ],
+   107 =&gt; ["SQL_MAX_USER_NAME_LEN",          'NAMEDATALEN'        ],
+   108 =&gt; ["SQL_MAX_STATEMENT_LEN",          0                    ],
+   109 =&gt; ["SQL_MAX_STATEMENT_LEN",          0                    ],
+   105 =&gt; ["SQL_MAX_STATEMENT_LEN",          0                    ],
+   105 =&gt; ["SQL_MAX_STATEMENT_LEN",          0                    ],
+   112 =&gt; ["SQL_MAX_BINARY_LITERAL_LEN",     0                    ],
+ 10005 =&gt; ["SQL_MAX_IDENTIFIER_LEN",         'NAMEDATALEN'        ],
+ 
+ ## Catalog support
+ 
+   41  =&gt; ["SQL_CATALOG_NAME_SEPARATOR",     ''                   ],
+   42  =&gt; ["SQL_CATALOG_TERM",               ''                   ],
+  114  =&gt; ["SQL_CATALOG_LOCATION",           0                    ],
+ 10003 =&gt; ["SQL_CATALOG_NAME",               'N'                  ],
+ 
+ ## Domain support
+ 
+   117 =&gt; ["SQL_ALTER_DOMAIN",               0                    ],
+   130 =&gt; ["SQL_CREATE_DOMAIN",              0                    ],
+   139 =&gt; ["SQL_DROP_DOMAIN",                0                    ],
+ 
+ ## Schema support (7.3 and up)
+ 
+    39 =&gt; ["SQL_SCHEMA_TERM",                'schema'             ],
+    91 =&gt; ["SQL_SCHEMA_USAGE",               'SCHEMAUSAGE'        ],
+   131 =&gt; ["SQL_CREATE_SCHEMA",              'CREATESCHEMA'       ],
+   140 =&gt; ["SQL_DROP_SCHEMA",                'DROPSCHEMA'         ],
+ 
+ ## Various
+ 
+     2 =&gt; ["SQL_DATA_SOURCE_NAME",           'SOURCENAME'         ],
+     7 =&gt; ["SQL_DRIVER_VER",                 'DBDVERSION'         ],
+    13 =&gt; ["SQL_SERVER_NAME",                $dbh-&gt;{Name}         ],
+    14 =&gt; ["SQL_SEARCH_PATTERN_ESCAPE",      '\\'                 ],
+    18 =&gt; ["SQL_DBMS_VERSION",               'ODBCVERSION'        ],
+    22 =&gt; ["SQL_CONCAT_NULL_BEHAVIOR",       0                    ], ## SQL_CB_NULL
+    28 =&gt; ["SQL_IDENTIFIER_CASE",            4                    ], ## SQL_IC_MIXED 
+    29 =&gt; ["SQL_IDENTIFIER_QUOTE_CHAR",      '\"'                 ],
+    40 =&gt; ["SQL_PROCEDURE_TERM",             'Function'           ],
+    45 =&gt; ["SQL_TABLE_TERM",                 'Table'              ],
+    46 =&gt; ["SQL_TXN_CAPABLE",                4                    ], ## SQL_TC_ALL
+    87 =&gt; ["SQL_COLUMN_ALIAS",               "Y"                  ],
+    90 =&gt; ["SQL_ORDER_BY_COLUMNS_IN_SELECT", 'N'                  ],
+    93 =&gt; ["SQL_QUOTED_IDENTIFIER_CASE",     3                    ], ## SQL_IC_SENSITIVE
+   113 =&gt; ["SQL_LIKE_ESCAPE_CLAUSE",         'Y'                  ],
+   127 =&gt; ["SQL_CREATE_ASSERTION",           0                    ],
+   136 =&gt; ["SQL_DROP_ASSERTION",             0                    ],
+ );
+ 
+ ## Put both numbers and names into a hash
+ my %t;
+ for (keys %type) {
+   $t{$_} = $type{$_}-&gt;[1];
+   $t{$type{$_}-&gt;[0]} = $type{$_}-&gt;[1];
+ }
+ 
+ return undef unless exists $t{$type};
+ 
+ my $ans = $t{$type};
+ 
+ if ($ans eq 'NAMEDATALEN') {
+   return DBD::Pg::_pg_check_version(7.3, $version) ? 63 : 31;
+ }
+ elsif ($ans eq 'ODBCVERSION') {
+   return sprintf "%02d.%02d.%1d%1d%1d%1d", split (/\./, "$version.0.0.0.0.0.0");
+ }
+ elsif ($ans eq 'DBDVERSION') {
+   my $simpleversion = $DBD::Pg::VERSION;
+   $simpleversion =~ s/_/./g;
+   return sprintf "%02d.%02d.%1d%1d%1d%1d", split (/\./, "$simpleversion.0.0.0.0.0.0");
+ }
+ elsif ($ans eq 'SOURCENAME') {
+   return "dbi:Pg:dbname=$dbh-&gt;{Name}";
+ }
+ elsif ($ans eq 'SCHEMAUSAGE') {
+   return 0 if ! DBD::Pg::_pg_check_version(7.3, $version);
+   my %bitmask = (
+     SQL_SU_DML_STATEMENT        =&gt; 1,
+     SQL_SU_PROCEDURE_INVOCATION =&gt; 2,
+     SQL_SU_TABLE_DEFINITION     =&gt; 4,
+     SQL_SU_INDEX_DEFINITION     =&gt; 8,
+     SQL_SU_PRIVILEGE_DEFINITION =&gt; 16,
+   );
+   return 31; ## all of the above
+ }
+ elsif ($ans eq 'CREATESCHEMA') {
+   return 0 if ! DBD::Pg::_pg_check_version(7.3, $version);
+   my %bitmask = (
+     SQL_CS_CREATE_SCHEMA         =&gt; 1,
+     SQL_CS_AUTHORIZATION         =&gt; 2,
+     SQL_CS_DEFAULT_CHARACTER_SET =&gt; 4
+   );
+   return $bitmask{SQL_CS_CREATE_SCHEMA} + $bitmask{SQL_CS_AUTHORIZATION};
+ }
+ elsif ($ans eq 'DROPSCHEMA') {
+   return 0 if ! DBD::Pg::_pg_check_version(7.3, $version);
+   my %bitmask = (
+     SQL_DS_DROP_SCHEMA =&gt; 1,
+     SQL_DS_RESTRICT    =&gt; 2,
+     SQL_DS_CASCADE     =&gt; 4
+   );
+   return $bitmask{SQL_DS_DROP_SCHEMA} + 
+          $bitmask{SQL_DS_CASCADE} + 
+          $bitmask{SQL_DS_RESTRICT};
+ }
+ 
+ return $ans;
+ 
+ 
+ }
+ 
+ 
  
  }    # end of package DBD::Pg::db
  
</pre></body></html>