GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73570
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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.

References count, db_calloc(), and db_init_string().

Referenced by db__recv_string_array(), and db_alloc_index_columns().

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.

References db_enlarge_string(), db_get_string(), DB_OK, and db_set_string().

Referenced by db_d_append_error(), db_d_report_error(), db_delete_table(), db_double_quote_string(), db_list_drivers(), db_select_CatValArray(), db_table_to_sql(), IL_check_at_points_2d(), P_Aux_to_Vector(), P_Drop_Aux_Table(), and P_Sparse_Points().

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.

References db_get_string(), and db_set_string().

Referenced by db_clone_table(), db_copy_column(), and db_copy_value().

void db_double_quote_string ( dbString src)

Replace each ' is replaced by ''.

Parameters
srcpointer to dbString

Definition at line 240 of file string.c.

References db_append_string(), db_free_string(), db_get_string(), db_init_string(), db_set_string(), and NULL.

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.

Referenced by db__recv_string(), and db_append_string().

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.

References db_free(), and db_free_string().

Referenced by db__recv_string_array(), db_d_list_databases(), db_free_index(), and db_table_exists().

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.

Referenced by db__send_Cstring().

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.

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.

Referenced by IL_check_at_points_2d(), P_Aux_to_Vector(), and Vect_write_ascii().