@@ -31,6 +31,9 @@ static Persistent<String> where_symbol;
3131static Persistent<String> file_symbol;
3232static Persistent<String> line_symbol;
3333static Persistent<String> routine_symbol;
34+ static Persistent<String> name_symbol;
35+ static Persistent<String> value_symbol;
36+ static Persistent<String> type_symbol;
3437
3538class Connection : public EventEmitter {
3639
@@ -64,6 +67,10 @@ class Connection : public EventEmitter {
6467 file_symbol = NODE_PSYMBOL (" file" );
6568 line_symbol = NODE_PSYMBOL (" line" );
6669 routine_symbol = NODE_PSYMBOL (" routine" );
70+ name_symbol = NODE_PSYMBOL (" name" );
71+ value_symbol = NODE_PSYMBOL (" value" );
72+ type_symbol = NODE_PSYMBOL (" type" );
73+
6774
6875 NODE_SET_PROTOTYPE_METHOD (t, " connect" , Connect);
6976 NODE_SET_PROTOTYPE_METHOD (t, " _sendQuery" , SendQuery);
@@ -386,9 +393,9 @@ class Connection : public EventEmitter {
386393 int fieldType = PQftype (result, fieldNumber);
387394 char * fieldValue = PQgetvalue (result, rowNumber, fieldNumber);
388395 // TODO use symbols here
389- field->Set (String::New ( " name " ) , String::New (fieldName));
390- field->Set (String::New ( " value " ) , String::New (fieldValue));
391- field->Set (String::New ( " type " ) , Integer::New (fieldType));
396+ field->Set (name_symbol , String::New (fieldName));
397+ field->Set (value_symbol , String::New (fieldValue));
398+ field->Set (type_symbol , Integer::New (fieldType));
392399 row->Set (Integer::New (fieldNumber), field);
393400 }
394401
0 commit comments