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

Replaced magic number with symbolic constant in pdo.c #49

Merged
merged 1 commit into from
Sep 3, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions dev/db/adapter/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
#include "kernel/concat.h"
#include "kernel/operators.h"

#define PDO_ATTR_ERRMODE 3
#define PDO_ERRMODE_SILENT 0
#define PDO_ATTR_CASE 8
#define PDO_CASE_LOWER 2
#define PDO_ATTR_CURSOR 10
#define PDO_CURSOR_SCROLL 1
#define PDO_ATTR_PERSISTENT 12

/**
* Phalcon\Db\Adapter\Pdo
*
Expand Down Expand Up @@ -182,15 +190,15 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect){

PHALCON_INIT_VAR(options);
array_init(options);
add_index_long(options, 3, 0);
add_index_long(options, 8, 2);
add_index_long(options, 10, 1);
add_index_long(options, PDO_ATTR_ERRMODE, PDO_ERRMODE_SILENT);
add_index_long(options, PDO_ATTR_CASE, PDO_CASE_LOWER);
add_index_long(options, PDO_ATTR_CURSOR, PDO_CURSOR_SCROLL);
eval_int = phalcon_array_isset_string(descriptor, SL("persistent")+1);
if (eval_int) {
PHALCON_INIT_VAR(persistent);
phalcon_array_fetch_string(&persistent, descriptor, SL("persistent"), PH_NOISY_CC);
if (zend_is_true(persistent)) {
phalcon_array_update_long_bool(&options, 12, 1, PH_SEPARATE TSRMLS_CC);
phalcon_array_update_long_bool(&options, PDO_ATTR_PERSISTENT, 1, PH_SEPARATE TSRMLS_CC);
}
}

Expand Down