Skip Menu |
 

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 91764
Status: patched
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: guidugli [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



From guidugli [...] gmail.com Tue Dec 31 12: 20:59 2013
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
X-Spam-Flag: NO
Content-Type: multipart/alternative; boundary="14dae9399ab93d58c604eed7c885"
Message-ID: <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com>
X-Received: by 10.182.220.99 with SMTP id pv3mr48454538obc.37.1388510451683; Tue, 31 Dec 2013 09:20:51 -0800 (PST)
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -2.698
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 473A1240B8F for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 31 Dec 2013 12:20:59 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id magQmupLhpAa for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 31 Dec 2013 12:20:58 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 3CB4A240AB1 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 31 Dec 2013 12:20:58 -0500 (EST)
Received: (qmail 529 invoked by alias); 31 Dec 2013 17:20:56 -0000
Received: from mail-oa0-f53.google.com (HELO mail-oa0-f53.google.com) (209.85.219.53) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 31 Dec 2013 09:20:55 -0800
Received: by mail-oa0-f53.google.com with SMTP id m1so13312816oag.40 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 31 Dec 2013 09:20:52 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Tue, 31 Dec 2013 09:20:51 -0800 (PST)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
X-RT-Mail-Extension: dbix-class-schema-loader
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=AB1F7MVhk+NoEXZW+JGJV/SWHy2u5yAns2lIPqvk8m8=; b=yRCjt3zmpo7Y8iKJJ4LWtnevVP63ZDyeEWCfTTqYsU4XX0hx2DlJCR+/8fkH3ZFsVr RFtzQpBuZC7KbDqq9TBaUGk2B6ANAK70vg17AEeHpcSIAhb++9Panc0CG+b24gl2CfCh TklwfSux0sTOsJZhDaETI95hlg3oGQMmytMrO9mCeg+wVOCGVVBFUx1IJs9asrBgdFrA Nq9R4kMbSiCyHQS1QKXkBVyvC2oGPBrLBD2zV+26nroNUfSbOw4Y9C34rNmFTmX1PqtT eLJIOGFCbw0ucT3oKex8rKR+KcqZ069nT8VbzKTgGs7eXFe5ClBsqtJBzGJejy05gvLp gaZw==
Date: Tue, 31 Dec 2013 15:20:51 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: iso-8859-1
Content-Length: 779
Download (untitled) / with headers
text/plain 779b
I have the following module version installed: DBD::DB2 (1.85) DBIx::Class::Schema::Loader (0.07038) DBIx::Class (0.08250) Trying to load tables from DB2 10.1 FP3 into DBIx, but result always empty. Tried to use db_schema and other flags without success. After taking a look at the code I found the problem. On /usr/local/share/perl5/DBIx/Class/Schema/Loader/DBI/DB2.pm, had to change line 159 from: return $self->dbh->tables($schema ? { TABLE_SCHEM => $schema } : undef); to return $self->dbh->tables($schema ? { TABLE_SCHEM => $schema,'TABLE_NAME' => '%' } : undef); It seems that on DBD::DB2 1.85 it is mandatory to gave TABLE_NAME => '%' . On my tests I could only fetch something with both table name and schema. Hope this helps. Thank you for these great modules!
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1098
From ilmari [...] ilmari.org Thu Jan 2 08: 47:28 2014
X-Amavis-Alert: BAD HEADER SECTION, Improper folded header field made up entirely of whitespace (char 20 hex): X-Exiscan-Spam-Report: ...ping.uio.no\n Score Rule\n \n * -5.0 PING_U[...]
MIME-Version: 1.0
X-Spam-Status: No, score=-0.001 tagged_above=-99.9 required=10 tests=[BAYES_40=-0.001] autolearn=ham
In-Reply-To: <rt-4.0.18-12260-1388510460-1117.91764-4-0 [...] rt.cpan.org> (Carlos Eduardo Panazzolo Guidugli via's message of "Tue, 31 Dec 2013 12:21:01 -0500")
X-Exiscan-Spam-Score: -3.7 (---)
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-12260-1388510460-1117.91764-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <d8j7gaimr6h.fsf [...] dalvik.ping.uio.no>
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -0.001
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id C1CBB240A15 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Thu, 2 Jan 2014 08:47:28 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2w4DpFWXrEaz for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Thu, 2 Jan 2014 08:47:27 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 36878240261 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Thu, 2 Jan 2014 08:47:26 -0500 (EST)
Received: (qmail 21482 invoked by alias); 2 Jan 2014 13:47:26 -0000
Received: from pike.ping.uio.no (HELO ping.uio.no) (193.157.115.208) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 02 Jan 2014 05:47:25 -0800
Received: from [2001:700:100:570::211] (helo=dalvik.ping.uio.no ident=Debian-exim) by ping.uio.no with esmtp (Exim 4.72 #1 (Debian)) id 1VyicJ-0008Rf-0t for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Thu, 02 Jan 2014 14:47:20 +0100
Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.72) (envelope-from <ilmari [...] ilmari.org>) id 1VyicI-0006NK-UY for bug-DBIx-Class-Schema-Loader [...] rt.cpan.org; Thu, 02 Jan 2014 14:47:18 +0100
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-Exiscan-Spam-Report: SpamAssassin 3.3.1 (2010-03-16) on pike.ping.uio.no Score Rule * -5.0 PING_UIO_MAIL_IS_INTERNAL Message has never been outside * 129.240.0.0/16 or 193.157.115.0/24 * 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Return-Path: <ilmari [...] ilmari.org>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Thu, 02 Jan 2014 14:47:18 +0100
X-Spam-Level:
X-Quarantine-ID: <2w4DpFWXrEaz>
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
RT-Message-ID: <rt-4.0.18-2529-1388670449-78.91764-0-0 [...] rt.cpan.org>
Content-Length: 609
Download (untitled) / with headers
text/plain 609b
"Carlos Eduardo Panazzolo Guidugli via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: Show quoted text
> It seems that on DBD::DB2 1.85 it is mandatory to gave TABLE_NAME => '%' . > On my tests I could only fetch something with both table name and schema.
Thanks for the report. Before I change it, could you confirm that TABLE_NAME => '%' also works on older versions of DBD::DB2 (and DB2 itself, if possible)? -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen
From guidugli [...] gmail.com Thu Jan 2 15: 58:41 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <rt-4.0.18-2529-1388670450-1827.91764-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-12260-1388510460-1117.91764-4-0 [...] rt.cpan.org> <d8j7gaimr6h.fsf [...] dalvik.ping.uio.no> <rt-4.0.18-2529-1388670450-1827.91764-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.98.40 with SMTP id ef8mr56541635oeb.13.1388696313489; Thu, 02 Jan 2014 12:58:33 -0800 (PST)
Message-ID: <CAP5P6gX1X6md43iwO9KwPniXejgHFjdNs883+ErHd2rfkfZ1dA [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary="089e013a1822781d1704ef030e91"
X-Spam-Score: -2.698
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 869C2240CF6 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Thu, 2 Jan 2014 15:58:41 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RkRW5NrpwkWY for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Thu, 2 Jan 2014 15:58:40 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 390E5240CCA for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Thu, 2 Jan 2014 15:58:39 -0500 (EST)
Received: (qmail 20733 invoked by alias); 2 Jan 2014 20:58:38 -0000
Received: from mail-ob0-f170.google.com (HELO mail-ob0-f170.google.com) (209.85.214.170) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 02 Jan 2014 12:58:37 -0800
Received: by mail-ob0-f170.google.com with SMTP id wp18so14856366obc.15 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Thu, 02 Jan 2014 12:58:33 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Thu, 2 Jan 2014 12:58:33 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3xO+WTeZEuEwQwdPmcDH9DgsOM3mmKZcXiFZoJlfyrY=; b=KrN4w19MFV7CLpZRAjcrZfgvvmgGLRGduwkMMk86v1/o+JIlbR7KyIDNcWTz8YJo8M MOFdLAqTdmE8+CiUrCuYk+PI3j6UhRp3wbEdaDaENeMIjyxbFz9CHJtgWNjrpxfuocXs nStlpyr0R35OsmQ2ZZ62yzVmQW3zDINLfQau8KW3l5txgLQec+Dx36Xmn3wAhOZrS1X9 oiDs72H8fVZu0v1jYQ/ooArbXCPHFAu+dLiUZ/YctpB/Djsb9I/5dvnwbBjpJ9HBXuJk fBElRkHWtA6HKZY6WbQOSPByJ/7lZwUFVLXSD+NKa9Uuctg852udpXY/Xeifod+P26gE f1pQ==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Thu, 2 Jan 2014 18:58:33 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
RT-Message-ID: <rt-4.0.18-5658-1388696322-1282.91764-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 926
Download (untitled) / with headers
text/plain 926b
Tested with 1.84,1.83 and 1.81. All of them performed successfully with TABLE_NAME => '%' . Thank you On Thu, Jan 2, 2014 at 11:47 AM, (Dagfinn Ilmari Mannsåker) via RT < bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=91764 > > > "Carlos Eduardo Panazzolo Guidugli via RT" > <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: >
> > It seems that on DBD::DB2 1.85 it is mandatory to gave TABLE_NAME => '%'
> .
> > On my tests I could only fetch something with both table name and schema.
> > Thanks for the report. Before I change it, could you confirm that > TABLE_NAME => '%' also works on older versions of DBD::DB2 (and DB2 > itself, if possible)? > > -- > "I use RMS as a guide in the same way that a boat captain would use > a lighthouse. It's good to know where it is, but you generally > don't want to find yourself in the same spot." - Tollef Fog Heen > >
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 1767
MIME-Version: 1.0
In-Reply-To: <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-6799-1388700476-82.91764-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 153
Download (untitled) / with headers
text/plain 153b
Thank you for testing. It turns out there was already a fix for this by Matt Phillips on a branch, so I've merged that and it'll be in the next release.
From guidugli [...] gmail.com Mon Jan 6 12: 47:53 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <rt-4.0.18-6799-1388700477-887.91764-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-6799-1388700477-887.91764-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.98.40 with SMTP id ef8mr73109272oeb.13.1389030459585; Mon, 06 Jan 2014 09:47:39 -0800 (PST)
Message-ID: <CAP5P6gVMNkNE0PdDTyJf8L3fj9W4Gx9mYwyacNkuuL3QdhccRA [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary="089e013a1822203d4704ef50db61"
X-Spam-Score: -2.698
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id A3D06240D7B for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Mon, 6 Jan 2014 12:47:53 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CERBzmdmgdz9 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Mon, 6 Jan 2014 12:47:51 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id E7B74240AE7 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Mon, 6 Jan 2014 12:47:50 -0500 (EST)
Received: (qmail 9196 invoked by alias); 6 Jan 2014 17:47:49 -0000
Received: from mail-oa0-f49.google.com (HELO mail-oa0-f49.google.com) (209.85.219.49) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 06 Jan 2014 09:47:43 -0800
Received: by mail-oa0-f49.google.com with SMTP id i4so18929678oah.8 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Mon, 06 Jan 2014 09:47:39 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Mon, 6 Jan 2014 09:47:39 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Mon, 6 Jan 2014 09:47:39 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wVBgIZ6uJBjuHrCHLM40fu37ZE2D+YWb4DZRmfQWW40=; b=pkdU/c7Q54EK+xG16pzSGMIz9uDd5/AMsjHZtS7dbIhOd1PJi6STBT7NYeMcTkeFiB hBAZesdzJPrrv6oi+hHhFXNtJ6iNdw5C1dyfw9NPDq9nuIfGOxTOBxhWmDBn7yp13iaH f1GITslwvmrkfnQakh8kgZt8bo+GPQf5w5XX463OtEpP0vc+7o8X3IsUV0oDtoS5sKM3 nAHDbE0nAcks7/5WiX9vWb1BxIXREeFtxJrJOKX2utO9TX1DWmkKY0CEY8OEx8EJDrax tXwXmQlVKklTi7dxjmBs381j9A3U5p578cQE/or/NQq8tk6/e6Y/Okei2D6JBqOUVGNF MfYQ==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Mon, 6 Jan 2014 15:47:39 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
RT-Message-ID: <rt-4.0.18-25998-1389030474-1326.91764-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 491
Download (untitled) / with headers
text/plain 491b
Thank you. Do you of any bug regarding relationships? Somehow the loader detects the primary keys but is not building the has_many, belongs_to, etc methods. On Jan 2, 2014 8:07 PM, "Dagfinn Ilmari Mannsaker via RT" < bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=91764 > > > Thank you for testing. > > It turns out there was already a fix for this by Matt Phillips on a > branch, so I've merged that and it'll be in the next release. >
content-type: text/html; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 857
From guidugli [...] gmail.com Mon Jan 6 17: 46:48 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <CAP5P6gVMNkNE0PdDTyJf8L3fj9W4Gx9mYwyacNkuuL3QdhccRA [...] mail.gmail.com>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-6799-1388700477-887.91764-6-0 [...] rt.cpan.org> <CAP5P6gVMNkNE0PdDTyJf8L3fj9W4Gx9mYwyacNkuuL3QdhccRA [...] mail.gmail.com>
X-Virus-Checked: Checked
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.65.101 with SMTP id w5mr74414846oes.0.1389048399728; Mon, 06 Jan 2014 14:46:39 -0800 (PST)
Message-ID: <CAP5P6gXhRYoxLnWHpW99qDr36mBtGWo34xb9MMOJkMeaKYryxw [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary="001a11c1d19c711dca04ef5508eb"
X-Spam-Score: -2.698
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id DD781240D7C for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Mon, 6 Jan 2014 17:46:48 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xql8JDsVbfm0 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Mon, 6 Jan 2014 17:46:47 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id DB07C240AE7 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Mon, 6 Jan 2014 17:46:46 -0500 (EST)
Received: (qmail 311 invoked by alias); 6 Jan 2014 22:46:45 -0000
Received: from mail-ob0-f172.google.com (HELO mail-ob0-f172.google.com) (209.85.214.172) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 06 Jan 2014 14:46:43 -0800
Received: by mail-ob0-f172.google.com with SMTP id gq1so19231488obb.31 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Mon, 06 Jan 2014 14:46:39 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Mon, 6 Jan 2014 14:46:39 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=iFzgPtRsiMuoX9Za27qAwN+9x0PnzXQAkpIY7bcJ4NQ=; b=cqT42t7mV2MBCjmYODuJMMeSn1veFYoP4Zt31Ik2i76iwOr8lL17ZZYD288ej4nRZo 918XcLOQN3WsN/tQ3DfyYr9o7wWEGsGkXKibX+w/BEhjdx+vo/yzEsGjMfGak/1ZWcQM vXilcO2MJm9UKJTeWie29UUcvw3XfTm1r3T90pjHIj52kaPZ1zqYybTGISJhEILbMwqM XlMvGdEScqjj4gnt9dTt334UV3ptsTaE2xMJAUx1gpCVxLmgLcWI+Zq5q7SDlfgqZDra BxTIk2/9pFWwyYB6TMFWmLZ1heMC1fQ2uFegG0I4KxXUyURrmzDmYgbyeSuqsAIFFXGJ Bumg==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Mon, 6 Jan 2014 20:46:39 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
RT-Message-ID: <rt-4.0.18-21132-1389048409-1759.91764-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 2861
Download (untitled) / with headers
text/plain 2.7k
Hi, found the problem that prevented DBIx-Class-Schema-Loader from getting the relationships. On the file /usr/local/share/perl5/DBIx/Class/Schema/Loader/DBI/DB2.pm, method _table_fk_info, the query is currently: my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); SELECT tc.constname, sr.reftabschema, sr.reftabname, kcu.colname, rkcu.colname, kcu.colseq, sr.deleterule, sr.updaterule FROM ........ The problem is that DB2 retrieves some columns preserving spaces at its end. So, the sr.reftabschema was bringing 'MYSCHEMA ' instead of 'MYSCHEMA'. To solve this problem I changed the query to: my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); SELECT trim(tc.constname), trim(sr.reftabschema), trim(sr.reftabname), trim(kcu.colname), trim(rkcu.colname), kcu.colseq, sr.deleterule, sr.updaterule FROM ......... With this change I was able to retrieve relation information. Another point that I'd like to show is about UNIQUE constraint in method _table_uniq_info. In DB2, it is possible to create a UNIQUE constraint, or a UNIQUE index with exactly the same effect. I was using unique indexes, so none appeared on the model. In order to make it work I created the unique constraints as well. I am new to DBIx, but what would happen if there are two unique constraints in the resulting class, as shown in the example below. __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_UN", ["slname"]); __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_IDX", ["slname"]); If this is not a problem, maybe the query could be changed to retrieve unique indexes as well: SELECT sc.colname, si.name, sc.colseq FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND si.uniquerule = 'U' UNION SELECT kcu.colname, kcu.constname, kcu.colseq FROM syscat.tabconst as tc JOIN syscat.keycoluse as kcu ON tc.constname = kcu.constname AND tc.tabschema = kcu.tabschema AND tc.tabname = kcu.tabname WHERE tc.tabschema = ? and tc.tabname = ? and tc.type = 'U' What do you think? Also, it may be a safe bet to add TRIM to char, varchar columns that have strings with variable length. Thank you On Mon, Jan 6, 2014 at 3:47 PM, Carlos Eduardo Panazzolo Guidugli < guidugli@gmail.com> wrote: Show quoted text
> Thank you. Do you of any bug regarding relationships? Somehow the loader > detects the primary keys but is not building the has_many, belongs_to, etc > methods. > On Jan 2, 2014 8:07 PM, "Dagfinn Ilmari Mannsaker via RT" < > bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=91764 > >> >> Thank you for testing. >> >> It turns out there was already a fix for this by Matt Phillips on a >> branch, so I've merged that and it'll be in the next release. >>
>
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 4333
From guidugli [...] gmail.com Tue Jan 7 07: 22:30 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <CAP5P6gXhRYoxLnWHpW99qDr36mBtGWo34xb9MMOJkMeaKYryxw [...] mail.gmail.com>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-6799-1388700477-887.91764-6-0 [...] rt.cpan.org> <CAP5P6gVMNkNE0PdDTyJf8L3fj9W4Gx9mYwyacNkuuL3QdhccRA [...] mail.gmail.com> <CAP5P6gXhRYoxLnWHpW99qDr36mBtGWo34xb9MMOJkMeaKYryxw [...] mail.gmail.com>
X-Virus-Checked: Checked
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.61.14 with SMTP id l14mr76523671oer.18.1389097338962; Tue, 07 Jan 2014 04:22:18 -0800 (PST)
Message-ID: <CAP5P6gUMCfz_njY_fLyFQXK4x8D7f+8gNVUvE9j2Qa0ThdjsGg [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary="001a113306f27287ec04ef606d34"
X-Spam-Score: -2.698
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id BB4CD240398 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 7 Jan 2014 07:22:29 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EuKPy6du-i6o for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 7 Jan 2014 07:22:27 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id DB49A2402CD for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 7 Jan 2014 07:22:26 -0500 (EST)
Received: (qmail 16756 invoked by alias); 7 Jan 2014 12:22:25 -0000
Received: from mail-ob0-f179.google.com (HELO mail-ob0-f179.google.com) (209.85.214.179) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 07 Jan 2014 04:22:22 -0800
Received: by mail-ob0-f179.google.com with SMTP id wm4so61576obc.38 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 07 Jan 2014 04:22:19 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Tue, 7 Jan 2014 04:22:18 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=AmEVZcQdGsnVFlcSCnPjYBQEeCZJy+rhG+SvRizr4pE=; b=OYGqhHCmdHSHCClukMraqupoyT9C+AEaiUffHqvtrWax7OXoG8VLJR1CgzfAoFHuEr oxRbv88RvKbbS6B8VYyhe4aoRhm7QXVqH2DIUZOIxzTpL00lfwYiDDKNjLQz4FYGHQrH FI6qV+JJL2S/YGzARjCHN5NaCzmODDld+WPjA9aR+RB+OpyPvt04D3T+4jXLi5ZU4c7S QPe6bE2T9erYFwcQoq0LjidaFmFWdG6nMaTl3D4G7pUrZGEErEbfe5kNjAp20Fasb8zs bJsSLU3kUrWhkh4HtwWMgqVWs1MrhGuv3/WAD9lwrBLozwL9nZ6SniUaaOXtXvJY7gdR 4kEA==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Tue, 7 Jan 2014 10:22:18 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
RT-Message-ID: <rt-4.0.18-9527-1389097351-40.91764-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 5037
Download (untitled) / with headers
text/plain 4.9k
Hi, About the unique constraints, here is the modified method that also include unique indexes. I put first the original query to get the unique constraints and then the query to get unique indexes. After, I check if there is already another constraint having the same columns. If yes, skip, otherwise store as result. In my tests the program below brought the unique constraints ignoring its duplicated indexes that I had created previously. When there isn't a constraint but only unique index, the program added that to the result. Hope this helps. sub _table_uniq_info { my ($self, $table) = @_; my @uniqs; my $sth = $self->{_cache}->{db2_uniq} ||= $self->dbh->prepare(<<'EOF'); SELECT trim(kcu.colname), trim(kcu.constname), kcu.colseq FROM syscat.tabconst as tc JOIN syscat.keycoluse as kcu ON tc.constname = kcu.constname AND tc.tabschema = kcu.tabschema AND tc.tabname = kcu.tabname WHERE tc.tabschema = ? and tc.tabname = ? and tc.type = 'U' UNION SELECT trim(sc.colname), trim(si.name), sc.colseq FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND si.uniquerule = 'U' EOF $sth->execute($table->schema, $table->name, $table->schema, $table->name); my %keydata; my %cache; while(my $row = $sth->fetchrow_arrayref) { my ($col, $constname, $seq) = @$row; push(@{$keydata{$constname}}, [ $seq, $self->_lc($col) ]); } foreach my $keyname (keys %keydata) { my @ordered_cols = map { $_->[1] } sort { $a->[0] <=> $b->[0] } @{$keydata{$keyname}}; if ($cache{join '+', @ordered_cols}){ #print "Skipping $keyname since another constraint exists with the same columns\n"; next; } else { $cache{join '+', @ordered_cols}=1; } push(@uniqs, [ $keyname => \@ordered_cols ]); } $sth->finish; return \@uniqs; } On Mon, Jan 6, 2014 at 8:46 PM, Carlos Eduardo Panazzolo Guidugli < guidugli@gmail.com> wrote: Show quoted text
> Hi, found the problem that prevented DBIx-Class-Schema-Loader from getting > the relationships. > > On the file /usr/local/share/perl5/DBIx/Class/Schema/Loader/DBI/DB2.pm, > method _table_fk_info, the query is currently: > my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); > SELECT tc.constname, sr.reftabschema, sr.reftabname, > kcu.colname, rkcu.colname, kcu.colseq, > sr.deleterule, sr.updaterule > FROM ........ > > The problem is that DB2 retrieves some columns preserving spaces at its > end. So, the sr.reftabschema was bringing 'MYSCHEMA ' instead of > 'MYSCHEMA'. > > To solve this problem I changed the query to: > my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); > SELECT trim(tc.constname), trim(sr.reftabschema), trim(sr.reftabname), > trim(kcu.colname), trim(rkcu.colname), kcu.colseq, > sr.deleterule, sr.updaterule > FROM ......... > > With this change I was able to retrieve relation information. > > Another point that I'd like to show is about UNIQUE constraint in method > _table_uniq_info. In DB2, it is possible to create a UNIQUE constraint, or > a UNIQUE index with exactly the same effect. I was using unique indexes, so > none appeared on the model. In order to make it work I created the unique > constraints as well. I am new to DBIx, but what would happen if there are > two unique constraints in the resulting class, as shown in the example > below. > > __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_UN", ["slname"]); > __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_IDX", ["slname"]); > > If this is not a problem, maybe the query could be changed to retrieve > unique indexes as well: > > SELECT sc.colname, si.name, sc.colseq > FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc > WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND > si.uniquerule = 'U' > > UNION > > SELECT kcu.colname, kcu.constname, kcu.colseq > FROM syscat.tabconst as tc > JOIN syscat.keycoluse as kcu > ON tc.constname = kcu.constname > AND tc.tabschema = kcu.tabschema > AND tc.tabname = kcu.tabname > WHERE tc.tabschema = ? and tc.tabname = ? and tc.type = 'U' > > What do you think? Also, it may be a safe bet to add TRIM to char, varchar > columns that have strings with variable length. > > Thank you > > > On Mon, Jan 6, 2014 at 3:47 PM, Carlos Eduardo Panazzolo Guidugli < > guidugli@gmail.com> wrote: >
>> Thank you. Do you of any bug regarding relationships? Somehow the loader >> detects the primary keys but is not building the has_many, belongs_to, etc >> methods. >> On Jan 2, 2014 8:07 PM, "Dagfinn Ilmari Mannsaker via RT" < >> bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: >>
>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=91764 > >>> >>> Thank you for testing. >>> >>> It turns out there was already a fix for this by Matt Phillips on a >>> branch, so I've merged that and it'll be in the next release. >>>
>>
>
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 7613
From guidugli [...] gmail.com Tue Jan 7 10: 06:01 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <CAP5P6gUMCfz_njY_fLyFQXK4x8D7f+8gNVUvE9j2Qa0ThdjsGg [...] mail.gmail.com>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-91764 [...] rt.cpan.org> <CAP5P6gU8Qi=+9R_+g8C3y7WUYXM5-Y4qLWFQGtMzr8y+NE-adA [...] mail.gmail.com> <rt-4.0.18-6799-1388700477-887.91764-6-0 [...] rt.cpan.org> <CAP5P6gVMNkNE0PdDTyJf8L3fj9W4Gx9mYwyacNkuuL3QdhccRA [...] mail.gmail.com> <CAP5P6gXhRYoxLnWHpW99qDr36mBtGWo34xb9MMOJkMeaKYryxw [...] mail.gmail.com> <CAP5P6gUMCfz_njY_fLyFQXK4x8D7f+8gNVUvE9j2Qa0ThdjsGg [...] mail.gmail.com>
X-Virus-Checked: Checked
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.174.167 with SMTP id bt7mr1776419oec.54.1389107146131; Tue, 07 Jan 2014 07:05:46 -0800 (PST)
Message-ID: <CAP5P6gXcBTPUk3TiFod+bU2fL4iCwSGA4nne85Xy=beELoD+iQ [...] mail.gmail.com>
Content-Type: multipart/mixed; boundary="047d7bd6c03e0020eb04ef62b6d1"
X-Spam-Score: -2.698
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 5CACE240B61 for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 7 Jan 2014 10:06:01 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QDSfJD2NaSLA for <cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com>; Tue, 7 Jan 2014 10:05:59 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 54A48240B99 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 7 Jan 2014 10:05:57 -0500 (EST)
Received: (qmail 26775 invoked by alias); 7 Jan 2014 15:05:56 -0000
Received: from mail-ob0-f173.google.com (HELO mail-ob0-f173.google.com) (209.85.214.173) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 07 Jan 2014 07:05:50 -0800
Received: by mail-ob0-f173.google.com with SMTP id gq1so262900obb.18 for <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>; Tue, 07 Jan 2014 07:05:46 -0800 (PST)
Received: by 10.182.248.133 with HTTP; Tue, 7 Jan 2014 07:05:45 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #91764] DB2 Tables not being loaded
Return-Path: <guidugli [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9GcbcCcZWe+nYMrmf7ZAVA2TSPIFsMSy+Jcme0fa6WM=; b=q1C1cipGieoIS3RMM9bDQ8ddaeV4dUFtwDBz1vMCAn5VeJjxiXhVHyrgt+ZWVrbfP5 3nmC/atncxDL4EWdZMLAz1nSMxOzHCAJRqYbxzRN833LhX/xCvbPKQiXsEqbU/9Cm0Rc 6yJMNO1vuz+gFx3vxqFxBkKx+uhRGUH4KWo3+RZzxEwpjgAsXUc4KFU5hKD5kZqUBHKm mzlbyNxjpOPRxHlMRMfdvivi+8otbUjTsnn6GtkL4wWGvu0vIiBGqiO/D2All4IEwy5d r2FDnkJNTJxs9o5jD2OZlSzMQm7SQgxzFvR5UdQ4iEjLY6OjVjgJxPDMvF18xdAD1dAQ y5kg==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class-Schema-Loader [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class-schema-loader
Date: Tue, 7 Jan 2014 13:05:45 -0200
X-Spam-Level:
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Carlos Eduardo Panazzolo Guidugli <guidugli [...] gmail.com>
RT-Message-ID: <rt-4.0.18-13693-1389107162-1687.91764-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: multipart/alternative; boundary="047d7bd6c03e0020e804ef62b6cf"
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 6360
Download (untitled) / with headers
text/plain 6.2k
Sorry about all the emails, but I found something else related to unique constraints. The query: SELECT trim(sc.colname), trim(si.name), sc.colseq FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND si.uniquerule = 'U' Will return unique indexes AND unique constraints that do not have unique indexes. For example, suppose I have a constraint USER_EMAIL_UN (email column only). If I did not create a unique index, it will be shown in the query above. If I do create a unique index for the same column, then the index will be retrieved with the query above. If the only important thing is to know the columns that have unique restriction, than the query above may suffice. I am sending the result of the orginal query and the query above. I did create unique constraint for most of the unique indexes so I could use the original version, but notice that there are a couple of additional lines for the index that I did not had the unique constraint created. On Tue, Jan 7, 2014 at 10:22 AM, Carlos Eduardo Panazzolo Guidugli < guidugli@gmail.com> wrote: Show quoted text
> Hi, > > About the unique constraints, here is the modified method that also > include unique indexes. I put first the original query to get the unique > constraints and then the query to get unique indexes. After, I check if > there is already another constraint having the same columns. If yes, skip, > otherwise store as result. > > In my tests the program below brought the unique constraints ignoring its > duplicated indexes that I had created previously. When there isn't a > constraint but only unique index, the program added that to the result. > > Hope this helps. > > > sub _table_uniq_info { > my ($self, $table) = @_; > > my @uniqs; > > my $sth = $self->{_cache}->{db2_uniq} ||= $self->dbh->prepare(<<'EOF'); > SELECT trim(kcu.colname), trim(kcu.constname), kcu.colseq > FROM syscat.tabconst as tc > JOIN syscat.keycoluse as kcu > ON tc.constname = kcu.constname > AND tc.tabschema = kcu.tabschema > AND tc.tabname = kcu.tabname > WHERE tc.tabschema = ? and tc.tabname = ? and tc.type = 'U' > UNION > SELECT trim(sc.colname), trim(si.name), sc.colseq > FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc > WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND > si.uniquerule = 'U' > > EOF > > $sth->execute($table->schema, $table->name, $table->schema, > $table->name); > > my %keydata; > my %cache; > while(my $row = $sth->fetchrow_arrayref) { > my ($col, $constname, $seq) = @$row; > push(@{$keydata{$constname}}, [ $seq, $self->_lc($col) ]); > } > foreach my $keyname (keys %keydata) { > my @ordered_cols = map { $_->[1] } sort { $a->[0] <=> $b->[0] } > @{$keydata{$keyname}}; > if ($cache{join '+', @ordered_cols}){ > #print "Skipping $keyname since another constraint exists with > the same columns\n"; > next; > } else { > $cache{join '+', @ordered_cols}=1; > } > push(@uniqs, [ $keyname => \@ordered_cols ]); > } > > $sth->finish; > > return \@uniqs; > } > > > > On Mon, Jan 6, 2014 at 8:46 PM, Carlos Eduardo Panazzolo Guidugli < > guidugli@gmail.com> wrote: >
>> Hi, found the problem that prevented DBIx-Class-Schema-Loader from >> getting the relationships. >> >> On the file /usr/local/share/perl5/DBIx/Class/Schema/Loader/DBI/DB2.pm, >> method _table_fk_info, the query is currently: >> my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); >> SELECT tc.constname, sr.reftabschema, sr.reftabname, >> kcu.colname, rkcu.colname, kcu.colseq, >> sr.deleterule, sr.updaterule >> FROM ........ >> >> The problem is that DB2 retrieves some columns preserving spaces at its >> end. So, the sr.reftabschema was bringing 'MYSCHEMA ' instead of >> 'MYSCHEMA'. >> >> To solve this problem I changed the query to: >> my $sth = $self->{_cache}->{db2_fk} ||= $self->dbh->prepare(<<'EOF'); >> SELECT trim(tc.constname), trim(sr.reftabschema), trim(sr.reftabname), >> trim(kcu.colname), trim(rkcu.colname), kcu.colseq, >> sr.deleterule, sr.updaterule >> FROM ......... >> >> With this change I was able to retrieve relation information. >> >> Another point that I'd like to show is about UNIQUE constraint in method >> _table_uniq_info. In DB2, it is possible to create a UNIQUE constraint, or >> a UNIQUE index with exactly the same effect. I was using unique indexes, so >> none appeared on the model. In order to make it work I created the unique >> constraints as well. I am new to DBIx, but what would happen if there are >> two unique constraints in the resulting class, as shown in the example >> below. >> >> __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_UN", ["slname"]); >> __PACKAGE__->add_unique_constraint("SERVICELINE_SLNAME_IDX", ["slname"]); >> >> If this is not a problem, maybe the query could be changed to retrieve >> unique indexes as well: >> >> SELECT sc.colname, si.name, sc.colseq >> FROM sysibm.sysindexes si, sysibm.sysindexcoluse sc >> WHERE si.tbcreator=? and si.name=sc.indname and si.tbname=? AND >> si.uniquerule = 'U' >> >> UNION >> >> SELECT kcu.colname, kcu.constname, kcu.colseq >> FROM syscat.tabconst as tc >> JOIN syscat.keycoluse as kcu >> ON tc.constname = kcu.constname >> AND tc.tabschema = kcu.tabschema >> AND tc.tabname = kcu.tabname >> WHERE tc.tabschema = ? and tc.tabname = ? and tc.type = 'U' >> >> What do you think? Also, it may be a safe bet to add TRIM to char, >> varchar columns that have strings with variable length. >> >> Thank you >> >> >> On Mon, Jan 6, 2014 at 3:47 PM, Carlos Eduardo Panazzolo Guidugli < >> guidugli@gmail.com> wrote: >>
>>> Thank you. Do you of any bug regarding relationships? Somehow the loader >>> detects the primary keys but is not building the has_many, belongs_to, etc >>> methods. >>> On Jan 2, 2014 8:07 PM, "Dagfinn Ilmari Mannsaker via RT" < >>> bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: >>>
>>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=91764 > >>>> >>>> Thank you for testing. >>>> >>>> It turns out there was already a fix for this by Matt Phillips on a >>>> branch, so I've merged that and it'll be in the next release. >>>>
>>>
>>
>
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 9344
content-type: text/plain; charset="utf-8"; name="Result_NewQuery.txt"
X-Attachment-ID: f_hq5aeldm0
Content-Disposition: attachment; filename="Result_NewQuery.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
Content-Length: 1537

Message body is not shown because sender requested not to inline it.

content-type: text/plain; charset="utf-8"; name="Result_OriginalQuery.txt"
X-Attachment-ID: f_hq5aep8q1
Content-Disposition: attachment; filename="Result_OriginalQuery.txt"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
Content-Length: 1295

Message body is not shown because sender requested not to inline it.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.