Re: [Maypole] problem with maypole and postgresql, different schema than public

From: Jochen Schroer (schroer at ecs-solution.de)
Date: Tue Sep 21 2004 - 16:32:34 BST


Hi Veljko,

hm, okay, that's not fine, but it helps for parts of my problem.
If I do so, I get a fine frontpage for my simple-application.
But if I try to select an table than (by clicking on the link) I get errors again.
jochentest1::customer can't SELECT id FROM   kunden
: DBD::Pg::st execute failed: ERROR:  relation "customer" does not exist [for Statement "SELECT id FROM   customer"] /usr/local/share/perl/5.8.4/DBIx/ContextualFetch.pm line 51. at /usr/local/share/perl/5.8.4/Class/DBI/Pager.pm line 48

Looks like that there is another problem because all requests on this db has to adress the schema.

Hmmmm, is there really no other way than to put all tables into public? Using of Schemas is not so exotic, or?

Best regards,

Jochen

Hi, Jochen

I think you will have to change Class::DBI::Loader::Pg to get
different schema then public.

Look at lines:
 if ($DBD::Pg::VERSION >= 1.31) {
	@tables = $dbh->tables(undef, "public", "", "table" , {noprefix => 1});
    }
    else {
	@tables = $dbh->tables;
    }
    foreach my $table(@tables) {
...


Regards,
Veljko

----- Original Message ----- 
  From: Jochen Schroer 
  To: maypole at lists.netthink.co.uk 
  Sent: Tuesday, September 21, 2004 10:16 AM
  Subject: [Maypole] problem with maypole and postgresql, different schema than public


  Hi,

  I have a problem with maypole and postgresql, because I don't know how I can access tables in different schema than public.
  I make my first step with maypole by using mysql and everything works fine, than I try it on our postgresql-DB's where we use separat schemanames for grouping data.
  The name of the DB is "stammdaten", the name of the schema where I will connect to is "stammdaten", too.
  So, normally in Perl/DBI I would make something like 

  $dbh = DBI->connect("dbi:Pg:dbname=stammdaten", "", "");
  my $res = $dbh->selectall_arrayref("SELECT * FROM stammdaten.customer");

  but how can I do it in Maypole?
  I try it in this way:
  package jochentest1;
  use base 'CGI::Maypole';
  use Class::DBI::Loader::Relationship;
  jochentest1->setup("dbi:Pg:dbname=stammdaten;host=localhost;port=5432;","xxx","yyyyy");
  jochentest1->config->{uri_base} = "http://xxxxxxxxxxxxxxxxx/cgi-bin/jochentest1.cgi";

  1;
  But than I get only Tables from public-schema.

  Than I try something like
  jochentest1->config->{display_tables} = [qw[stammdaten.customer]];
  but if i do so I get 
  [Tue Sep 21 16:10:44 2004] [error] [client 194.39.131.40] file error - stammdaten.customerlist: not found at /usr/local/share/perl/5.8.4/Maypole/View/Base.pm line 68., referer: http://xxxxxxxxxxxxxx/cgi-bin/jochentest1.cgi/
  [Tue Sep 21 16:10:44 2004] [error] [client 194.39.131.40] Premature end of script headers: jochentest1.cgi, referer: http://xxxxxxxxxxxxxxxxxxxx/cgi-bin/jochentest1.cgi/

  Has anyone an idea how I can solve this problem? I'm reading in mailinglist archive and documentation, but I see nothing for this topic.

  Hope you can help me.

  Best regards,

  Jochen
  -- 
  ECS-Solution GmbH
  Raiffeisenstr. 26
  67817 Imsbach
  Germany

  Web: http://www.ecs-solution.de
  Tel: +49 (6302) 609 710
  Fax: +49 (6302) 609 711

  _______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole 
  


-- 
ECS-Solution GmbH
Raiffeisenstr. 26
67817 Imsbach
Germany

Web: http://www.ecs-solution.de
Tel: +49 (6302) 609 710
Fax: +49 (6302) 609 711

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT