Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.
Bo, > I thought it could give me direct access to cvs commands like: > ls to list the files in the repository > log to get info on each file therein > status to get more info on the files . . . > OK, I thought that CVSAPI wrapped the cvs calls into a usable > entrypoints for example with a structured call and return. EVS has this (EVSAPI) but not CVSNT. CVSNT is still not that far removed from CVS in this area - the original CVS called RCS to perform all these actions then in 1.6 (or somewhere around there) they then incorporated RCS into CVS, however the structure is still pretty much the same. Not unlike what we did by incorporating Putty into CVSNT (or iconv or zlib or libxml) - the delineation is still there. Of course since EVS doesn't use RCS anymore Tony had to write a new API for all the data access (EVSFS I think). > This is for database access to save the dug out information. > I'll have a look at the audit_trigger.cpp file to see if I understand > the methods. The first thing you need to decide is whether it is simply easier to call audit.dll itself. The CVSAPI provides generic database functions for oracle/odbc/postgres/mysql/sqlite/mssql, and the audit_trigger.cpp uses those to then write the audit information to the database. If you wanted to write a trigger for CVSNT to write CVSROOT/taglog to a database instead (eg: like ViewVC does) then calling CVSAPI would be the way to do it. However since you are trying to populare the audit database, using the audit.dll itself may be quicker. The only hiccup is that audit.dll (audit_trigger.cpp) is designed to be called from CVSNT and some of the calls are passed structures that are not very 'friendly' they are just the structures that are used internally in CVSNT. Basically it is: CSqlConnection *g_pDb = CSqlConnection::CreateConnection("mssql","c:\program files (x32)\cvsnt\cvsapi"); CSqlConnectionInformation *g_pCI = g_pDb->GetConnectionInformation(); g_pCI->setVariable("hostname","localhost"); g_pCI->setVariable("database","myauditdb"); g_pCI->setVariable("username","sa"); g_pCI->setVariable("password","password"); g_pDb->Open(); // Sample select cvs::string tbl = g_pDb->parseTableName("SchemaVersion"); CSqlRecordsetPtr rs = g_pDb->Execute("Select Version From %s",tbl.c_str()); if(g_pDb->Error() || rs->Eof()) nVer = 1; else nVer = (int)*rs[0]; // Sample insert tbl = g_pDb->parseTableName("SessionLog"); time_t d = get_date((char*)date,NULL); char dt[64]; strftime(dt,sizeof(dt),"%Y-%m-%d %H:%M:%S",localtime(&d)); g_pDb->Bind(0,"commit"); g_pDb->Bind(1,"localhost"); g_pDb->Bind(2,"bo berglund"); g_pDb->Bind(3,"/cvsrepo"); g_pDb->Bind(4,"g:\\cvsrepo"); unsigned long g_nSessionId = g_pDb->ExecuteAndReturnIdentity("Insert Into %s (Command, StartTime, Hostname, Username, SessionId, VirtRepos, PhysRepos, Client) Values (?,'%s',?,?,'%s',?,?,'%1.63s')",tbl.c_str(),dt,"00001234","2.5.04"); // Finished delete g_pDb; Wheras if you wanted to call audit.dll the sequence would be something like this: // This creates the SessionLog entry initaudit(NULL, "commit", "2000-11-01 10:42:15", "localhost", "fred", "/cvsrepo", "d:\cvsrepo", "000001234", NULL, 0, NULL, NULL, '2.5.04', NULL); // This creates the TagLog record pretagaudit(NULL, "", "/module/directory", 2, {"file1.txt","file2.txt"}, {"1.2","1.3"}, 'T', "", "Rel_1_2_0") // finished - you CANNOT call initaudit() multiple times - always call closeaudit before calling initaudit a 2nd time closeaudit(NULL); As I think you can see - calling audit.dll directly is a MUCH simpler API (particularly when translating into Pascal/Delphi). However I've deliberately NOT shown how to create a CommmitLog record using audit.dll ;) To create a CommitLog record using audit.dll, afer calling initaudit() you call prercsdiffaudit() for each file (then rcsdiffaudit() for each file if you want the actuall diff stored), then call loginfoaudit() once (per directory) to generate the CommitLog record. To call loginfoaudit() you'll need a pointer to a an array of change_info_t structures. You'll need to go searching for the definition of change_info_t and make an equivalent structure in Pascal/Delphi. > If not I will simply make a function that works for MSSQLServer and > SQLite (which I can handle). Best to avoid this if at all possible, we've written CVSNT so modular so people can leverage the code after all... Regards, Arthur