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 <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>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


---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to