Skip to content

Commit 311b1c1

Browse files
committed
Move ODBC string userland API into ext/odbc
Per GPB's suggestion. It does make sense, even if the functionality is common to both extensions.
1 parent 0c4c018 commit 311b1c1

File tree

10 files changed

+32
-31
lines changed

10 files changed

+32
-31
lines changed

ext/odbc/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ if test -n "$ODBC_TYPE"; then
461461
PHP_SUBST_OLD(ODBC_LFLAGS)
462462
PHP_SUBST_OLD(ODBC_TYPE)
463463

464-
PHP_NEW_EXTENSION(odbc, php_odbc.c, $ext_shared,, [$ODBC_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
464+
PHP_NEW_EXTENSION(odbc, php_odbc.c odbc_utils.c, $ext_shared,, [$ODBC_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
465465
else
466466
AC_MSG_CHECKING([for any ODBC driver support])
467467
AC_MSG_RESULT(no)

ext/odbc/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_ODBC == "yes") {
77
if (CHECK_LIB("odbc32.lib", "odbc") && CHECK_LIB("odbccp32.lib", "odbc")
88
&& CHECK_HEADER_ADD_INCLUDE("sql.h", "CFLAGS_ODBC")
99
&& CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_ODBC")) {
10-
EXTENSION("odbc", "php_odbc.c", PHP_ODBC_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
10+
EXTENSION("odbc", "php_odbc.c odbc_utils.c", PHP_ODBC_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1111
AC_DEFINE("HAVE_UODBC", 1, "ODBC support");
1212
if ("no" == PHP_ODBCVER) {
1313
AC_DEFINE("ODBCVER", "0x0350", "The highest supported ODBC version", false);

ext/odbc/odbc.stub.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,11 @@ function odbc_tableprivileges($odbc, ?string $catalog, string $schema, string $t
197197
*/
198198
function odbc_columnprivileges($odbc, ?string $catalog, string $schema, string $table, string $column) {}
199199
#endif
200+
201+
/* odbc_utils.c */
202+
203+
function odbc_connection_string_is_quoted(string $str): bool {}
204+
205+
function odbc_connection_string_should_quote(string $str): bool {}
206+
207+
function odbc_connection_string_quote(string $str): string {}

ext/odbc/odbc_arginfo.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 27a50ba79ed632721ee458527ef543e4b44ee897 */
2+
* Stub hash: 298e48377c2d18c532d91a9ed97886b49a64c096 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
55
ZEND_END_ARG_INFO()
@@ -245,6 +245,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
245245
ZEND_END_ARG_INFO()
246246
#endif
247247

248+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_connection_string_is_quoted, 0, 1, _IS_BOOL, 0)
249+
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
250+
ZEND_END_ARG_INFO()
251+
252+
#define arginfo_odbc_connection_string_should_quote arginfo_odbc_connection_string_is_quoted
253+
254+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_connection_string_quote, 0, 1, IS_STRING, 0)
255+
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
256+
ZEND_END_ARG_INFO()
257+
248258

249259
ZEND_FUNCTION(odbc_close_all);
250260
ZEND_FUNCTION(odbc_binmode);
@@ -307,6 +317,9 @@ ZEND_FUNCTION(odbc_tableprivileges);
307317
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
308318
ZEND_FUNCTION(odbc_columnprivileges);
309319
#endif
320+
ZEND_FUNCTION(odbc_connection_string_is_quoted);
321+
ZEND_FUNCTION(odbc_connection_string_should_quote);
322+
ZEND_FUNCTION(odbc_connection_string_quote);
310323

311324

312325
static const zend_function_entry ext_functions[] = {
@@ -373,5 +386,8 @@ static const zend_function_entry ext_functions[] = {
373386
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
374387
ZEND_FE(odbc_columnprivileges, arginfo_odbc_columnprivileges)
375388
#endif
389+
ZEND_FE(odbc_connection_string_is_quoted, arginfo_odbc_connection_string_is_quoted)
390+
ZEND_FE(odbc_connection_string_should_quote, arginfo_odbc_connection_string_should_quote)
391+
ZEND_FE(odbc_connection_string_quote, arginfo_odbc_connection_string_quote)
376392
ZEND_FE_END
377393
};
File renamed without changes.

ext/standard/tests/general_functions/odbc_utils.phpt renamed to ext/odbc/tests/odbc_utils.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
--TEST--
22
Test common ODBC string functionality
3+
--EXTENSIONS--
4+
odbc
35
--FILE--
46
<?php
57

ext/standard/basic_functions.stub.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,14 +1604,6 @@ function gettimeofday(bool $as_float = false): array|float {}
16041604
function getrusage(int $mode = 0): array|false {}
16051605
#endif
16061606

1607-
/* odbc_utils.c */
1608-
1609-
function odbc_connection_string_is_quoted(string $str): bool {}
1610-
1611-
function odbc_connection_string_should_quote(string $str): bool {}
1612-
1613-
function odbc_connection_string_quote(string $str): string {}
1614-
16151607
/* pack.c */
16161608

16171609
/** @refcount 1 */

ext/standard/basic_functions_arginfo.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: a88dcbd2386a47eaae2f234c405970f4da21e760 */
2+
* Stub hash: b1c51fabe59bba6706500365f3eb7d9676d625f6 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -1747,16 +1747,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getrusage, 0, 0, MAY_BE_ARRAY|MA
17471747
ZEND_END_ARG_INFO()
17481748
#endif
17491749

1750-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_connection_string_is_quoted, 0, 1, _IS_BOOL, 0)
1751-
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
1752-
ZEND_END_ARG_INFO()
1753-
1754-
#define arginfo_odbc_connection_string_should_quote arginfo_odbc_connection_string_is_quoted
1755-
1756-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_connection_string_quote, 0, 1, IS_STRING, 0)
1757-
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
1758-
ZEND_END_ARG_INFO()
1759-
17601750
#define arginfo_pack arginfo_sprintf
17611751

17621752
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unpack, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
@@ -2720,9 +2710,6 @@ ZEND_FUNCTION(gettimeofday);
27202710
#if defined(HAVE_GETRUSAGE)
27212711
ZEND_FUNCTION(getrusage);
27222712
#endif
2723-
ZEND_FUNCTION(odbc_connection_string_is_quoted);
2724-
ZEND_FUNCTION(odbc_connection_string_should_quote);
2725-
ZEND_FUNCTION(odbc_connection_string_quote);
27262713
ZEND_FUNCTION(pack);
27272714
ZEND_FUNCTION(unpack);
27282715
ZEND_FUNCTION(password_get_info);
@@ -3367,9 +3354,6 @@ static const zend_function_entry ext_functions[] = {
33673354
#if defined(HAVE_GETRUSAGE)
33683355
ZEND_FE(getrusage, arginfo_getrusage)
33693356
#endif
3370-
ZEND_FE(odbc_connection_string_is_quoted, arginfo_odbc_connection_string_is_quoted)
3371-
ZEND_FE(odbc_connection_string_should_quote, arginfo_odbc_connection_string_should_quote)
3372-
ZEND_FE(odbc_connection_string_quote, arginfo_odbc_connection_string_quote)
33733357
ZEND_FE(pack, arginfo_pack)
33743358
ZEND_FE(unpack, arginfo_unpack)
33753359
ZEND_FE(password_get_info, arginfo_password_get_info)

ext/standard/config.m4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.
460460
http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
461461
var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \
462462
filters.c proc_open.c streamsfuncs.c http.c password.c \
463-
random.c net.c hrtime.c crc32_x86.c libavifinfo/avifinfo.c \
464-
odbc_utils.c,,,
463+
random.c net.c hrtime.c crc32_x86.c libavifinfo/avifinfo.c,,,
465464
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
466465

467466
PHP_ADD_BUILD_DIR($ext_builddir/libavifinfo)

ext/standard/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
3535
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
3636
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
3737
user_filters.c uuencode.c filters.c proc_open.c password.c \
38-
streamsfuncs.c http.c flock_compat.c random.c hrtime.c odbc_utils.c", false /* never shared */,
38+
streamsfuncs.c http.c flock_compat.c random.c hrtime.c", false /* never shared */,
3939
'/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
4040
ADD_SOURCES("ext/standard/libavifinfo", "avifinfo.c", "standard");
4141
PHP_STANDARD = "yes";

0 commit comments

Comments
 (0)