php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_odbc_utils.h File Reference
#include "php.h"

Go to the source code of this file.

Functions

PHPAPI bool php_odbc_connstr_is_quoted (const char *str)
 
PHPAPI bool php_odbc_connstr_should_quote (const char *str)
 
PHPAPI size_t php_odbc_connstr_estimate_quote_length (const char *in_str)
 
PHPAPI size_t php_odbc_connstr_quote (char *out_str, const char *in_str, size_t out_str_size)
 

Function Documentation

◆ php_odbc_connstr_estimate_quote_length()

PHPAPI size_t php_odbc_connstr_estimate_quote_length ( const char * in_str)

Estimates the worst-case scenario for a quoted version of a string's size.

Definition at line 78 of file php_odbc_utils.c.

◆ php_odbc_connstr_is_quoted()

PHPAPI bool php_odbc_connstr_is_quoted ( const char * str)

Determines if a string matches the ODBC quoting rules.

A valid quoted string begins with a '{', ends with a '}', and has no '}' inside of the string that aren't repeated (as to be escaped).

These rules are what .NET also follows.

Definition at line 39 of file php_odbc_utils.c.

◆ php_odbc_connstr_quote()

PHPAPI size_t php_odbc_connstr_quote ( char * out_str,
const char * in_str,
size_t out_str_size )

Quotes a string with ODBC rules.

Some characters (curly braces, semicolons) are special and must be quoted. In the case of '}' in a quoted string, they must be escaped SQL style; that is, repeated.

Definition at line 91 of file php_odbc_utils.c.

◆ php_odbc_connstr_should_quote()

PHPAPI bool php_odbc_connstr_should_quote ( const char * str)

Determines if a value for a connection string should be quoted.

The ODBC specification mentions: "Because of connection string and initialization file grammar, keywords and attribute values that contain the characters []{}(),;?*=!@ not enclosed with braces should be avoided."

Note that it assumes that the string is not already quoted. You should check beforehand.

Definition at line 70 of file php_odbc_utils.c.