Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Problems opening db in win9x and utf8 filename

    5 answers - 5896 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi John,
    Have you tried to use sqlite3_open with a path that contains non-ascii chars
    and make it work at the same time in Win9x and win2K?
    The 2 apps I mentioned before (sqLiteExplorer and SQLiteSpy) both fail the
    above test (and for a good reason)
    Costas
    P.S. As I said, you can make an app work on both of these Ss, but with
    external manipulation.
    Message
    From: John Stanton [mailto:johns (AT) viacognis (DOT) com]
    Sent: Tuesday, August 08, 2006 11:13 AM
    To: sqlite-users (AT) sqlite (DOT) org
    Subject: Re: [sqlite] Problems opening db in win9x and utf8 filename
    Sqlite applications work not only on Win98 and Win2000 but also on
    Linux, AIX and Solaris. Where did we go wrong?
    Costas Stergiou wrote:
    Hi all,
    I saw no more comments on this suggestion. It is very simple to program
    around this issue in user code, but I would like to see it fixed in the
    library level. Unless someone has made this work-around in his code, an
    application cannot work at the same time in Win9x and Win2k if there is
    any
    ansii char in the filepath.
    Costas
    >
    >
    >
    >Message
    >>From: Costas Stergiou [mailto:root (AT) theword (DOT) gr]
    >>Sent: Saturday, August 05, 2006 11:47 PM
    >>To: sqlite-users (AT) sqlite (DOT) org
    >>Subject: RE: [sqlite] Problems opening db in win9x and utf8 filename
    >>
    >>
    >>

    I no longer have a win98 system to test with, but based on my
    understanding
    os_win.c attempts to convert the filename from UTF-8 to UTF-16. If it
    succeeds, it calls CreateFileW;
    >>
    >>Actually, there is a flag there that caused the convertion to UTF-16 to
    >>'fail' (it doesn't really fail, just that the utf8ToUnicode returns 0).
    >>
    >>

    if it fails, it calls CreateFileA with
    the original string.
    >>
    >>Exactly
    >>
    >>

    CreateFileW is a nonfunctional stub on win98, so
    when you pass a UTF-8 filename sqlite takes that codepath and fails.
    An ANSI filename won't pass the UTF-8 conversion, so CreateFileA is
    called with the ANSI string.
    >>
    >>Actually, in Win98 it will pass the conversion, but as I said above, the
    >>function fails by a check: "if (!isNT())"
    >>
    >>

    That doesn't necessarily explain win2k though. Perhaps the current
    user locale does not match the ANSI encoding of the filename you're
    passing in? Internally win2k only uses the Unicode version, so
    CreateFileA must do an implict conversion to Unicode using the current
    user codepage.
    >>
    >>Now that I checked the code, it actually does.
    >>Unfortunately, the way the code is setup makes it necessary for the

    caller
    >>to check in which S it runs and either use UTF8 paths or ansii ones. I
    >>think this is not a good technique (and not actually intended from what

    I
    >>have read in the docs) since the sqlite3_open does not give a truly
    >>uniform
    >>interface to the caller.
    >>
    >>My suggestion is this:
    >>The sqlite3_open should always expect a utf8 path (as the docs say). If

    in
    >>win2k everything works fine. If in win98 it should convert the path to
    >>utf16
    >>and THEN convert it to ansii using the CP_ACP (current ansii code page).
    >>This will work for 99.9% cases since in non-English win9x S, almost

    99.9%
    >>ansii strings are in the system's locale.
    >>I think this is also the expected behavior (and what I have programmed

    my
    >>app to do, until I tested it in win98).
    >>
    >>To make these changes, all the logic of os_win.c should change to
    >>accommodate the above. I would certainly say that the way it currently
    >>works
    >>is wrong (bug).

    >course, there is the problem of breaking existing code (since many
    >>win9x
    >>user will not have read the docs, or else someone would have mentioned
    >>this
    >>behavior looong time agoe).
    >>To maintain compatibility (e.g. to accept ansii non-utf8 paths), a check
    >>can
    >>be made on whether the supplied path is in utf8 (heuristically this has
    >>almost 100% success) and then do the above.
    >>
    >>Costas
    >>
    >>
    >>
    >>

    MSLU does provide a functional CreateFileW wrapper for win9x, but I
    don't believe the stock sqlite binaries are built with it.
    8/5/06, Peter Cunderlik <peter.cunderlik (AT) gmail (DOT) comwrote:
    I think you will never succeed using UTF-8 encoded filenames on those
    systems. I don't know how it can be done programmatically, but each
    file or directory name has its 8.3 name as well, i.e. "Program Files"
    would be "progra~1". I think this is the safest way how to pass
    filenames to SQLite. It should work on Win 9x as well as 2K and XP.
    NTFS can have 8.3 shortname creation disabled. Systems running
    without it are not common but do exist, so you should avoid relying on
    them if at all possible.
    >
    >
    >
    >
  • No.1 | | 5859 bytes | |

    one has to have file names which do not clash with the rules
    of the underlying file system. If you need to map a name to suit the S
    you can detect the Windows S version in your application and enforce
    compatibility by having a lookup table or by mangling. As the old
    saying goes "In computer science any problem can be solved by yet
    another level of indirection".

    Costas Stergiou wrote:
    Hi John,
    Have you tried to use sqlite3_open with a path that contains non-ascii chars
    and make it work at the same time in Win9x and win2K?
    The 2 apps I mentioned before (sqLiteExplorer and SQLiteSpy) both fail the
    above test (and for a good reason)
    Costas

    P.S. As I said, you can make an app work on both of these Ss, but with
    external manipulation.


    >Message
    >>From: John Stanton [mailto:johns (AT) viacognis (DOT) com]
    >>Sent: Tuesday, August 08, 2006 11:13 AM
    >>To: sqlite-users (AT) sqlite (DOT) org
    >>Subject: Re: [sqlite] Problems opening db in win9x and utf8 filename
    >>

    >Sqlite applications work not only on Win98 and Win2000 but also on
    >>Linux, AIX and Solaris. Where did we go wrong?
    >>
    >>Costas Stergiou wrote:
    >>

    Hi all,
    I saw no more comments on this suggestion. It is very simple to program
    around this issue in user code, but I would like to see it fixed in the
    library level. Unless someone has made this work-around in his code, an
    application cannot work at the same time in Win9x and Win2k if there is
    >>
    >>any
    >>

    ansii char in the filepath.
    Costas

    Message
    From: Costas Stergiou [mailto:root (AT) theword (DOT) gr]
    Sent: Saturday, August 05, 2006 11:47 PM
    To: sqlite-users (AT) sqlite (DOT) org
    Subject: RE: [sqlite] Problems opening db in win9x and utf8 filename

    I no longer have a win98 system to test with, but based on my
    understanding

    os_win.c attempts to convert the filename from UTF-8 to UTF-16. If it
    succeeds, it calls CreateFileW;

    Actually, there is a flag there that caused the convertion to UTF-16 to
    'fail' (it doesn't really fail, just that the utf8ToUnicode returns 0).

    if it fails, it calls CreateFileA with
    the original string.

    Exactly

    CreateFileW is a nonfunctional stub on win98, so
    when you pass a UTF-8 filename sqlite takes that codepath and fails.
    An ANSI filename won't pass the UTF-8 conversion, so CreateFileA is
    called with the ANSI string.

    Actually, in Win98 it will pass the conversion, but as I said above, the
    function fails by a check: "if (!isNT())"

    That doesn't necessarily explain win2k though. Perhaps the current
    user locale does not match the ANSI encoding of the filename you're
    passing in? Internally win2k only uses the Unicode version, so
    CreateFileA must do an implict conversion to Unicode using the current
    user codepage.

    Now that I checked the code, it actually does.
    Unfortunately, the way the code is setup makes it necessary for the
    >>
    >>caller
    >>

    to check in which S it runs and either use UTF8 paths or ansii ones. I
    think this is not a good technique (and not actually intended from what
    >>
    >>I
    >>

    have read in the docs) since the sqlite3_open does not give a truly
    uniform
    interface to the caller.

    My suggestion is this:
    The sqlite3_open should always expect a utf8 path (as the docs say). If
    >>
    >>in
    >>

    win2k everything works fine. If in win98 it should convert the path to
    utf16
    and THEN convert it to ansii using the CP_ACP (current ansii code page).
    This will work for 99.9% cases since in non-English win9x S, almost
    >>
    >>99.9%
    >>

    ansii strings are in the system's locale.
    I think this is also the expected behavior (and what I have programmed
    >>
    >>my
    >>

    app to do, until I tested it in win98).

    To make these changes, all the logic of os_win.c should change to
    accommodate the above. I would certainly say that the way it currently
    works
    is wrong (bug).
    course, there is the problem of breaking existing code (since many
    win9x
    user will not have read the docs, or else someone would have mentioned
    this
    behavior looong time agoe).
    To maintain compatibility (e.g. to accept ansii non-utf8 paths), a check
    can
    be made on whether the supplied path is in utf8 (heuristically this has
    almost 100% success) and then do the above.

    Costas

    MSLU does provide a functional CreateFileW wrapper for win9x, but I
    don't believe the stock sqlite binaries are built with it.

    8/5/06, Peter Cunderlik <peter.cunderlik (AT) gmail (DOT) comwrote:

    I think you will never succeed using UTF-8 encoded filenames on those
    systems. I don't know how it can be done programmatically, but each
    file or directory name has its 8.3 name as well, i.e. "Program Files"
    would be "progra~1". I think this is the safest way how to pass
    filenames to SQLite. It should work on Win 9x as well as 2K and XP.

    NTFS can have 8.3 shortname creation disabled. Systems running
    without it are not common but do exist, so you should avoid relying on
    them if at all possible.

  • No.2 | | 3404 bytes | |

    Hi All,

    Two small notes first:

    1. SQL Maestro Group is NT linked with SQLight team, which messages you
    could read here last days.
    2. It's our first announce and we promise to community to NT send such
    messages too often - unfortunately, we don't release a new version every
    day. :-)

    Let's continue. So the SQL Maestro Group is happy to introduce to you two
    new tools for the SQLite server.

    The first product named SQLite Maestro. It is a software for efficient
    SQLite management, control and development, i.e. creating, editing, copying,
    extracting and dropping all the database objects, building queries visually,
    executing queries and SQL scripts, viewing and editing data (including
    BLBs), representing data as diagrams, exporting and importing data to/from
    most popular file formats, etc. The main features of this product are as
    follows:
    - Support of SQLite 2.8/3.3.6, including latest features such as check
    constraints and ASC/DESC indexes.
    - Possibility of creating and editing of all schema objects, which is
    implemented as a number of convenient wizards and non-modal editors.
    - Conception of database profiles gives you the opportunity to connect to
    databases in one touch and work with the selected databases only.
    - SQL Editor with syntax highlighting, code completion and executing several
    queries at a time in separate threads.
    - Visual Query Builder with SQL parser.
    - Some other useful tools such as SQL Script Editor, BLB Viewer/Editor,
    Diagram Viewer, Extract Database Wizard, etc.
    - and much more. Non-commercial license costs as low as $49. Fully
    functional 30-day evaluation version is available at

    The second software is SQLite Data Wizard.
    () It is a utility,
    which provides you with a number of easy-to-use wizards for performing the
    required data manipulation easily and quickly. Currently SQLite Data Wizard
    includes the following features:
    - PHP Generator Wizard: a powerful tool for generating PHP scripts from
    SQLite tables and queries. PHP Generator admits full customization of the
    resulting HTML appearance, customization of the resulting script, protection
    of your scripts with optional security settings.
    - Data Pump Wizard: allows you to transfer databases (both structure and
    data) from such sources as Microsoft SQL Server or MS Access to your SQLite
    database.
    - Data Export Wizard: powerful tools for exporting data from SQLite tables
    and queries to most popular formats (MS Excel, MS Access, MS Word, HTML,
    XML, PDF) are at your disposal.
    - Data Import Wizard: you can import data from MS Excel, MS Access, XML,
    DBF, TXT, CSV formats to your SQLite database.
    - Task Scheduler: one of the distinguishing features of SQLite Data Wizard
    consists in the ability to schedule tasks for executing them (once or
    periodically) later. A scheduled task starts a wizard with its template and
    does not require any actions from the user during execution.
    - course you can also try this software without any trial limitations.
    Feel free to download an evaluation version at

    Hope you will like our products.
    Sorry for such long message and thank you very much for your attention and
    patience.

    Best Regards,
    SQL Maestro Group Team
    http://www.sqlmaestro.com
  • No.3 | | 3582 bytes | |

    SQL Maestro Team wrote:
    Hi All,

    Two small notes first:

    1. SQL Maestro Group is NT linked with SQLight team, which messages you
    could read here last days.
    2. It's our first announce and we promise to community to NT send such
    messages too often - unfortunately, we don't release a new version every
    day. :-)

    Let's continue. So the SQL Maestro Group is happy to introduce to you
    two new tools for the SQLite server.

    The first product named SQLite Maestro. It is a software for efficient
    SQLite management, control and development, i.e. creating, editing,
    copying, extracting and dropping all the database objects, building
    queries visually, executing queries and SQL scripts, viewing and editing
    data (including BLBs), representing data as diagrams, exporting and
    importing data to/from most popular file formats, etc. The main features
    of this product are as follows:
    - Support of SQLite 2.8/3.3.6, including latest features such as check
    constraints and ASC/DESC indexes.
    - Possibility of creating and editing of all schema objects, which is
    implemented as a number of convenient wizards and non-modal editors.
    - Conception of database profiles gives you the opportunity to connect
    to databases in one touch and work with the selected databases only.
    - SQL Editor with syntax highlighting, code completion and executing
    several queries at a time in separate threads.
    - Visual Query Builder with SQL parser.
    - Some other useful tools such as SQL Script Editor, BLB Viewer/Editor,
    Diagram Viewer, Extract Database Wizard, etc.
    - and much more. Non-commercial license costs as low as $49. Fully
    functional 30-day evaluation version is available at

    The second software is SQLite Data Wizard.
    () It is a utility,
    which provides you with a number of easy-to-use wizards for performing
    the required data manipulation easily and quickly. Currently SQLite Data
    Wizard includes the following features:
    - PHP Generator Wizard: a powerful tool for generating PHP scripts from
    SQLite tables and queries. PHP Generator admits full customization of
    the resulting HTML appearance, customization of the resulting script,
    protection of your scripts with optional security settings.
    - Data Pump Wizard: allows you to transfer databases (both structure and
    data) from such sources as Microsoft SQL Server or MS Access to your
    SQLite database.
    - Data Export Wizard: powerful tools for exporting data from SQLite
    tables and queries to most popular formats (MS Excel, MS Access, MS
    Word, HTML, XML, PDF) are at your disposal.
    - Data Import Wizard: you can import data from MS Excel, MS Access, XML,
    DBF, TXT, CSV formats to your SQLite database.
    - Task Scheduler: one of the distinguishing features of SQLite Data
    Wizard consists in the ability to schedule tasks for executing them
    (once or periodically) later. A scheduled task starts a wizard with its
    template and does not require any actions from the user during execution.
    - course you can also try this software without any trial
    limitations. Feel free to download an evaluation version at

    Hope you will like our products.
    Sorry for such long message and thank you very much for your attention
    and patience.

    Best Regards,
    SQL Maestro Group Team
    http://www.sqlmaestro.com
    To Maestros and others. Please announce your new work as often as you
    choose and continue to share it with others. We are all the better for it.
  • No.4 | | 807 bytes | |

    Hi Maestro Group,

    >NT linked with SQLight team


    I guess that's a dig on me.
    They were FREE little tools I had laying around.
    Thought someone might get some use out of them.
    They won't know if I don't tell them.

    StanD
    http://www.sqlight.com/
    IS linked with SQLight team. :)
    Lots of free SQLite tools.

    Message Hi All,

    Two small notes first:

    1. SQL Maestro Group is NT linked with SQLight team, which messages you
    could read here last days.
    2. It's our first announce and we promise to community to NT send such
    messages too often - unfortunately, we don't release a new version every
    day. :-)

    Best Regards,
    SQL Maestro Group Team
    http://www.sqlmaestro.com
  • No.5 | | 558 bytes | |

    8/9/06, Me <igiga (AT) swbell (DOT) netwrote:
    Hi Maestro Group,
    >
    >NT linked with SQLight team
    >

    I guess that's a dig on me.

    I took that to mean that since there was a complaint about the
    frequency of announcements, they didn't want to be mistaken for you
    making another announcement on the same day.

    Personally I'm with the poster upthread; they aren't THAT bad, and
    both of you were kind enough to tag the subject line for easy
    filtering anyway.

Re: Problems opening db in win9x and utf8 filename


max 4000 letters.
Your nickname that display:
In order to stop the spam: 9 + 8 =
QUESTION ON "Databases"

EMSDN.COM