library/src/databases/bpdb/BP-DB.cc
// This function formats result information into proper output for json.  This is mainly used for autojson creation.  This
// will call one of the functions below by switching off based on type.  Each basic type has it's own function to make things
// developmentally clearer.
This function formats result information into proper output for json.  This is mainly used for autojson creation.  This
will call one of the functions below by switching off based on type.  Each basic type has it's own function to make things
developmentally clearer.
This function formats result information into proper output for json . This is mainly used for autojson creation . This will call one of the functions below by switching off based on type . Each basic type has it ' s own function to make things developmentally clearer .
char * BP_DBMariadbConvertColumnResultDataToJSONData
(
	MYSQL_BIND             * col_bind_info,
	BPDB_MARIADB_COLUMN_TYPE type
)
{
	if(!col_bind_info)
		return NULL;
	char int_out_buff[256];
	BP_ZERO_STACK(int_out_buff);
	long long int           * tmp_llint_ptr  = 0;
	long long unsigned int  tmp_lluint_ptr = 0;
	char * blob_data = NULL;
	size_t blob_len  = 0;
	 day_of_week
	 month
	 day of month
	 year
	 HH:MM:SS
	 timezone
	 structure to hold time data
	MYSQL_TIME * time_data = NULL;
	 switch on the type
	switch(type)
	{
		case BPDB_MARIADB_COLUMN_TYPE_UNSET:
			break;
		case BPDB_MARIADB_COLUMN_TYPE_TINYINT:
		case BPDB_MARIADB_COLUMN_TYPE_SMALLINT:
		case BPDB_MARIADB_COLUMN_TYPE_MEDIUMINT:
		case BPDB_MARIADB_COLUMN_TYPE_INT:
		case BPDB_MARIADB_COLUMN_TYPE_BIGINT:
		case BPDB_MARIADB_COLUMN_TYPE_DECIMAL:
		case BPDB_MARIADB_COLUMN_TYPE_FLOAT:
		case BPDB_MARIADB_COLUMN_TYPE_DOUBLE:
		case BPDB_MARIADB_COLUMN_TYPE_BIT:
			return BP_DBMariadbConvertIntegerColumnResultDataToJSONData(col_bind_info, type);
		case BPDB_MARIADB_COLUMN_TYPE_CHAR:
		case BPDB_MARIADB_COLUMN_TYPE_VARCHAR:
		case BPDB_MARIADB_COLUMN_TYPE_BINARY:
		case BPDB_MARIADB_COLUMN_TYPE_VARBINARY:
		case BPDB_MARIADB_COLUMN_TYPE_TINYBLOB:
		case BPDB_MARIADB_COLUMN_TYPE_BLOB:
		case BPDB_MARIADB_COLUMN_TYPE_MEDIUMBLOB:
		case BPDB_MARIADB_COLUMN_TYPE_LONGBLOB:
		case BPDB_MARIADB_COLUMN_TYPE_TINYTEXT:
		case BPDB_MARIADB_COLUMN_TYPE_TEXT:
		case BPDB_MARIADB_COLUMN_TYPE_MEDIUMTEXT:
		case BPDB_MARIADB_COLUMN_TYPE_LONGTEXT:
			return BP_DBMariadbConvertBlobColumnResultDataToJSONData(col_bind_info, type);
		case BPDB_MARIADB_COLUMN_TYPE_ENUM:
			break;
		case BPDB_MARIADB_COLUMN_TYPE_DATE:
		case BPDB_MARIADB_COLUMN_TYPE_TIME:
		case BPDB_MARIADB_COLUMN_TYPE_DATETIME:
		case BPDB_MARIADB_COLUMN_TYPE_TIMESTAMP:
		case BPDB_MARIADB_COLUMN_TYPE_YEAR:
			return BP_DBMariadbConvertTimeColumnResultToJSONData(col_bind_info, type);
		default:
			break;
	}
	return NULL;
}
char * BP_DBMariadbConvertColumnResultDataToJSONData ( MYSQL_BIND * col_bind_info , BPDB_MARIADB_COLUMN_TYPE type ) { if ( ! col_bind_info ) return NULL ; char int_out_buff [ 256 ] ; BP_ZERO_STACK ( int_out_buff ) ; long long int * tmp_llint_ptr = 0 ; long long unsigned int tmp_lluint_ptr = 0 ; char * blob_data = NULL ; size_t blob_len = 0 ; MYSQL_TIME * time_data = NULL ; switch ( type ) { case BPDB_MARIADB_COLUMN_TYPE_UNSET : break ; case BPDB_MARIADB_COLUMN_TYPE_TINYINT : case BPDB_MARIADB_COLUMN_TYPE_SMALLINT : case BPDB_MARIADB_COLUMN_TYPE_MEDIUMINT : case BPDB_MARIADB_COLUMN_TYPE_INT : case BPDB_MARIADB_COLUMN_TYPE_BIGINT : case BPDB_MARIADB_COLUMN_TYPE_DECIMAL : case BPDB_MARIADB_COLUMN_TYPE_FLOAT : case BPDB_MARIADB_COLUMN_TYPE_DOUBLE : case BPDB_MARIADB_COLUMN_TYPE_BIT : return BP_DBMariadbConvertIntegerColumnResultDataToJSONData ( col_bind_info , type ) ; case BPDB_MARIADB_COLUMN_TYPE_CHAR : case BPDB_MARIADB_COLUMN_TYPE_VARCHAR : case BPDB_MARIADB_COLUMN_TYPE_BINARY : case BPDB_MARIADB_COLUMN_TYPE_VARBINARY : case BPDB_MARIADB_COLUMN_TYPE_TINYBLOB : case BPDB_MARIADB_COLUMN_TYPE_BLOB : case BPDB_MARIADB_COLUMN_TYPE_MEDIUMBLOB : case BPDB_MARIADB_COLUMN_TYPE_LONGBLOB : case BPDB_MARIADB_COLUMN_TYPE_TINYTEXT : case BPDB_MARIADB_COLUMN_TYPE_TEXT : case BPDB_MARIADB_COLUMN_TYPE_MEDIUMTEXT : case BPDB_MARIADB_COLUMN_TYPE_LONGTEXT : return BP_DBMariadbConvertBlobColumnResultDataToJSONData ( col_bind_info , type ) ; case BPDB_MARIADB_COLUMN_TYPE_ENUM : break ; case BPDB_MARIADB_COLUMN_TYPE_DATE : case BPDB_MARIADB_COLUMN_TYPE_TIME : case BPDB_MARIADB_COLUMN_TYPE_DATETIME : case BPDB_MARIADB_COLUMN_TYPE_TIMESTAMP : case BPDB_MARIADB_COLUMN_TYPE_YEAR : return BP_DBMariadbConvertTimeColumnResultToJSONData ( col_bind_info , type ) ; default : break ; } return NULL ; }
This function formats result information into proper output for json.
This function formats result information into proper output for json .
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Create Buffers for Int Types %%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create space for potential integer output // create temporary types // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Create Buffers for Blob Types %%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // arbitrary blob data // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Create Buffers for Time Types %%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Javascript time format is: // // day_of_week // month // day of month // year // HH:MM:SS // timezone // structure to hold time data // switch on the type /* begin numeric data types */ /* begin string data types */ /* todo: enum data type */ /* begin date and time data types */