sqldata/sqlociapi.cpp
// Get table or column comment by table and column name
Get table or column comment by table and column name
Get table or column comment by table and column name
int SqlOciApi::GetComment(const char *table, const char *column, std::string &comment) 
{
	if(table == NULL)
		return -1;
	std::string schema;
	std::string object;
	SplitQualifiedName(table, schema, object);
	for(std::list<SqlComments>::iterator i = _table_comments.begin(); i != _table_comments.end(); i++)
	{
		char *s = (*i).schema;
		char *t = (*i).table;
		char *c = (*i).column;
		char *cm = (*i).comment;
		if(s != NULL && t != NULL && strcmp(s, schema.c_str()) == 0 && strcmp(t, object.c_str()) == 0)
		{
			if(column != NULL && c != NULL && cm != NULL && strcmp(c, column) == 0)
			{
				comment = cm;
				break;
			}
			else
			if(column == NULL && c == NULL && cm != NULL && (*i).type == 'T')
			{
				comment = cm;
				break;
			}
		}
	}
	return 0;
}
int SqlOciApi :: GetComment ( const char * table , const char * column , std :: string & comment ) { if ( table == NULL ) return -1 ; std :: string schema ; std :: string object ; SplitQualifiedName ( table , schema , object ) ; for ( std :: list < SqlComments > :: iterator i = _table_comments . begin ( ) ; i != _table_comments . end ( ) ; i ++ ) { char * s = ( * i ) . schema ; char * t = ( * i ) . table ; char * c = ( * i ) . column ; char * cm = ( * i ) . comment ; if ( s != NULL && t != NULL && strcmp ( s , schema . c_str ( ) ) == 0 && strcmp ( t , object . c_str ( ) ) == 0 ) { if ( column != NULL && c != NULL && cm != NULL && strcmp ( c , column ) == 0 ) { comment = cm ; break ; } else if ( column == NULL && c == NULL && cm != NULL && ( * i ) . type == ' ' ) { comment = cm ; break ; } } } return 0 ; }
Get table or column comment by table and column name
Get table or column comment by table and column name
// Column can be NULL if table comment is required // Find table columns (already ordered by column number) // Table found // Column found // Table comment