Changeset 15569 for trunk/ippdb/src/ippdb.h
- Timestamp:
- Nov 9, 2007, 3:55:36 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.h
r15533 r15569 10700 10700 bool mdcf ///< format as mdconfig or simple 10701 10701 ); 10702 /** calDBRow data structure 10703 * 10704 * Structure for representing a single row of calDB table data. 10705 */ 10706 10707 typedef struct { 10708 psS64 cal_id; 10709 char *catdir; 10710 char *state; 10711 } calDBRow; 10712 10713 /** Creates a new calDBRow object 10714 * 10715 * @return A new calDBRow object or NULL on failure. 10716 */ 10717 10718 calDBRow *calDBRowAlloc( 10719 psS64 cal_id, 10720 const char *catdir, 10721 const char *state 10722 ); 10723 10724 /** Creates a new calDB table 10725 * 10726 * @return true on success 10727 */ 10728 10729 bool calDBCreateTable( 10730 psDB *dbh ///< Database handle 10731 ); 10732 10733 /** Deletes a calDB table 10734 * 10735 * @return true on success 10736 */ 10737 10738 bool calDBDropTable( 10739 psDB *dbh ///< Database handle 10740 ); 10741 10742 /** Insert a single row into a table 10743 * 10744 * This function constructs and inserts a single row based on it's parameters. 10745 * 10746 * @return true on success 10747 */ 10748 10749 bool calDBInsert( 10750 psDB *dbh, ///< Database handle 10751 psS64 cal_id, 10752 const char *catdir, 10753 const char *state 10754 ); 10755 10756 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 10757 * 10758 * @return A The number of rows removed or a negative value on error 10759 */ 10760 10761 long long calDBDelete( 10762 psDB *dbh, ///< Database handle 10763 const psMetadata *where, ///< Row match criteria 10764 unsigned long long limit ///< Maximum number of elements to delete 10765 ); 10766 10767 /** Insert a single calDBRow object into a table 10768 * 10769 * This function constructs and inserts a single row based on it's parameters. 10770 * 10771 * @return true on success 10772 */ 10773 10774 bool calDBInsertObject( 10775 psDB *dbh, ///< Database handle 10776 calDBRow *object ///< calDBRow object 10777 ); 10778 10779 /** Insert an array of calDBRow object into a table 10780 * 10781 * This function constructs and inserts multiple rows based on it's parameters. 10782 * 10783 * @return true on success 10784 */ 10785 10786 bool calDBInsertObjects( 10787 psDB *dbh, ///< Database handle 10788 psArray *objects ///< array of calDBRow objects 10789 ); 10790 10791 /** Insert data from a binary FITS table calDBRow into the database 10792 * 10793 * This function expects a psFits object with a FITS table as the first 10794 * extension. The table must have at least one row of data in it, that is of 10795 * the appropriate format (number of columns and their type). All other 10796 * extensions are ignored. 10797 * 10798 * @return true on success 10799 */ 10800 10801 bool calDBInsertFits( 10802 psDB *dbh, ///< Database handle 10803 const psFits *fits ///< psFits object 10804 ); 10805 10806 /** Selects up to limit from the database and returns them in a binary FITS table 10807 * 10808 * This function assumes an empty psFits object and will create a FITS table 10809 * as the first extension. 10810 * 10811 * See psDBSelectRows() for documentation on the format of where. 10812 * 10813 * @return true on success 10814 */ 10815 10816 bool calDBSelectRowsFits( 10817 psDB *dbh, ///< Database handle 10818 psFits *fits, ///< psFits object 10819 const psMetadata *where, ///< Row match criteria 10820 unsigned long long limit ///< Maximum number of elements to return 10821 ); 10822 10823 /** Convert a calDBRow into an equivalent psMetadata 10824 * 10825 * @return A psMetadata pointer or NULL on error 10826 */ 10827 10828 psMetadata *calDBMetadataFromObject( 10829 const calDBRow *object ///< fooRow to convert into a psMetadata 10830 ); 10831 10832 /** Convert a psMetadata into an equivalent fooRow 10833 * 10834 * @return A calDBRow pointer or NULL on error 10835 */ 10836 10837 calDBRow *calDBObjectFromMetadata( 10838 psMetadata *md ///< psMetadata to convert into a fooRow 10839 ); 10840 /** Selects up to limit rows from the database and returns as calDBRow objects in a psArray 10841 * 10842 * See psDBSelectRows() for documentation on the format of where. 10843 * 10844 * @return A psArray pointer or NULL on error 10845 */ 10846 10847 psArray *calDBSelectRowObjects( 10848 psDB *dbh, ///< Database handle 10849 const psMetadata *where, ///< Row match criteria 10850 unsigned long long limit ///< Maximum number of elements to return 10851 ); 10852 /** Deletes a row from the database coresponding to an calDB 10853 * 10854 * Note that a 'where' search psMetadata is constructed from each object and 10855 * used to find rows to delete. 10856 * 10857 * @return A The number of rows removed or a negative value on error 10858 */ 10859 10860 bool calDBDeleteObject( 10861 psDB *dbh, ///< Database handle 10862 const calDBRow *object ///< Object to delete 10863 ); 10864 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 10865 * 10866 * Note that a 'where' search psMetadata is constructed from each object and 10867 * used to find rows to delete. 10868 * 10869 * @return A The number of rows removed or a negative value on error 10870 */ 10871 10872 long long calDBDeleteRowObjects( 10873 psDB *dbh, ///< Database handle 10874 const psArray *objects, ///< Array of objects to delete 10875 unsigned long long limit ///< Maximum number of elements to delete 10876 ); 10877 /** Formats and prints an array of calDBRow objects 10878 * 10879 * When mdcf is set the formated output is in psMetadataConfig 10880 * format, otherwise it is in a simple tabular format. 10881 * 10882 * @return true on success 10883 */ 10884 10885 bool calDBPrintObjects( 10886 FILE *stream, ///< a stream 10887 psArray *objects, ///< An array of calDBRow objects 10888 bool mdcf ///< format as mdconfig or simple 10889 ); 10890 /** Formats and prints an calDBRow object 10891 * 10892 * When mdcf is set the formated output is in psMetadataConfig 10893 * format, otherwise it is in a simple tabular format. 10894 * 10895 * @return true on success 10896 */ 10897 10898 bool calDBPrintObject( 10899 FILE *stream, ///< a stream 10900 calDBRow *object, ///< an calDBRow object 10901 bool mdcf ///< format as mdconfig or simple 10902 ); 10903 /** calRunRow data structure 10904 * 10905 * Structure for representing a single row of calRun table data. 10906 */ 10907 10908 typedef struct { 10909 psS64 cal_id; 10910 char *region; 10911 char *last_step; 10912 char *state; 10913 } calRunRow; 10914 10915 /** Creates a new calRunRow object 10916 * 10917 * @return A new calRunRow object or NULL on failure. 10918 */ 10919 10920 calRunRow *calRunRowAlloc( 10921 psS64 cal_id, 10922 const char *region, 10923 const char *last_step, 10924 const char *state 10925 ); 10926 10927 /** Creates a new calRun table 10928 * 10929 * @return true on success 10930 */ 10931 10932 bool calRunCreateTable( 10933 psDB *dbh ///< Database handle 10934 ); 10935 10936 /** Deletes a calRun table 10937 * 10938 * @return true on success 10939 */ 10940 10941 bool calRunDropTable( 10942 psDB *dbh ///< Database handle 10943 ); 10944 10945 /** Insert a single row into a table 10946 * 10947 * This function constructs and inserts a single row based on it's parameters. 10948 * 10949 * @return true on success 10950 */ 10951 10952 bool calRunInsert( 10953 psDB *dbh, ///< Database handle 10954 psS64 cal_id, 10955 const char *region, 10956 const char *last_step, 10957 const char *state 10958 ); 10959 10960 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 10961 * 10962 * @return A The number of rows removed or a negative value on error 10963 */ 10964 10965 long long calRunDelete( 10966 psDB *dbh, ///< Database handle 10967 const psMetadata *where, ///< Row match criteria 10968 unsigned long long limit ///< Maximum number of elements to delete 10969 ); 10970 10971 /** Insert a single calRunRow object into a table 10972 * 10973 * This function constructs and inserts a single row based on it's parameters. 10974 * 10975 * @return true on success 10976 */ 10977 10978 bool calRunInsertObject( 10979 psDB *dbh, ///< Database handle 10980 calRunRow *object ///< calRunRow object 10981 ); 10982 10983 /** Insert an array of calRunRow object into a table 10984 * 10985 * This function constructs and inserts multiple rows based on it's parameters. 10986 * 10987 * @return true on success 10988 */ 10989 10990 bool calRunInsertObjects( 10991 psDB *dbh, ///< Database handle 10992 psArray *objects ///< array of calRunRow objects 10993 ); 10994 10995 /** Insert data from a binary FITS table calRunRow into the database 10996 * 10997 * This function expects a psFits object with a FITS table as the first 10998 * extension. The table must have at least one row of data in it, that is of 10999 * the appropriate format (number of columns and their type). All other 11000 * extensions are ignored. 11001 * 11002 * @return true on success 11003 */ 11004 11005 bool calRunInsertFits( 11006 psDB *dbh, ///< Database handle 11007 const psFits *fits ///< psFits object 11008 ); 11009 11010 /** Selects up to limit from the database and returns them in a binary FITS table 11011 * 11012 * This function assumes an empty psFits object and will create a FITS table 11013 * as the first extension. 11014 * 11015 * See psDBSelectRows() for documentation on the format of where. 11016 * 11017 * @return true on success 11018 */ 11019 11020 bool calRunSelectRowsFits( 11021 psDB *dbh, ///< Database handle 11022 psFits *fits, ///< psFits object 11023 const psMetadata *where, ///< Row match criteria 11024 unsigned long long limit ///< Maximum number of elements to return 11025 ); 11026 11027 /** Convert a calRunRow into an equivalent psMetadata 11028 * 11029 * @return A psMetadata pointer or NULL on error 11030 */ 11031 11032 psMetadata *calRunMetadataFromObject( 11033 const calRunRow *object ///< fooRow to convert into a psMetadata 11034 ); 11035 11036 /** Convert a psMetadata into an equivalent fooRow 11037 * 11038 * @return A calRunRow pointer or NULL on error 11039 */ 11040 11041 calRunRow *calRunObjectFromMetadata( 11042 psMetadata *md ///< psMetadata to convert into a fooRow 11043 ); 11044 /** Selects up to limit rows from the database and returns as calRunRow objects in a psArray 11045 * 11046 * See psDBSelectRows() for documentation on the format of where. 11047 * 11048 * @return A psArray pointer or NULL on error 11049 */ 11050 11051 psArray *calRunSelectRowObjects( 11052 psDB *dbh, ///< Database handle 11053 const psMetadata *where, ///< Row match criteria 11054 unsigned long long limit ///< Maximum number of elements to return 11055 ); 11056 /** Deletes a row from the database coresponding to an calRun 11057 * 11058 * Note that a 'where' search psMetadata is constructed from each object and 11059 * used to find rows to delete. 11060 * 11061 * @return A The number of rows removed or a negative value on error 11062 */ 11063 11064 bool calRunDeleteObject( 11065 psDB *dbh, ///< Database handle 11066 const calRunRow *object ///< Object to delete 11067 ); 11068 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 11069 * 11070 * Note that a 'where' search psMetadata is constructed from each object and 11071 * used to find rows to delete. 11072 * 11073 * @return A The number of rows removed or a negative value on error 11074 */ 11075 11076 long long calRunDeleteRowObjects( 11077 psDB *dbh, ///< Database handle 11078 const psArray *objects, ///< Array of objects to delete 11079 unsigned long long limit ///< Maximum number of elements to delete 11080 ); 11081 /** Formats and prints an array of calRunRow objects 11082 * 11083 * When mdcf is set the formated output is in psMetadataConfig 11084 * format, otherwise it is in a simple tabular format. 11085 * 11086 * @return true on success 11087 */ 11088 11089 bool calRunPrintObjects( 11090 FILE *stream, ///< a stream 11091 psArray *objects, ///< An array of calRunRow objects 11092 bool mdcf ///< format as mdconfig or simple 11093 ); 11094 /** Formats and prints an calRunRow object 11095 * 11096 * When mdcf is set the formated output is in psMetadataConfig 11097 * format, otherwise it is in a simple tabular format. 11098 * 11099 * @return true on success 11100 */ 11101 11102 bool calRunPrintObject( 11103 FILE *stream, ///< a stream 11104 calRunRow *object, ///< an calRunRow object 11105 bool mdcf ///< format as mdconfig or simple 11106 ); 10702 11107 10703 11108 /// @} … … 10707 11112 #endif 10708 11113 10709 #endif // MAGICSKYFILEMASK_DB_H11114 #endif // CALRUN_DB_H
Note:
See TracChangeset
for help on using the changeset viewer.
