logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: SQLForeignKeys result-set question: msg#00011

db.mysql.odbc

Subject: Re: SQLForeignKeys result-set question

Martin J. Evans wrote:

On 06-Nov-2005 jbonnett@xxxxxxxxxxx wrote:

I would think the back-ticks (not single quotes) are there because '_'
is a wild card character in SQL and 'type' is a keyword.

I guess the back-ticks are not there in your later example because it is
just the output of a query.

John B.

Martin asked me to take a look at this. The attached patch should do the trick.

The problem as far as I can see is the primary and foreign column information comes from the line

InnoDB free: 11264 kB; (`type`) REFER `martin/eventtype`(`eventtype_id`); (`mark

And I think the driver just needs to remove the quotes.

--
Nick Gorham
Easysoft Limited
diff -r -u mysql-connector-odbc-3.51.12/driver/catalog.c
mysql-connector-odbc-3.51.12a/driver/catalog.c
--- mysql-connector-odbc-3.51.12/driver/catalog.c 2005-10-09
20:33:40.000000000 +0100
+++ mysql-connector-odbc-3.51.12a/driver/catalog.c 2005-11-08
11:02:38.000000000 +0000
@@ -1978,9 +1978,27 @@
{
/* Multiple columns exists .. parse them to individual
rows */
char **prev_data= data;
- data[7]= strdup_root(alloc,ref_token); /*
FKTABLE_COLUMN */
+ /*
+ * remove quote chars
+ */
+ if ( ref_token[ 0 ] == '`' )
+ {
+ data[7]= strdup_root(alloc,ref_token+1); /*
FKTABLE_COLUMN */
+ data[7][strlen(data[7])-1 ] = '\0';
+ }
+ else {
+ data[7]= strdup_root(alloc,ref_token); /*
FKTABLE_COLUMN */
+ }
pktoken= my_next_token(pktoken,&pkcomment,ref_token,'
');
- data[3]= strdup_root(alloc,ref_token); /*
PKTABLE_COLUMN */
+ if ( ref_token[ 0 ] == '`' )
+ {
+ data[3]= strdup_root(alloc,ref_token+1); /*
FKTABLE_COLUMN */
+ data[3][strlen(data[3])-1 ] = '\0';
+ }
+ else
+ {
+ data[3]= strdup_root(alloc,ref_token); /*
PKTABLE_COLUMN */
+ }
sprintf(ref_token,"%d",key_seq++);
data[8]= strdup_root(alloc,ref_token); /* KEY_SEQ */
data+= SQLFORE_KEYS_FIELDS;
@@ -1988,8 +2006,25 @@
for ( fk_length= SQLFORE_KEYS_FIELDS; fk_length--; )
data[fk_length]= prev_data[fk_length];
}
- data[7]= strdup_root(alloc,fkcomment); /*
FKTABLE_COLUMN */
- data[3]= strdup_root(alloc,pkcomment); /*
PKTABLE_COLUMN */
+ /*
+ * remove quote chars
+ */
+ if ( fkcomment[ 0 ] == '`' )
+ {
+ data[7]= strdup_root(alloc,fkcomment+1); /*
FKTABLE_COLUMN */
+ data[7][strlen(data[7])-1 ] = '\0';
+ }
+ else {
+ data[7]= strdup_root(alloc,fkcomment); /*
FKTABLE_COLUMN */
+ }
+ if ( pkcomment[ 0 ] == '`' )
+ {
+ data[3]= strdup_root(alloc,pkcomment+1); /*
PKTABLE_COLUMN */
+ data[3][strlen(data[3])-1 ] = '\0';
+ }
+ else {
+ data[3]= strdup_root(alloc,pkcomment); /*
PKTABLE_COLUMN */
+ }
sprintf(ref_token,"%d",key_seq);
data[8]= strdup_root(alloc,ref_token); /* KEY_SEQ */


--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@xxxxxxxxxxx
<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo