| FreeTDS API
    | 
Handle dynamic string. More...
| Classes | |
| struct | tds_dstr | 
| Structure to hold a string.  More... | |
| Macros | |
| #define | DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty) | 
| Initializer, used to initialize string like in the following example. | |
| #define | tds_dstr_empty(s) tds_dstr_free(s) | 
| Make a string empty. | |
| Typedefs | |
| typedef struct tds_dstr * | DSTR | 
| Structure to hold a string. | |
| Functions | |
| DSTR * | tds_dstr_alloc (DSTR *s, size_t length) | 
| allocate space for length char | |
| static char * | tds_dstr_buf (DSTR *s) | 
| Returns a buffer to edit the string. | |
| DSTR * | tds_dstr_copy (DSTR *s, const char *src) | 
| copy a string from another | |
| DSTR * | tds_dstr_copyn (DSTR *s, const char *src, size_t length) | 
| Set string to a given buffer of characters. | |
| static const char * | tds_dstr_cstr (const DSTR *s) | 
| Returns a C version (NUL terminated string) of dstr. | |
| DSTR * | tds_dstr_dup (DSTR *s, const DSTR *src) | 
| Duplicate a string from another dynamic string. | |
| void | tds_dstr_free (DSTR *s) | 
| free string | |
| static void | tds_dstr_init (DSTR *s) | 
| init a string with empty | |
| static int | tds_dstr_isempty (const DSTR *s) | 
| test if string is empty | |
| static size_t | tds_dstr_len (const DSTR *s) | 
| Returns the length of the string in bytes. | |
| DSTR * | tds_dstr_set (DSTR *s, char *src) | 
| set a string from another buffer. | |
| DSTR * | tds_dstr_setlen (DSTR *s, size_t length) | 
| limit length of string, MUST be <= current length | |
| void | tds_dstr_zero (DSTR *s) | 
| clear all string filling with zeroes (mainly for security reason) | |
| Variables | |
| const struct tds_dstr | tds_str_empty | 
| Internal representation for an empty string. | |
Handle dynamic string.
In this string are always valid (you don't have NULL pointer, only empty strings)
| #define DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty) | 
Initializer, used to initialize string like in the following example.
Structure to hold a string.
Use tds_dstr_* functions/macros, do not access members directly. There should be always a buffer.
allocate space for length char
| s | dynamic string | 
| length | new length | 
| 
 | inlinestatic | 
Returns a buffer to edit the string.
Be careful to avoid buffer overflows and remember to set the correct length at the end of the editing if changed.
copy a string from another
| s | dynamic string | 
| src | source buffer | 
Set string to a given buffer of characters.
| s | dynamic string | 
| src | source buffer | 
| length | length of source buffer | 
Duplicate a string from another dynamic string.
| s | output string | 
| src | source string to copy | 
set a string from another buffer.
The string will use the supplied buffer (it not copy the string), so it should be a pointer returned by malloc.
| s | dynamic string | 
| src | source buffer |