Changeset 6663 for trunk/tools/database/db.cpp
- Timestamp:
- Sep 6, 2001, 5:07:32 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/db.cpp
r6651 r6663 1 /* $Id: db.cpp,v 1.2 4 2001-09-05 13:59:03bird Exp $ *1 /* $Id: db.cpp,v 1.25 2001-09-06 03:07:32 bird Exp $ * 2 2 * 3 3 * DB - contains all database routines. … … 1172 1172 * @param pszTitle Design note title. 1173 1173 * @param pszText Design note text. 1174 * @param lLevel Level of the note section. 0 is the design note it self. 1174 1175 * @param lSeqNbr Sequence number (in dll). If 0 the use next available number. 1175 * @param lSeqNbr File Sequence number in file.1176 * @param lSeqNbrNote Sequence number in note. 1176 1177 * @param lLine Line number (1 - based!). 1178 * @param fSubSection TRUE if subsection FALSE if design note. 1179 * if TRUE *plRefCode will hold the reference id of the note. 1180 * if FALSE *plRefCode will receive the reference id of the note being created. 1181 * @param plRefCode Pointer to reference id of the design note. see fSubSection for more info. 1177 1182 */ 1178 1183 BOOL _System dbAddDesignNote(signed long lDll, … … 1180 1185 const char *pszTitle, 1181 1186 const char *pszText, 1187 signed long lLevel, 1182 1188 signed long lSeqNbr, 1183 signed long lSeqNbrFile, 1184 signed long lLine) 1185 { 1189 signed long lSeqNbrNote, 1190 signed long lLine, 1191 BOOL fSubSection, 1192 signed long *plRefCode) 1193 { 1194 int rc; 1186 1195 char szQuery[0x10200]; 1187 1196 MYSQL_RES * pres; … … 1189 1198 1190 1199 assert(lDll >= 0 && lFile >= 0); 1191 assert(lSeqNbr File >= 0);1200 assert(lSeqNbrNote >= 0); 1192 1201 1193 1202 /* 1194 1203 * If no lSqlNbr the make one. 1195 1204 */ 1196 if (lSeqNbr == 0 )1197 { 1198 sprintf(&szQuery[0], "SELECT MAX(seqnbr) + 1 FROM designnote WHERE dll = %ld ", lDll);1205 if (lSeqNbr == 0 && !fSubSection) 1206 { 1207 sprintf(&szQuery[0], "SELECT MAX(seqnbr) + 1 FROM designnote WHERE dll = %ld AND level = 0", lDll); 1199 1208 if (mysql_query(pmysql, &szQuery[0]) >= 0) 1200 1209 { … … 1203 1212 { 1204 1213 MYSQL_ROW parow = mysql_fetch_row(pres); 1205 if (parow != NULL )1214 if (parow != NULL && parow[0]) 1206 1215 lSeqNbr = getvalue(0, parow); 1207 1216 else … … 1217 1226 1218 1227 /* 1219 * Create updatequery.1228 * Create insert query. 1220 1229 */ 1221 sprintf(&szQuery[0], "INSERT INTO designnote(dll, file, seqnbrfile, seqnbr, line, title, note) " 1222 "VALUES (%ld, %ld, %ld, %ld, %ld, ", 1223 lDll, lFile, lSeqNbrFile, lSeqNbr, lLine); 1230 if (!fSubSection) 1231 sprintf(&szQuery[0], "INSERT INTO designnote(dll, file, level, seqnbrnote, seqnbr, line, name, note) " 1232 "VALUES (%ld, %ld, %ld, %ld, %ld, %ld, ", 1233 lDll, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine); 1234 else 1235 sprintf(&szQuery[0], "INSERT INTO designnote(refcode, dll, file, level, seqnbrnote, seqnbr, line, name, note) " 1236 "VALUES (%ld, %ld, %ld, %ld, %ld, %ld, %ld, ", 1237 *plRefCode, lDll, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine); 1238 1224 1239 if (pszTitle != NULL && *pszTitle != '\0') 1225 1240 sqlstrcat(&szQuery[0], NULL, pszTitle); … … 1228 1243 sqlstrcat(&szQuery[0], ", ", pszText == NULL ? "" : pszText, ")"); 1229 1244 1230 return mysql_query(pmysql, &szQuery[0]) >= 0; 1245 if (mysql_query(pmysql, &szQuery[0]) >= 0) 1246 { 1247 if (!fSubSection) 1248 *plRefCode = mysql_insert_id(pmysql); 1249 return TRUE; 1250 } 1251 return FALSE; 1231 1252 } 1232 1253
Note:
See TracChangeset
for help on using the changeset viewer.