~pbms-core/pbms/5.11-beta

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
 *
 * PrimeBase Media Stream for MySQL
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Original author: Paul McCullagh
 * Continued development: Barry Leslie
 *
 * 2007-06-26
 *
 * H&G2JCtL
 *
 * Various utilities.
 *
 */

#ifndef __UTIL_MS_H__
#define __UTIL_MS_H__

#include "Defs_ms.h"
#include "pbms.h"

#define MS_URL_TYPE_BLOB	'~'
#define MS_URL_TYPE_REPO	'_'


typedef struct MSBlobURL {
	int					bu_type;
	csWord4				bu_db_id;
	csWord4				bu_tab_id;				// or repo ID if type = REPO
	csWord8				bu_blob_id;				// or repo file offset if type = REPO
	csWord4				bu_auth_code;
	csWord4				bu_server_id;
	csWord8				bu_blob_size;			
	csWord8				bu_blob_ref_id;			// Unique identifier of the blob reference
} MSBlobURLRec, *MSBlobURLPtr;

u_int		ms_file_to_table_id(const char *file_name, const char *name_part);
u_int		ms_file_to_table_id(const char *file_name);
const char	*ms_file_to_table_name(size_t size, char *tab_name, const char *file_name);
bool		ms_parse_blob_url(MSBlobURLPtr blob, const char *url);
void		ms_build_blob_url(MSBlobURLPtr blob, char *url);
const char	*ms_version();

/*
 * The pbms_ functions are utility functions supplied by ha_pbms.cc
 */
void	pbms_take_part_in_transaction(void *thread);
int		pbms_enter_conn_no_thd(CSThread **r_self, PBMSResultPtr result);
void	pbms_exit_conn();
int		pbms_exception_to_result(CSException *e, PBMSResultPtr result);
int		pbms_os_error_result(const char *func, const char *file, int line, int err, PBMSResultPtr result);
int		pbms_error_result(const char *func, const char *file, int line, int err, const char *message, PBMSResultPtr result);

#endif