Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDO/Adapter: decribeColumns method fixes. #1562

Merged
merged 4 commits into from
Dec 19, 2013
Merged

PDO/Adapter: decribeColumns method fixes. #1562

merged 4 commits into from
Dec 19, 2013

Conversation

lantian
Copy link
Contributor

@lantian lantian commented Nov 17, 2013

  • added tinyint(1) as boolean for mysql, oracle, postresql, sqlite.
  • added timestamp as date for mysql.
  • decribeColumns method has been refactored in oracle, postesql, sqlite.
  • added constraint creation for foreign key

if (phalcon_memnstr_str(column_type, SL("tinyint(1)"))) {
phalcon_array_update_string_long(&definition, SL("type"), 8, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 5, PH_SEPARATE);
ZVAL_STRING(column_type, "boolean", 1); // Change column type to skip size check.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak here

@lantian
Copy link
Contributor Author

lantian commented Nov 18, 2013

Ok, thanks. But what is wrong? With zval function? I'am not very familiar with C =)

@ghost
Copy link

ghost commented Nov 18, 2013

The issue is that the old string value is not freed — and when you assign boolean to the zval, tinyint(1) is not freed and is lost forever.

I will tell you how to fix this a bit later — need to finish something else first.

@ghost
Copy link

ghost commented Nov 18, 2013

PHALCON_INIT_NVAR(column_type); before ZVAL_STRING(...) will fix the issue.

If possible, could you please use tabs instead of spaces for indentation?

@lantian
Copy link
Contributor Author

lantian commented Nov 18, 2013

Thanks. Ok, i will use tabs. Tell me please, what IDE you are using?

@ghost
Copy link

ghost commented Nov 18, 2013

Eclipse CDT.

phalcon pushed a commit that referenced this pull request Dec 19, 2013
PDO/Adapter: decribeColumns method fixes.
@phalcon phalcon merged commit f6f9e5d into phalcon:1.2.5 Dec 19, 2013
@phalcon
Copy link
Collaborator

phalcon commented Dec 19, 2013

Thanks, could you please submit this to 1.3.0?

@lantian
Copy link
Contributor Author

lantian commented Dec 19, 2013

Sure

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.

2 participants