Skip to content

Commit 119f820

Browse files
committed
Fine-tune FB_API_VER guards
1 parent 223277f commit 119f820

3 files changed

Lines changed: 27 additions & 13 deletions

File tree

firebird_utils.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
#include <ibase.h>
1919

20-
#if FB_API_VER >= 40
21-
20+
#if FB_API_VER >= 30
2221
#include <firebird/Interface.h>
2322
#include <cstring>
2423
#include "php.h"
@@ -57,6 +56,9 @@ static void fbu_copy_status(const ISC_STATUS* from, ISC_STATUS* to, size_t maxLe
5756
}
5857
}
5958

59+
#endif // FB_API_VER >= 30
60+
61+
#if FB_API_VER >= 40
6062
/* Decodes a time with time zone into its time components. */
6163
extern "C" void fbu_decode_time_tz(void *master_ptr, const ISC_TIME_TZ* timeTz, unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions,
6264
unsigned timeZoneBufferLength, char* timeZoneBuffer)

firebird_utils.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,41 @@
1717
#ifndef PDO_FIREBIRD_UTILS_H
1818
#define PDO_FIREBIRD_UTILS_H
1919

20-
#if FB_API_VER >= 40
21-
22-
#include <ibase.h>
23-
#include "php_ibase_includes.h"
24-
2520
#ifdef __cplusplus
2621
extern "C" {
2722
#endif
2823

24+
25+
#if FB_API_VER >= 30
26+
27+
#include <ibase.h>
28+
#include "php_ibase_includes.h"
29+
2930
unsigned fbu_get_client_version(void *master_ptr);
30-
ISC_TIME fbu_encode_time(void *master_ptr, unsigned hours, unsigned minutes, unsigned seconds, unsigned fractions);
31+
ISC_TIME fbu_encode_time(void *master_ptr, unsigned hours, unsigned minutes,
32+
unsigned seconds, unsigned fractions);
3133
ISC_DATE fbu_encode_date(void *master_ptr, unsigned year, unsigned month, unsigned day);
3234

35+
#endif // FB_API_VER >= 30
36+
37+
38+
#if FB_API_VER >= 40
3339
void fbu_decode_time_tz(void *master_ptr, const ISC_TIME_TZ* timeTz, unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions,
3440
unsigned timeZoneBufferLength, char* timeZoneBuffer);
35-
3641
void fbu_decode_timestamp_tz(void *master_ptr, const ISC_TIMESTAMP_TZ* timestampTz,
3742
unsigned* year, unsigned* month, unsigned* day,
3843
unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions,
3944
unsigned timeZoneBufferLength, char* timeZoneBuffer);
45+
int fbu_insert_field_info(void *master_ptr, ISC_STATUS* st, int is_outvar, int num,
46+
zval *into_array, void *statement_ptr);
47+
int fbu_insert_aliases(void *master_ptr, ISC_STATUS* st, ibase_query *ib_query,
48+
void *statement_ptr);
49+
50+
#endif // FB_API_VER >= 30
4051

41-
int fbu_insert_aliases(void *master_ptr, ISC_STATUS* st, ibase_query *ib_query, void *statement_ptr);
42-
int fbu_insert_field_info(void *master_ptr, ISC_STATUS* st, int is_outvar, int num, zval *into_array, void *statement_ptr);
4352

4453
#ifdef __cplusplus
4554
}
4655
#endif
4756

48-
#endif // FB_API_VER >= 40
49-
5057
#endif /* PDO_FIREBIRD_UTILS_H */

interbase.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
| Andrew Avdeev <andy@simgts.mv.ru> |
1717
| Ard Biesheuvel <a.k.biesheuvel@its.tudelft.nl> |
1818
| Martin Koeditz <martin.koeditz@it-syn.de> |
19+
| Martins Lazdans <marrtins@dqdp.net> |
1920
| others |
2021
+----------------------------------------------------------------------+
2122
| You'll find history on Github |
@@ -839,17 +840,21 @@ static PHP_GINIT_FUNCTION(ibase)
839840
ibase_globals->get_master_interface = _php_ibase_get_fbclient_symbol("fb_get_master_interface");
840841
ibase_globals->get_statement_interface = _php_ibase_get_fbclient_symbol("fb_get_statement_interface");
841842

843+
#if FB_API_VER >= 30
842844
if (ibase_globals->get_master_interface) {
843845
ibase_globals->master_instance = ((fb_get_master_interface_t)(ibase_globals->get_master_interface))();
844846
ibase_globals->client_version = fbu_get_client_version(ibase_globals->master_instance);
845847
ibase_globals->client_major_version = (ibase_globals->client_version >> 8) & 0xFF;
846848
ibase_globals->client_minor_version = ibase_globals->client_version & 0xFF;
847849
} else {
850+
#endif
848851
ibase_globals->master_instance = NULL;
849852
ibase_globals->client_version = -1;
850853
ibase_globals->client_major_version = -1;
851854
ibase_globals->client_minor_version = -1;
855+
#if FB_API_VER >= 30
852856
}
857+
#endif
853858
}
854859

855860
PHP_MINIT_FUNCTION(ibase)

0 commit comments

Comments
 (0)