AlDanial / cloc

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
GNU General Public License v2.0
19.75k stars 1.02k forks source link

Question: Can you DIFF with SQL as an output? #844

Closed MichaelW1982 closed 3 months ago

MichaelW1982 commented 4 months ago

Here's the powershell query I'm running: .\cloc-2.00.exe --sql=- --diff $HOME\Documents\Repos\Baselines\hygeia $HOME\Documents\Repos\Working\hygeia Here's the output:

github.com/AlDanial/cloc v 2.00 T=0.22 s (18.5 files/s, 6397.6 lines/s)

File blank comment code

D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src same 43 42 329 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src same 61 7 173 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src\ same 26 56 120 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src same 36 0 99 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia same 14 1 72 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\ same 10 0 42 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src\ same 8 17 32 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\sr same 10 0 29 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygei same 7 22 20 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hyg same 10 19 19 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\ same 1 4 17 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\ same 0 2 7 modified 0 1 1 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src\ same 2 0 7 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\ same 2 0 5 modified 0 0 0 added 0 0 0 removed 0 0 0 D:\Users\tj570f\Documents\Repos\Baselines\hygeia\src\ same 2 0 5 modified 0 0 0 added 0 0 0 removed 0 0 0

SUM: same 232 170 976 modified 0 1 1 added 0 0 0 removed 0 0 0

PS D:\Users\tj570f\Documents>

As you can see, there are no insert statement. I've tried writing to a file with no joy. If I do a normal count, the SQL output looks correct (I've removed values because privacy): .\cloc-2.00.exe --sql=- $HOME\Documents\Repos\Working\hygeia Output: create table metadata ( -- github.com/AlDanial/cloc v 2.00 id integer primary key, timestamp varchar(500), Project varchar(500), elapsed_s real); create table t ( id integer , Project varchar(500) , Language varchar(500) , File varchar(500) , File_dirname varchar(500) , File_basename varchar(500) , nBlank integer , nComment integer , nCode integer , nScaled real , foreign key (id) references metadata (id)); begin transaction; insert into metadata values(1721753816, '2024-07-23 10:56:56', 'D:\Users\tj570f\Documents', 0.129463); insert into t values(1721753816, 'D:\Users\tj570f\Documents', 'Java', 'd:

I'm curious if CLOC cannot provide a SQL output for the DIFF option. It's also entirely possible I'm an idiot and did not use the correct query/command. Any help?

AlDanial commented 4 months ago

Yes, this is an oversight: --sql and --diff currently do not work together. I'll work to implement this.

AlDanial commented 4 months ago

Let me know if 4d73b93 works for you.

MichaelW1982 commented 3 months ago

Works great - results compared with STDOUT match. Thanks a ton!!