List:General Discussion« Previous MessageNext Message »
From:Mark Matthews Date:June 3 2002 2:09am
Subject:Re: ANSI mode determination?
View as plain text  
Dave Rolsky wrote:

>Is there any programmatic way (SQL, C-level API) way to determine whether
>or not a given mysql server is running in ANSI mode or not?
>
>If not, this would be most helpful, as otherwise it is impossible to
>know how to quote identifiers (` or ").
>
>
>-dave
>
>/*==================
>www.urth.org
>we await the New Sun
>==================*/
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread110758@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-mmatthew=thematthews.org@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>  
>
Sure. Check the server variable "sql_mode". For example, here's how my 
JDBC driver does it (it loads all of the results from "show variables in 
a hashtable named "_serverVariables"):

_hasQuotedIdentifiers = _io.versionMeetsMinimum(3, 23, 6);
           
            if (_serverVariables.containsKey("sql_mode"))
            {
                int sqlMode = Integer.parseInt((String)_serverVariables.get(
                    "sql_mode"));
                   
                if ((sqlMode & 4) > 0)
                {
                    _useAnsiQuotes = true;
                }
                else
                {
                    _useAnsiQuotes = false;
                }
            }


    -Mark

Thread
ENCODE algorithmEvgeny Chuykov3 Jun
  • ANSI mode determination?Dave Rolsky3 Jun
    • Re: ANSI mode determination?Mark Matthews3 Jun
  • Re: ENCODE algorithmmos3 Jun
  • Re: ENCODE algorithmT├Ánu Samuel3 Jun