00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DB_T_H_INCLUDED
00021 #define DB_T_H_INCLUDED
00022
00026 #include <sys/types.h>
00027 #include <objc/Object.h>
00028 #include <mysql/mysql.h>
00029 #include "ciroucset_common.h"
00030 #include "pointerlist_t.h"
00031 #include "valuepair_p.h"
00032 #include "record_status_p.h"
00033
00034
00035 @class appbus_t ;
00036
00041 #define MAX_SQL_STATEMENT_SIZE 40000
00042
00047 typedef enum { no_res,
00048 singlerow,
00049 manyrows
00050 } expected_query_result_t ;
00051
00055 @interface db_t:Object
00056 {
00057 appbus_t *bus ;
00058 MYSQL mysli ;
00059 char *sql_statement ;
00060 MYSQL_RES *resultset_of_query ;
00061 MYSQL_ROW exactly_one_row ;
00062 my_ulonglong how_many_rows ;
00063 char lock_info_string[200] ;
00064 char lock_info_string_of_locked_record[200] ;
00065 }
00069 -init;
00073 +init_with_values:(appbus_t *)aBus ;
00077 -(int)init_2nd_stage ;
00078
00082 -free ;
00083
00084
00085
00092 -(int)save_record_to_db:(id<valuepair_p> *)values
00093 :(id<record_status_p>)recstat;
00094
00101 -(int)fetch_record_from_db:(id<valuepair_p> *)values
00102 :(id<record_status_p>)recstat;
00103
00112 -(int)delete_record_in_db:(id<valuepair_p> *)values
00113 :(id<record_status_p>)recstat;
00114
00122 -(int)delete_subrecords_in_db:(record_t *)aRecord
00123 :(long)record_id_master ;
00124
00125
00132 -(void)find_largest_keys_for_record:(id<valuepair_p> *)values
00133 :(id<record_status_p>)recstat;
00134
00140 -(void)unlock_record_in_db :(id<record_status_p>)recstat;
00141
00147 -(maybe_t)lock_record_in_db :(id<record_status_p>)recstat;
00153 -(char *)is_record_locked:(id<record_status_p>)recstat;
00160 -(long)new_recid:(id<valuepair_p> *)values
00161 :(id<record_status_p>)recstat;
00162
00169 -(maybe_t)find_keys_for_record:(id<valuepair_p> *)values
00170 :(id<record_status_p>)recstat;
00171
00181 -(int)do_exec:(expected_query_result_t)aExpectedResult ;
00185 -(void)freeres ;
00189 -(void)update_kort_ui:(id<record_status_p>)aRecStat ;
00204 -(pointerlist_t *)list_of_instances:(char *)recname
00205 :(long) recid
00206 :(long) recid_master ;
00212 -(int)find_last_saved_field : (id<valuepair_p> *)values ;
00224 -(maybe_t)find_allowed_value:(id<record_status_p>)aRecStat
00225 :(id<valuepair_p>)aValue
00226 :(wchar_t *)aCurrentValue
00227 :(char *)aAllowedValuesTable
00228 :(char *)aAllowedValuesColumn ;
00229
00230 @end
00231
00232 #endif