[erlang-questions] MySQL and Erlang: ODBC , column type error

Kenneth Lundin <>
Mon May 11 19:58:56 CEST 2009


Please explain what problem you think there is with underscore in column names.
Can you give me an example (which works without underscore and fails
with underscore).


/Kenneth Erlang/OTP Ericsson

On Mon, May 11, 2009 at 6:53 PM, Carl McDade <> wrote:
> Ahh! I can see I still have not gotten the hang of immutable
> variables. Thanks for the reminders.
>
> It is a shame though about the underscore in the column names.
> Migration from other languages is a pain when database rules of the
> language is so strict. It means not only changing the database schema
> but recoding the applications. This usually leads to some type of
> abstraction layer later on which may slow down ODBC more.
>
> Are there any "documented" native drivers around? The Yxa - process
> one driver and others have no documentation at all.
>
> /Carl
>
> On Mon, May 11, 2009 at 6:16 PM, Robert Raschke <> wrote:
>>
>> On Mon, May 11, 2009 at 4:53 PM, Carl McDade <> wrote:
>>>
>>> I am beginning to think this is a bug because the underscore does not
>>> have to be in the query. Its appearance in the result causes things to
>>> crash.
>>>
>>> 5> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> ** exception error: no match of right hand side value
>>>                    {selected,["NR","FIRSTNAME","LASTNAME","GENDER","town",
>>>                               "tel_no"],
>>>
>>>  [{1,"carl","mcdade","m","hayward","23562366"},
>>>                               {2,"john","mason","m","san
>>> pablo","55214569"}]}
>>> 6> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> ** exception error: no match of right hand side value {error,
>>>                                                       connection_closed}
>>> 7> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> ** exception error: no match of right hand side value {error,
>>>                                                       connection_closed}
>>> 8>
>>>
>>> The above causes werl.exe to crash and have to be restarted to get any
>>> response. You can only get a query response once before the underscore
>>> kills things.
>>>
>>> After removing the underscore from the column name the query runs as
>>> it should and as many times as it is called.
>>>
>>> Eshell V5.7.1  (abort with ^G)
>>> 1> application:start(odbc).
>>> ok
>>> 2> ConnString = "Driver={MySQL ODBC 5.1
>>>
>>> Driver};Server=localhost;Database=wordpress;User=root;Password=;Option=3;".
>>> "Driver={MySQL ODBC 5.1
>>> Driver};Server=localhost;Database=wordpress;User=root;Password=;Option=3;"
>>> 3> {ok, Conn} = odbc:connect(ConnString, []).
>>> {ok,<0.40.0>}
>>> 4> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> {selected,["NR","FIRSTNAME","LASTNAME","GENDER","town",
>>>           "telno"],
>>>          [{1,"carl","mcdade","m","hayward","23562366"},
>>>           {2,"john","mason","m","san pablo","55214569"}]}
>>> 5> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> {selected,["NR","FIRSTNAME","LASTNAME","GENDER","town",
>>>           "telno"],
>>>          [{1,"carl","mcdade","m","hayward","23562366"},
>>>           {2,"john","mason","m","san pablo","55214569"}]}
>>> 6> Results = odbc:sql_query(Conn, "SELECT * FROM employee").
>>> {selected,["NR","FIRSTNAME","LASTNAME","GENDER","town",
>>>           "telno"],
>>>          [{1,"carl","mcdade","m","hayward","23562366"},
>>>           {2,"john","mason","m","san pablo","55214569"}]}
>>> 7>
>>>
>>
>> Umm, you are matching agains the bound name Results over and over. Remember
>> that you need a fresh name to capture new results.
>>
>> And also, the odbc process handling the connection is linked to the shell
>> process, when you get an error, the shell is restarted and therefore the
>> link breakage causes your connection to go away as well.
>>
>> Robby
>>
>>
>>
>>
>
>
>
> --
> Carl McDade
> Content Management Systems Consultant
> www.hiveminds.co.uk
> ________________________
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list