I am using perforce. Some helpful members of the stackoverflow community helped me find the p4reports program that sets up an ODBC data source to access our perforce data. I created a query that returns exactly the information i need … almost.
Here is the query:
SELECT a.file, a.time, a.action, a.revision, a.change, b.description
FROM files a, changes b
WHERE a.change = b.change AND ((b.p4options='longdesc'));
The problem is that the a.file column returns the name of the file with the whole path, like this:
//depot/folder_1/folder_2/.../file_name.txt
I would like this column to just contain the file name, like this:
file_name.txt
Does anyone know an SQL query that could do this? Now matter how deeply nested a file is in a folder structure?
Here is a link to the perforce SQL report functions. Some basic string functions but I am having a hard time putting together how I can always return the right text with these functions.
http://www.perforce.com/perforce/doc.current/manuals/p4report/ab_functions.html#1045728
In MySQL I would do something like this:
SELECT right(a.file,locate("/",reverse(a.file))-1), a.time, a.action, a.revision, a.change, b.description
FROM files a, changes b
WHERE a.change = b.change AND ((b.p4options='longdesc'));
And it would work, but there is no reverse function in the perforce SQL as far as I can tell. Any help would be greatly appreciated!
Thanks!!
You might want to take a look at P4toDB, which will replicate Perforce data into a regular database. That way you can run more advanced SQL queries or even use a report engine.
http://kb.perforce.com/article/1172/p4todb-readme