GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
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.
 
int db_set_string (dbString *x, const char *s)
 Inserts string to dbString (enlarge string)
 
int db_set_string_no_copy (dbString *x, char *s)
 Inserts string to dbString (overwrite current value)
 
unsigned int db_sizeof_string (const dbString *x)
 Get string size.
 
void db_zero_string (dbString *x)
 Zero string.
 
int db_enlarge_string (dbString *x, int len)
 Enlarge dbString.
 
chardb_get_string (const dbString *x)
 Get string.
 
void db_free_string (dbString *x)
 Free allocated space for dbString.
 
void db_free_string_array (dbString *a, int n)
 Free allocated dbString array.
 
dbStringdb_alloc_string_array (int count)
 Allocate dbString array.
 
int db_append_string (dbString *x, const char *s)
 Append string to dbString.
 
int db_copy_string (dbString *dst, const dbString *src)
 Copy dbString.
 
void db_double_quote_string (dbString *src)
 Replace each ' is replaced by ''.
 

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

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_write_point_2d(), 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(), and db_set_string().

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

◆ 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(), and db_append_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 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 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_write_point_2d(), P_Aux_to_Vector(), and Vect_write_ascii().