Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

db_t.h

Go to the documentation of this file.
00001 /* kort db interface class. -*-ObjC-*-
00002 Copyright (C) 2005 Antti Järvinen
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */
00017 
00018 /* "$Id: db_t.h,v 1.16 2005/05/13 21:25:23 costello Exp $" */
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 // forward declare:
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 // actual workhorse methods: 
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 /* end of db_t definition */
00232 #endif

Generated on Sun May 15 23:45:22 2005 for kort4 by  doxygen 1.4.2