317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
# File 'lib/sql/maker/select.rb', line 317
def _add_index_hint(*args)
table, as = parse_args(*args)
tbl_name =
if table.respond_to?(:as_sql)
'(' + table.as_sql + ')'
else
self._quote(table)
end
quoted = as ? tbl_name + ' ' + self._quote(as) : tbl_name
hint = self.index_hint[table]
return quoted unless hint && hint.is_a?(Hash)
if hint[:list]&& !hint[:list].empty?
return quoted + ' ' + (hint[:type].upcase || 'USE') + ' INDEX (' +
hint[:list].map {|e| self._quote(e) }.join(',') + ')'
end
return quoted
end
|