grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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...
 
static int set_string (dbString *x, char *s, int copy)
 
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.

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

Referenced by db__recv_string_array(), and db_alloc_index_columns().

◆ 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.

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

Referenced by copy_table(), create_table(), 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(), init(), P_Aux_to_Vector(), P_Drop_Aux_Table(), and P_Sparse_Points().

◆ 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.

References db_get_string(), db_set_string(), dst, and src.

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

◆ 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.

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

Referenced by copy_table().

◆ 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(), NULL, and x.

Referenced by db__recv_string(), db_append_string(), and set_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.

References a, db_free(), and db_free_string().

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

◆ db_get_string()

◆ db_init_string()

◆ db_set_string()

◆ 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.

References s, set_string(), and x.

Referenced by db__send_Cstring().

◆ 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 x.

◆ 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 x.

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

◆ set_string()

static int set_string ( dbString x,
char *  s,
int  copy 
)
static

Definition at line 85 of file string.c.

References db_enlarge_string(), db_free_string(), DB_OK, NULL, s, and x.

Referenced by db_set_string(), and db_set_string_no_copy().