<br><div class="gmail_quote">On Mon, May 11, 2009 at 12:47 PM, Carl McDade <span dir="ltr"><<a href="mailto:carlmcdade@gmail.com">carlmcdade@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
Is this a problem with the driver (usually it is) or Erlangs use of the driver?<br>
<br>
5> ConnString = "Driver={MySQL ODBC 5.1<br>
Driver};Server=localhost;Database=wordpress;<br>
User=root;Password=;Option=3;".<br>
"Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=wordpress;<br>
User=root;Password=;Option=3;"<br>
6> {ok, Conn} = odbc:connect(ConnString, []).<br>
{ok,<0.43.0>}<br>
7> Results = odbc:sql_query(Conn, "SELECT post_title FROM wp_posts LIMIT 5").<br>
{error,"Column type not supported"}<br>
8> Results = odbc:sql_query(Conn, "SELECT post_name FROM wp_posts LIMIT 5").<br>
{error,"Column type not supported"}<br>
9> Results = odbc:sql_query(Conn, "SELECT * FROM wp_posts LIMIT 5").<br>
{error,"Column type not supported"}<br>
10> Results = odbc:sql_query(Conn, "SELECT option_name FROM wp_options").<br>
{error,"Column type not supported"}<br>
11> Results = odbc:sql_query(Conn, "SELECT OPTION_NAME FROM wp_options").<br>
{error,"Column type not supported"}<br>
<br>
<br>
It seems to me that there is a flaw in what the ODBC driver is sending<br>
and what Erlang can understand. But in might also be a bug since I<br>
doubt many use MySQL in conjunction with Erlang. So maybe no one has<br>
tested this?<br>
<br>
<br>
Can someone toss me a bone?<br>
</blockquote><div><br>The Erlang ODBC driver doesn't do BLOB or national character data types (I think dates aren't in there either, but can't remember). When you issue SQL queries, write them so that they return regular (char or varchar) strings or numbers.<br>
<br>Assuming option_name is an nvarchar, you could try:<br>odbc:sql_query(Conn, "SELECT {fn CONVERT(option_name, SQL_VARCHAR)} FROM wp_options").<br><br>One of the odbc functions (odbc:describe_table/2) gives you the types of the columns in a table. I think that pointed out if something wasn't going to be supported.<br>
<br>Hope this gets you a bit further,<br>Robby<br><br><br></div></div><br>