Skip to content

add boolean (true/false atoms) - #130

Open
trollfred wants to merge 3 commits into
Eonblast:masterfrom
trollfred:patch-1
Open

add boolean (true/false atoms)#130
trollfred wants to merge 3 commits into
Eonblast:masterfrom
trollfred:patch-1

Conversation

@trollfred

Copy link
Copy Markdown

for niceness

@jlouis

jlouis commented Mar 19, 2014

Copy link
Copy Markdown
Collaborator

Could you provide a test case where it becomes clear that we support this feature and also gives an example of its use? I want coverage to go up in general in this project.

@jlouis

jlouis commented Apr 11, 2014

Copy link
Copy Markdown
Collaborator

bump :)

@ddosia

ddosia commented Jul 21, 2014

Copy link
Copy Markdown
MySQL [mydb]> CREATE TABLE test (is_error boolean not null);

(test@mypc)4> emysql:execute(mypool, "INSERT INTO test VALUES(?)", [true]).

MySQL [mydb]> SELECT * FROM test;
+----------+
| is_error |
+----------+
|        0 |
+----------+

If you do trace emysql_conn:set_params_packet/3 you will see:

(trace@mypc)9> (<6016.207.0>) call emysql_conn:set_params_packet(1,[true],utf8)
(<6016.207.0>) returned from emysql_conn:set_params_packet/3 -> <<3,83,69,84,
                                                                  32,64,49,61,
                                                                  39,116,114,
                                                                  117,101,39>>

It is equivalent to <<"SET @1='true'">>, note: true must not be in single quotes.

@trollfred

Copy link
Copy Markdown
Author

@ddosia I checked your case, but didn't see any quotes, in my log its
<<"@1=true,@2=false">> <<"@1=true">> <<"@1=false">> etc.
Seems like this bug is already solved, please, check

@ddosia

ddosia commented Nov 15, 2014

Copy link
Copy Markdown

@kittee I am sorry but it is still reproducible for me with master branch.
And I don't see why it shouldn't, until there is no special clause for atoms true and false in emysql_conn:encode/2

@trollfred

Copy link
Copy Markdown
Author

@ddosia That's because my PR is not merged into master yet (special clauses are here)

@ddosia

ddosia commented Nov 15, 2014

Copy link
Copy Markdown

@kittee I understand that, my example show what sout of confusion may occur without proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants