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

Problemas com o postgres #1

Closed
aweiand opened this issue Jan 3, 2014 · 4 comments
Closed

Problemas com o postgres #1

aweiand opened this issue Jan 3, 2014 · 4 comments
Assignees

Comments

@aweiand
Copy link

aweiand commented Jan 3, 2014

Olá,

Tive alguns problemas com a base postgre, para os quais fiz as seguintes alterações para que funcionasse sem problemas:

Alterações para aperfeiçoamento do postgre:

  • Adicionado teste de "is_numeric($data)" na linha 72 para poder trabalhar melhor com colunas que sejam inteiras e não utilizar "LIKE" no "WHERE"
  • Removidas as aspas "´" e "`" para funcionamento correto
  • Suprimida a opção "PDO::ATTR_AUTOCOMMIT => true" na linha 573 para correção de bug na conexão do PDO

As alterações que efetuei:

  • Adicionado teste de tipo para verificar se for inteiro e poder utilizar campos com nomes diferentes de id no get, sem prejuízos a consulta no postgresql
    if (is_numeric($data))
    $query[] = sprintf('WHERE %s = ?', $id);
    else
    $query[] = sprintf('WHERE %s LIKE ?', $id);
  • Bug na Classe/Driver que não permite trocar o tipo de autocommit
    $options += array
    (
    \PDO::ATTR_AUTOCOMMIT => true,
    );
@alixaxel
Copy link
Owner

alixaxel commented Jan 3, 2014

Thanks for the report. Could you please post the full file (minus the auth details) in a Gist so I can analyze it in detail?

Good idea on is_numeric by the way, I wonder if ctype_digit wouldn't be a better choice though.

Also, with your update; is the last inserted SERIAL in this snippet still being correctly returned?

Desculpa pelo inglês, é só para que visitantes futuros percebam o que se diz.

@ghost ghost assigned alixaxel Jan 3, 2014
@aweiand
Copy link
Author

aweiand commented Jan 3, 2014

Hello!
Surely, here is the link of the Gist: https://gist.github.com/aweiand/8241243

Regarding the last serial entered, have not tested ....

Ps.: Nem te extressa com o inglês, faz parte.... heheheh

@alixaxel
Copy link
Owner

alixaxel commented Jan 4, 2014

@aweiand Thank for the wrap up, I'll try to address the pgsql bug and the new improvements in the next few days. =)

@alixaxel
Copy link
Owner

The pgsql connection bug is now fixed in 10c1829.

I also took care of the escaping backticks and added the ctype_digit check, thanks for your helpful feedback! =)

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

No branches or pull requests

2 participants