diff --git a/src/binding.cc b/src/binding.cc index 35b0494b..ac94cf2a 100644 --- a/src/binding.cc +++ b/src/binding.cc @@ -31,6 +31,9 @@ static Persistent where_symbol; static Persistent file_symbol; static Persistent line_symbol; static Persistent routine_symbol; +static Persistent name_symbol; +static Persistent value_symbol; +static Persistent type_symbol; class Connection : public EventEmitter { @@ -64,6 +67,10 @@ public: file_symbol = NODE_PSYMBOL("file"); line_symbol = NODE_PSYMBOL("line"); routine_symbol = NODE_PSYMBOL("routine"); + name_symbol = NODE_PSYMBOL("name"); + value_symbol = NODE_PSYMBOL("value"); + type_symbol = NODE_PSYMBOL("type"); + NODE_SET_PROTOTYPE_METHOD(t, "connect", Connect); NODE_SET_PROTOTYPE_METHOD(t, "_sendQuery", SendQuery); @@ -386,9 +393,9 @@ protected: int fieldType = PQftype(result, fieldNumber); char* fieldValue = PQgetvalue(result, rowNumber, fieldNumber); //TODO use symbols here - field->Set(String::New("name"), String::New(fieldName)); - field->Set(String::New("value"), String::New(fieldValue)); - field->Set(String::New("type"), Integer::New(fieldType)); + field->Set(name_symbol, String::New(fieldName)); + field->Set(value_symbol, String::New(fieldValue)); + field->Set(type_symbol, Integer::New(fieldType)); row->Set(Integer::New(fieldNumber), field); }