コード例 #1
0
void
ExportAsSimpleSQL::AddColumnNames(ExportSQLData *data, wyString &value)
{
	wyInt32 count;

	value.Add("(");

	for(count = 0; count < m_myres->field_count; count++)
    {
		if(data->m_selcol[count] == wyTrue)
			value.AddSprintf("`%s`, ", m_myres->fields[count].name);
    }

	value.Strip(2); // Strip one for ',' and one for blank space
	value.Add(") ");
}
コード例 #2
0
// Function creates a text buffer with all the properties and sends newly allocated buffer.
wyBool
TableMakerAdvProperties::GetAdvPropString( Tunnel *tunnel, PMYSQL mysql,
        TableAdvPropValues* ptav, wyString& str)
{
    wyBool ismysql41 = IsMySQL41(tunnel, mysql);

    if(ptav->m_changed == wyFalse)
        return wyFalse;

    /* 	nCount += sprintf( szQuery+nCount, " ,type=%s ", ptav->szType );
    	This comma is not required, this is required in the alter stmt when this
    	stmt is not the first one. So we are checking it in the query builder
    	In the latest versions we need 'Engine' in place of 'Type'
    */
    if(ptav->m_type.GetLength())
    {
        if(ismysql41 == wyTrue)
            str.AddSprintf(" Engine=%s ", ptav->m_type.GetString());
        else
            str.AddSprintf(" Type=%s ", ptav->m_type.GetString());
    }

    if(ptav->m_checksum.CompareI(STR_DEFAULT) != 0)
        str.AddSprintf("checksum=%s ", ptav->m_checksum.GetString());

    if(ptav->m_auto_incr.GetLength())
        str.AddSprintf("auto_increment=%s ", ptav->m_auto_incr.GetString());

    if(ptav->m_avg_row.GetLength())
        str.AddSprintf("avg_row_length=%s ", ptav->m_avg_row.GetString());

    if(ptav->m_comment.GetLength())
        str.AddSprintf("comment='%s' ", ptav->m_comment.GetString());
    else
        str.Add("comment='' ");

    if(ptav->m_max_rows.GetLength())
        str.AddSprintf("max_rows=%s ", ptav->m_max_rows.GetString());

    if(ptav->m_min_rows.GetLength())
        str.AddSprintf("min_rows=%s ", ptav->m_min_rows.GetString());

    if(ptav->m_delay.CompareI(STR_DEFAULT) != 0)
        str.AddSprintf("delay_key_write=%s ", ptav->m_delay.GetString());

    if(ptav->m_rowformat.GetLength())
        str.AddSprintf("row_format=%s ", ptav->m_rowformat.GetString());

    if(ptav->m_chunks.GetLength())
        str.AddSprintf("raid_chunks=%s ", ptav->m_chunks.GetString());

    if(ptav->m_chunksize.GetLength())
        str.AddSprintf("raid_chunksize=%s ", ptav->m_chunksize.GetString());

    if(ismysql41 == wyTrue)
    {
        if(ptav->m_charset.GetLength() && ptav->m_charset.Compare(STR_DEFAULT) != 0)
            str.AddSprintf("charset=%s ", ptav->m_charset.GetString());

        if(ptav->m_collation.GetLength() && ptav->m_collation.Compare(STR_DEFAULT) != 0)
            str.AddSprintf("collate=%s ", ptav->m_collation.GetString());
    }

    return wyTrue;
}