Changeset 42837 for trunk/ippTools/src/addtool.c
- Timestamp:
- May 9, 2025, 9:40:41 AM (14 months ago)
- Location:
- trunk/ippTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools
-
trunk/ippTools/src
- Property svn:ignore
-
old new 50 50 remotetool 51 51 fpcamtool 52 xcstacktool 53 xcskytool 54 xcfftool
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
trunk/ippTools/src/addtool.c
r42712 r42837 1694 1694 // required 1695 1695 PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", true, false); 1696 PXOPT_LOOKUP_STR(minidvodb_path , config->args, "-set_minidvodb_path", false, false);1696 PXOPT_LOOKUP_STR(minidvodb_path_raw, config->args, "-set_minidvodb_path", false, false); 1697 1697 PXOPT_LOOKUP_STR(minidvodb_host, config->args, "-set_minidvodb_host", false, false); 1698 1698 //optional 1699 PXOPT_LOOKUP_STR(minidvodb_name , config->args, "-set_minidvodb_name", false, false);1699 PXOPT_LOOKUP_STR(minidvodb_name_raw, config->args, "-set_minidvodb_name", false, false); 1700 1700 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1701 1701 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); … … 1706 1706 } 1707 1707 1708 // psString minidvodbpath = "NULL";1709 1710 // I don't know how to get around the complaints of minidvodb_path can't be null. this 'fixes' it, but someone smarter can fix it properly.1711 // if (minidvodb_path) {1712 // minidvodbpath = minidvodb_path;1713 // } else {1714 // psError(PS_ERR_UNKNOWN, false, "require minidvodb_path");1715 // return false;1716 // }1717 1718 1708 if (!minidvodbRunInsert(config->dbh, 1719 1709 0, // job_id 1720 minidvodb_name ,1710 minidvodb_name_raw, 1721 1711 minidvodb_group, 1722 minidvodb_path ,1712 minidvodb_path_raw, 1723 1713 minidvodb_host, 1724 1714 "new", … … 1741 1731 printf("%" PRId64 "\n", minidvodb_id); 1742 1732 1743 1744 if (!minidvodb_name) { 1745 psStringAppend(&minidvodb_name, "%s.%" PRIu64,minidvodb_group,minidvodb_id); 1746 } 1747 if (minidvodb_path) { 1748 psStringAppend(&minidvodb_path,"/%s",minidvodb_name); 1749 } 1750 1751 psString query = NULL; 1752 1753 psStringAppend(&query, "UPDATE minidvodbRun SET minidvodb_path = '%s', minidvodb_name = '%s' where minidvodb_id = %" PRIu64";", minidvodb_path, minidvodb_name, minidvodb_id); 1754 1755 if (!p_psDBRunQuery(config->dbh, query)) { 1756 psError(PS_ERR_UNKNOWN, false, "database error"); 1757 psFree(query); 1758 return false; 1759 } 1760 1761 if (!psDBCommit(config->dbh)) { 1762 psError(PS_ERR_UNKNOWN, false, "database error"); 1763 return false; 1764 } 1733 // we created a new entry using the values supplied above for minidvodb_name_raw, minidvodb_host_raw. 1734 // If minidvodb_name is not specified, it will be generated based on the value of minidvodb_group and 1735 // the minidvodb_id of the new entry. But this means we need to insert first, get the ID, then update. 1736 1737 bool doUpdate = false; 1738 1739 // Below: note that minidvodb_name_raw and minidvodb_path_raw are stored on config->args 1740 // we need to work with a temporary external variable to avoid changing entries on the MD 1741 1742 // if minidvodb_name_raw is not specified above, create it from minidvodb_group 1743 psString minidvodb_name = NULL; 1744 if (minidvodb_name_raw) { 1745 minidvodb_name = psStringCopy (minidvodb_name_raw); 1746 } else { 1747 psStringAppend(&minidvodb_name, "%s.%" PRIu64, minidvodb_group, minidvodb_id); 1748 doUpdate = true; 1749 } 1750 1751 // if minidvodb_path_raw IS specified above, update it with the minidvodb_name 1752 psString minidvodb_path = NULL; 1753 if (minidvodb_path_raw) { 1754 psStringAppend(&minidvodb_path, "%s/%s", minidvodb_path_raw, minidvodb_name); 1755 doUpdate = true; 1756 } 1757 1758 if (doUpdate) { 1759 psString query = NULL; 1760 1761 psStringAppend(&query, "UPDATE minidvodbRun SET minidvodb_path = '%s', minidvodb_name = '%s' where minidvodb_id = %" PRIu64";", minidvodb_path, minidvodb_name, minidvodb_id); 1762 1763 if (!p_psDBRunQuery(config->dbh, query)) { 1764 psError(PS_ERR_UNKNOWN, false, "database error"); 1765 psFree(query); 1766 return false; 1767 } 1768 1769 if (!psDBCommit(config->dbh)) { 1770 psError(PS_ERR_UNKNOWN, false, "database error"); 1771 return false; 1772 } 1773 } 1774 1775 psFree (minidvodb_name); 1776 psFree (minidvodb_path); 1765 1777 1766 1778 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
