GRASS GIS 7 Programmer's Manual  7.9.dev(2020)-5fd8c298d
string.c File Reference

DBMI Library (base) - string management. More...

#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
Include dependency graph for string.c:

Go to the source code of this file.

Functions

void db_init_string (dbString *x)
 Initialize dbString. More...
 
int db_set_string (dbString *x, const char *s)
 Inserts string to dbString (enlarge string) More...
 
int db_set_string_no_copy (dbString *x, char *s)
 Inserts string to dbString (overwrite current value) More...
 
unsigned int db_sizeof_string (const dbString *x)
 Get string size. More...
 
void db_zero_string (dbString *x)
 Zero string. More...
 
int db_enlarge_string (dbString *x, int len)
 Enlarge dbString. More...
 
char * db_get_string (const dbString *x)
 Get string. More...
 
void db_free_string (dbString *x)
 Free allocated space for dbString. More...
 
void db_free_string_array (dbString *a, int n)
 Free allocated dbString array. More...
 
dbStringdb_alloc_string_array (int count)
 Allocate dbString array. More...
 
int db_append_string (dbString *x, const char *s)
 Append string to dbString. More...
 
int db_copy_string (dbString *dst, const dbString *src)
 Copy dbString. More...
 
void db_double_quote_string (dbString *src)
 Replace each ' is replaced by ''. More...
 

Detailed Description

DBMI Library (base) - string management.

(C) 1999-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Joel Jones (CERL/UIUC)
Upgraded to GRASS 5.7 by Radim Blazek

Definition in file string.c.

Function Documentation

◆ db_alloc_string_array()

dbString* db_alloc_string_array ( int  count)

Allocate dbString array.

Parameters
countnumber of items to be allocated
Returns
pointer to 1st dbString in the array

Definition at line 181 of file string.c.

◆ db_append_string()

int db_append_string ( dbString x,
const char *  s 
)

Append string to dbString.

Parameters
xpointer to dbString
sstring to be appended
Returns
DB_OK on success
otherwise error code is returned

Definition at line 205 of file string.c.

Referenced by db_d_append_error(), db_d_report_error(), db_delete_table(), and P_Drop_Aux_Table().

◆ db_copy_string()

int db_copy_string ( dbString dst,
const dbString src 
)

Copy dbString.

Parameters
dstdestination dbString
srcsource dbString
Returns
DB_OK on success
DB_ERR code on error

Definition at line 230 of file string.c.

◆ db_double_quote_string()

void db_double_quote_string ( dbString src)

Replace each ' is replaced by ''.

Parameters
srcpointer to dbString

Definition at line 240 of file string.c.

◆ db_enlarge_string()

int db_enlarge_string ( dbString x,
int  len 
)

Enlarge dbString.

Parameters
xpointer to dbString
lenrequested string size
Returns
DB_OK on success
DB_MEMORY_ERR on error

Definition at line 120 of file string.c.

References DB_MEMORY_ERR, DB_OK, db_realloc(), _db_string::nalloc, NULL, and _db_string::string.

◆ db_free_string()

◆ db_free_string_array()

void db_free_string_array ( dbString a,
int  n 
)

Free allocated dbString array.

Parameters
apointer to 1st dbString in the array
nnumber of items in array

Definition at line 163 of file string.c.

Referenced by db_free_index().

◆ db_get_string()

◆ db_init_string()

◆ db_set_string()

int db_set_string ( dbString x,
const char *  s 
)

Inserts string to dbString (enlarge string)

Parameters
[in,out]xpointer to dbString
sstring to be inserted
Returns
DB_OK on success
DB_MEMORY_ERR on error

Definition at line 41 of file string.c.

Referenced by db_convert_value_datetime_into_string(), db_convert_value_to_string(), db_delete_table(), db_grant_on_table(), db_gversion(), db_set_column_description(), db_set_column_name(), db_set_handle(), db_set_index_column_name(), db_set_index_name(), and db_set_index_table_name().

◆ db_set_string_no_copy()

int db_set_string_no_copy ( dbString x,
char *  s 
)

Inserts string to dbString (overwrite current value)

Parameters
[in,out]xpointer to dbString
sstring to be inserted
Returns
DB_OK on success
DB_MEMORY_ERR on error

Definition at line 55 of file string.c.

◆ db_sizeof_string()

unsigned int db_sizeof_string ( const dbString x)

Get string size.

Parameters
xpointer to dbString
Returns
string size

Definition at line 67 of file string.c.

References _db_string::nalloc.

◆ db_zero_string()

void db_zero_string ( dbString x)

Zero string.

Parameters
xpointer to dbString

Definition at line 79 of file string.c.

References db_get_string(), db_zero(), and _db_string::nalloc.