Skip to content

Commit 6357f2d

Browse files
Bruno De BelBruno De Bel
Bruno De Bel
authored and
Bruno De Bel
committed
Adaptation barcode
1 parent 55c2fd3 commit 6357f2d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

loadInventory/inventoryparser.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class StateParserDocumentState : public StateParserInventoryRootState{
3737
return tmp;
3838
}
3939

40-
std::string buildUnique(std::string type,std::string date,std::string seq,std::string sysnum,std::string paperid){
40+
std::string buildUnique(std::string type,std::string date,std::string seq,std::string sysnum,std::string paperid, std::string barcode){
4141

4242
if ( type.compare("Monograph") == 0){
43-
return sysnum;
43+
return barcode;
4444
}
4545

4646
char* str = strdup (type.c_str());
@@ -78,8 +78,10 @@ class StateParserDocumentState : public StateParserInventoryRootState{
7878
allValue.push_back(type);
7979
std::string sysnum = getMap(CTX.keyValues,"systemNumber");
8080
allValue.push_back(sysnum);
81+
std::string barcode= getMap(CTX.keyValues,"barcode");
82+
allValue.push_back(barcode);
8183
std::string seq = getMap(CTX.keyValues,"sequenceNumber");
82-
allValue.push_back(buildUnique(type,date,seq,sysnum,paperID));
84+
allValue.push_back(buildUnique(type,date,seq,sysnum,paperID,barcode));
8385

8486
(CTX . sql) -> Store( allValue);
8587

loadInventory/sqlloadinventory.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ SQLLoad::SQLLoad():zErrMsg(0),pStmt(0){
55
sql = "INSERT INTO INVENTORY "
66
"( ID,AUTHOR,TITLE,TITLECOLLECTION,"
77
" SUBTITLE,PAPERID,LANGUAGES,ISSUENUMBER,"
8-
" FORMALDATE,TYPE,SYSTEMNUMBER,UNIQUEBUILDKEY"
8+
" FORMALDATE,TYPE,SYSTEMNUMBER,BARCODE,UNIQUEBUILDKEY"
99
") "
10-
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
10+
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?);";
1111
}
1212

1313

@@ -31,7 +31,7 @@ void SQLLoad::Start(){
3131

3232
void SQLLoad::Store(std::vector<std::string> allValue){
3333
//std::cerr << allValue.size() << std::endl;
34-
if ( allValue.size() != 12 ){
34+
if ( allValue.size() != 13 ){
3535
std::cerr << "Not enough field in file : " << allValue.size() << std::endl;
3636
return ;
3737
};
@@ -42,10 +42,7 @@ void SQLLoad::Store(std::vector<std::string> allValue){
4242
int vt = 0;
4343
for ( int i = 0; i < allValue.size(); i++){
4444
pt++;
45-
//std::cerr << "VAL" << pt <<" :" << allValue[vt] << std::endl;//DEBUG
46-
//if ( vt!= 5 || allValue[vt].length() != 0 ) { // skip error on inventory
4745
sqlite3_bind_text(pStmt, pt, allValue[vt].c_str(),allValue[vt].length(),SQLITE_STATIC);
48-
//}
4946
vt++;
5047
}
5148

project/createTable.txt

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CREATE TABLE INVENTORY (
1717
FORMALDATE varchar(40),
1818
TYPE varchar(20),
1919
SYSTEMNUMBER varchar(40),
20+
BARCODE varchar(40),
2021
UNIQUEBUILDKEY varchar(100) UNIQUE,
2122
CHECKED INTEGER
2223
);

0 commit comments

Comments
 (0)