From: Date: April 25 2005 4:02pm Subject: RE: MYSQL to XML List-Archive: http://lists.mysql.com/mysql/183075 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; format=flowed Thanx Mathias for your quick and effective response, I see that your program almost display the format that I need, the thing is that I need the foreign key information too, Does MySQL have a statement besides "show create table" to display this information?....Thanks again for your suggestions and help Greetings >From: "mathias fatene" >To: >CC: >Subject: RE: MYSQL to XML >Date: Sun, 24 Apr 2005 21:39:14 +0200 >MIME-Version: 1.0 >Received: from lists.mysql.com ([213.136.52.31]) by mc3-f23.hotmail.com >with Microsoft SMTPSVC(6.0.3790.211); Sun, 24 Apr 2005 12:42:26 -0700 >Received: (qmail 15912 invoked by uid 109); 24 Apr 2005 19:40:50 -0000 >Received: (qmail 15893 invoked from network); 24 Apr 2005 19:40:50 -0000 >Received: pass (lists.mysql.com: local policy) >X-Message-Info: JGTYoYF78jEQFMtosA6GPW/w+/WF28t94KBGDmreITY= >Mailing-List: contact mysql-help@stripped; run by ezmlm >List-ID: >Precedence: bulk >List-Help: >List-Unsubscribe: > >List-Post: >List-Archive: http://lists.mysql.com/mysql/183030 >Delivered-To: mailing list mysql@stripped >X-MSMail-Priority: Normal >X-Mailer: Microsoft Outlook, Build 10.0.2616 >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 >X-Virus-Checked: Checked >Return-Path: mysql-return-183030-ironmitss=hotmail.com@stripped >X-OriginalArrivalTime: 24 Apr 2005 19:42:26.0285 (UTC) >FILETIME=[BE1839D0:01C54905] > >Hi Mikel, >There are a lot of possibilities including commercial (:o)) products. >I suggest you those solutions. The output should be reparsed for your >needs : >1. the -X on client : > C:\Mysql>mysql -u mathias world -X -e "desc country" > > > > > Code > char(3) > > PRI > > > > > Name > char(52) > > > > > > > > Continent >... >... > >2. install perl DBI and DBIx-XML_RDB modules : >#!perl -w ># --------------------------------------------------------------- ># Describe2xml ># Author : Mathias FATENE ># Date : 24 april 2005 ># --------------------------------------------------------------- >use DBIx::XML_RDB; > > my $userid='root'; > my $password='**************'; > my $dbname='world'; > my $dsn = "DBI:mysql:database=$dbname;host=localhost"; > > my $xmlout = DBIx::XML_RDB->new($dsn,'mysql',$userid, $password) || die >"Failed to make new xmlout"; > > $xmlout->DoSql("describe country"); > print $xmlout->GetData; > >C:\Mysql>perl describe.pl > > > > > Code > char(3) > > PRI > > > > > Name > char(52) > > > > > > >... >... >3. install Perl DBI and DBD-Mysql and use my program (formatted for your >needs) : >#!perl -w ># --------------------------------------------------------------- ># Describe2xml ># Author : Mathias FATENE ># Date : April, 24 2005 ># --------------------------------------------------------------- >use DBI; > > my $userid='root'; > my $password='************'; > my $dbname='world'; > my $dsn = "DBI:mysql:database=$dbname;host=localhost"; > > my $dbh = DBI->connect($dsn,$userid, $password,{'RaiseError' => 1}); > # --------------------------------------------------------------- > # describe country table and print it in XML format > # --------------------------------------------------------------- > my $table="country"; > $sth = $dbh->prepare("describe $table"); > $sth->execute(); > > print "\\n"; > while (my @ref = $sth->fetchrow_array()) { > print "\type=\"$ref[1]\""; > print " primaryKey=\"true\"" if ($ref[3] eq "PRI") ; > print "/\>\n"; > } > $sth->finish(); > print "\\n"; > > # Disconnect from the database. > $dbh->disconnect(); > >C:\Mysql>perl desc.pl country >
> > >type="enum('Asia','Europe','North >America','Africa','Oceania','Antarctica','South America')"/> > > > > > > > > > > > > >
> >is this beautifull ? > >I will modify Describe2xml.pl to be more parametrized (user, db, pass, >FK, ...) as soon as possible. > >Mathias > > > > >> Hi list, does it possible for MySQL to generate XML in the followin >format: > >> > >> > >> >> required="true" type="VARCHAR" size="10"/> > >> size="255"/> > >> > >> > >> > >> > >> onDelete="none"> > >> > >> > >>
> >> > >> This XML is the structure of the ServiceType table, I'll hope that >you >> can > >> help me > >> > >> Thnx in advanced > >> > >> Greetings > >> > >> P.S. Any suggestions (tools) will be appreciated > >> > >> > >> > >> Thread > >> > >> * MySQL to XML - Mikel -, April 23 2005 1:07am > >> > > > > > >-- >MySQL General Mailing List >For list archives: http://lists.mysql.com/mysql >To unsubscribe: http://lists.mysql.com/mysql?unsub=ironmitss@stripped >