Yep, it's just like I said above, in the "mysql_execute(con...."
command/line, you'll even notice the code highlighting in your email shows
that "John" is highlighted as a value instead of a text. That's because the
double quote right before John is ending the string that starts with
"INSERT...".

You need to escape the double quotes there or, as I said, use single
quotes, so that line would be:

mysql_execute(con, "INSERT INTO Employee (Name, Salary, JoinDate)
values ('John', 25000.00, '2015-12-12'), ('Sam', 35000.00,
'2012-18-17), ('Tom', 50000.00, '2013-12-14');")

Also feel free to checkout https://github.com/JuliaDB/ODBC.jl, it's a
great package for interacting with a variety of databases through the
common ODBC framework, most heavily tested against MySQL.

-Jacob


On Tue, Jun 14, 2016 at 1:53 PM, Ingemar Skarpås <[email protected]> wrote:

> Well - it is this sample code- direct from Github for MySQL.jl -only
> modification i adrress username et c in the con=mysql_connect(). And the
> same works for the MySQL test suite. And the code works up until row 14 in
> this case. I my code I have a few more comments I've added but teh
> executable code is the same!
>
> using MySQL
> con = mysql_connect("192.168.23.24", "username", "password", "db_name")
> command = """CREATE TABLE Employee
>              (
>                  ID INT NOT NULL AUTO_INCREMENT,
>                  Name VARCHAR(255),
>                  Salary FLOAT,
>                  JoinDate DATE,
>                  PRIMARY KEY (ID)
>              );"""
> mysql_execute(con, command)
>
> # Insert some values
> mysql_execute(con, "INSERT INTO Employee (Name, Salary, JoinDate) values 
> ("John", 25000.00, '2015-12-12'), ("Sam", 35000.00, '2012-18-17), ("Tom", 
> 50000.00, '2013-12-14');")
>
> # Get SELECT results
> command = "SELECT * FROM Employee;"
> dframe = mysql_execute(con, command)
>
> # Close connection
> mysql_disconnect(con)
>
>
>
>
> Den tisdag 14 juni 2016 kl. 19:01:49 UTC+2 skrev Stefan Karpinski:
>>
>> On Tue, Jun 14, 2016 at 11:50 AM, Ingemar Skarpås <[email protected]>
>> wrote:
>>
>>> LoadError:UdefVarError: @John_str not defined
>>
>>
>> This bit indicates that you've written something like this: John"...".
>> This is translated to a macro call to a macro named @John_str.
>>
>>

Reply via email to