Menu

#119 mdb-schema doesn't quote col/table names

open
nobody
5
2008-01-17
2008-01-17
Anonymous
No

mdb-schema -I creates DDL for creating tables.
A table or column name that contains spaces causes problems. Other tools seem to quote all table and column names in backticks.

For example, mdb-schema outputs this:

DROP TABLE SRN1 COLLECTION TB;
CREATE TABLE SRN1COLLECTIONTB
(
COL_COLLECTION Text (2),
COL_DESC Text (20)
);

Where Navicat outputs:

CREATE TABLE `SRN1 COLLECTION TB` (
`COL_COLLECTION` tinytext,
`COL_DESC` tinytext
)

I would never create a table name with spaces in it, and I'm not sure I even could with mysql. I suspect Access users live in a different world and that spaces in a table name is not uncommon. I am seeing this in a commercial application's database right now.

Discussion

  • Nobody/Anonymous

    I've a similar problem with libmdbodbc or mdb-sql in reading from a table with '-' in the name. mdbtools look for a table which name is only the prefix ( %prefix%-%etc% )

    laj@ubuntu:~$ mdb-sql /mnt/server_web/win_c/ecm/ecm2.mdb
    1 => list tables
    2 => go

    +------------------------------+
    |Tables |
    +------------------------------+
    |ECMTAB1 |
    |FATTURATI |
    |MAGAZZINO-2005 |
    |MAGAZZINO-2006 |
    |MAGAZZINO-2007 |
    |MAGAZZINO-2008 |
    +------------------------------+
    6 Rows retrieved
    1 => SELECT * FROM MAGAZZINO-2008 WHERE CLIENTE='BONGI'
    2 => go
    MAGAZZINO is not a table in this database
    Error at Line : syntax error near -2008

    1 => quit

    maybe I can escape this in some way, I don't know.

     
  • Maiettasrl

    Maiettasrl - 2008-09-26

    Sorry, I'm the same user of the comment above( after signed-in and logged-in )

    I forgot to say that
    MS ODBC driver however need the table name is enclosed in square bracket [] to work.

    but this doesn't work with libmdbodbc

     

Log in to post a comment.