~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/pbms/src/systab_util_ms.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SYSTAB_UTIL_H__
 
2
#define __SYSTAB_UTIL_H__
 
3
/* Copyright (c) 2009 PrimeBase Technologies GmbH, Germany
 
4
 *
 
5
 * PrimeBase Media Stream for MySQL
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
20
 *
 
21
 *  Created by Barry Leslie on 3/20/09.
 
22
 *
 
23
 */
 
24
 
 
25
#include "cslib/CSLog.h"
 
26
 
 
27
 
 
28
class SysTabRec: public CSRefStringBuffer {     
 
29
        void logError(const char *text = NULL);
 
30
 
 
31
        bool findRecord();
 
32
 
 
33
        bool badRecord;
 
34
        
 
35
        uint32_t recordLength, start_of_record;
 
36
        
 
37
        public:
 
38
        const char *db_name, *file_name, *table_name;
 
39
        char *ptr, *end_of_record, *end_of_data;
 
40
 
 
41
        SysTabRec(const char *db_name_arg, const char *file_name_arg, const char *table_name_arg): 
 
42
                CSRefStringBuffer(64),
 
43
                badRecord(false),
 
44
                recordLength(0),
 
45
                start_of_record(0),
 
46
                db_name(db_name_arg),
 
47
                file_name(file_name_arg),
 
48
                table_name(table_name_arg),
 
49
                ptr(NULL),
 
50
                end_of_record(NULL),
 
51
                end_of_data(NULL)
 
52
        {
 
53
        }
 
54
        
 
55
        // Methods used to read records
 
56
        bool firstRecord();
 
57
        bool nextRecord();
 
58
                
 
59
        uint8_t getInt1Field(); 
 
60
        uint32_t getInt4Field();        
 
61
        const char *getStringField();
 
62
                
 
63
        bool isValidRecord()
 
64
        {
 
65
                return ((ptr == end_of_record) && !badRecord);
 
66
        }
 
67
        
 
68
        // Methods used to write records
 
69
        void clear();
 
70
        void beginRecord();
 
71
        void endRecord();
 
72
        void setInt1Field(uint8_t val); 
 
73
        void setInt4Field(uint32_t val);        
 
74
        void setStringField(const char *val);
 
75
        void setStringField(const char *val, uint32_t len);
 
76
 
 
77
        
 
78
};
 
79
 
 
80
CSString *getPBMSPath(CSString *db_path);
 
81
CSPath *getSysFile(CSString *db_path, const char *name, size_t min_size);
 
82
 
 
83
#endif // __SYSTAB_UTIL_H__
 
84