| 24 | | |
|---|
| 25 | | #################### |
|---|
| 26 | | # HELPER FUNCTIONS # |
|---|
| 27 | | #################### |
|---|
| 28 | | |
|---|
| 29 | | # FIXME |
|---|
| 30 | | def orderlist2sql(order_list, opts, prefix=''): |
|---|
| 31 | | raise NotImplementedError |
|---|
| 32 | | ##def orderlist2sql(order_list, opts, prefix=''): |
|---|
| 33 | | ## qn = connection.ops.quote_name |
|---|
| 34 | | ## if prefix.endswith('.'): |
|---|
| 35 | | ## prefix = qn(prefix[:-1]) + '.' |
|---|
| 36 | | ## output = [] |
|---|
| 37 | | ## for f in handle_legacy_orderlist(order_list): |
|---|
| 38 | | ## if f.startswith('-'): |
|---|
| 39 | | ## output.append('%s%s DESC' % (prefix, qn(orderfield2column(f[1:], opts)))) |
|---|
| 40 | | ## elif f == '?': |
|---|
| 41 | | ## output.append(connection.ops.random_function_sql()) |
|---|
| 42 | | ## else: |
|---|
| 43 | | ## output.append('%s%s ASC' % (prefix, qn(orderfield2column(f, opts)))) |
|---|
| 44 | | ## return ', '.join(output) |
|---|
| 45 | | |
|---|
| 46 | | ##def quote_only_if_word(word): |
|---|
| 47 | | ## if re.search('\W', word): # Don't quote if there are spaces or non-word chars. |
|---|
| 48 | | ## return word |
|---|
| 49 | | ## else: |
|---|
| 50 | | ## return connection.ops.quote_name(word) |
|---|