@@ -120,26 +120,26 @@ public MutableEdge newEdge(final String edgeType, final Identifiable toVertex, f
120120 if (!bidirectional )
121121 throw new UnsupportedOperationException ("Creating unidirectional edges is not supported from remote database" );
122122
123- String query = "create edge `" + edgeType + "` from " + vertex .getIdentity () + " to " + toVertex .getIdentity ();
123+ StringBuilder query = new StringBuilder ( "create edge `" + edgeType + "` from " + vertex .getIdentity () + " to " + toVertex .getIdentity () );
124124 if (properties .length > 0 ) {
125- query += " set " ;
125+ query . append ( " set " ) ;
126126 for (int i = 0 ; i < properties .length ; i += 2 ) {
127127 final String propName = (String ) properties [i ];
128128 final Object propValue = properties [i + 1 ];
129129
130130 if (i > 0 )
131- query += ", " ;
131+ query . append ( ", " ) ;
132132
133- query += propName + " = " ;
133+ query . append ( propName + " = " ) ;
134134
135135 if (propValue instanceof String )
136- query += "'" ;
137- query += propValue ;
136+ query . append ( "'" ) ;
137+ query . append ( propValue ) ;
138138 if (propValue instanceof String )
139- query += "'" ;
139+ query . append ( "'" ) ;
140140 }
141141 }
142- final ResultSet resultSet = remoteDatabase .command ("sql" , query );
142+ final ResultSet resultSet = remoteDatabase .command ("sql" , query . toString () );
143143
144144 return new RemoteMutableEdge ((RemoteImmutableEdge ) resultSet .next ().getEdge ().get ());
145145 }
@@ -156,13 +156,13 @@ public void delete() {
156156 }
157157
158158 private ResultSet fetch (final String suffix , final Vertex .DIRECTION direction , final String [] types ) {
159- String query = "select expand( " + direction .toString ().toLowerCase (Locale .ENGLISH ) + suffix + "(" ;
159+ StringBuilder query = new StringBuilder ( "select expand( " + direction .toString ().toLowerCase (Locale .ENGLISH ) + suffix + "(" ) ;
160160 for (int i = 0 ; i < types .length ; ++i ) {
161161 if (i > 0 )
162- query += "," ;
163- query += "'" + types [i ] + "'" ;
162+ query . append ( "," ) ;
163+ query . append ( "'" + types [i ] + "'" ) ;
164164 }
165- query += ") ) from " + vertex .getIdentity ();
166- return remoteDatabase .query ("sql" , query );
165+ query . append ( ") ) from " + vertex .getIdentity () );
166+ return remoteDatabase .query ("sql" , query . toString () );
167167 }
168168}
0 commit comments