Opened 7 years ago

Closed 7 years ago

# SQL Query fails to find shortcut ticket ids in case that there is no whitespace after the last digit

Reported by: Owned by: carstenklein@… David Francos Cuartero normal TicketBackLinksMacro normal 0.11

### Description

For example, the following is a valid shortcut reference to ticket number 10. However, since the last digit is directly followed by a non whitespace character, the macro will not find the reference.

#10.


The incorrect part of the query is

sql += 'OR w1.text LIKE \'%%#%s %%\' )' % thispage


sql += 'OR w1.text LIKE \'%%#%s%%\' )' % thispage


### comment:1 Changed 7 years ago by carstenklein@…

Type: defect → enhancement

I just noticed that you use this in order to circumvent the fact that %%#%s%% will also find #77 when searching for #7.

I am currently working on something that is using REGEXP instead. However, it seems that SQLITE quite frequently calls the user provided function during a single query. In case of the queries in the macro, it will be called >100 times per ticket or page found. Why this is so I do not fully understand right now. When I run the queries manually, the result set does not contain any duplicates.

In addition, using a user defined REGEXP() function will require changes to the sqlite_backend that is included with trac. And, I presume that the changes to the backend will not be integrated concerning the above described behaviour of SQLITE.

### comment:2 Changed 7 years ago by carstenklein@…

See issue #6383 for a corrected version of the query incl. also a small enhancement that will also search the ticket comments and descriptions for links to a ticket.

### comment:3 Changed 7 years ago by anonymous

Resolution: → wontfix new → closed

### comment:4 Changed 5 years ago by Lucas Rangit MAGASWERAN

I applied the change from the description and it fixed my issues. Thanks!

### Modify Ticket

Action
as closed The owner will remain David Francos Cuartero.
The resolution will be deleted. Next status will be 'reopened'.