예제 #1
0
bool CMySQL_RowResult::Fetch()
{
    m_CurrItem = -1;
    m_Row = mysql_fetch_row(m_Result);
    if ( m_Row ) {
        m_Lengths = mysql_fetch_lengths(m_Result);
        if ( !m_Lengths )
            DATABASE_DRIVER_WARNING( "Failed: mysql_fetch_lengths", 800006 );
    }
    m_CurrItem = 0;
    return m_Row != 0;
}
예제 #2
0
bool CMySQL_LangCmd::Send()
{
    if (mysql_real_query
        (&m_Connect->m_MySQL, GetQuery().data(), GetQuery().length()) != 0) {
        DATABASE_DRIVER_WARNING( "Failed: mysql_real_query", 800003 );
    }
    GetBindParamsImpl().LockBinding();

    my_ulonglong nof_Rows = mysql_affected_rows(&this->m_Connect->m_MySQL);
    // There is not too much sence in comparing unsigned value with -1.
    // m_HasMoreResults = nof_Rows == -1 || nof_Rows > 0;
    m_HasMoreResults = nof_Rows > 0;
    return true;
}
예제 #3
0
CMySQL_RowResult::CMySQL_RowResult(CMySQL_Connection& conn)
    : m_Connect(&conn),
      m_CurrItem(-1)
{
    m_Result = mysql_use_result(&m_Connect->m_MySQL);
    if ( !m_Result ) {
        DATABASE_DRIVER_WARNING( "Failed: mysql_use_result", 800004 );
    }

    unsigned int col_num = mysql_num_fields(m_Result);

    MYSQL_FIELD* fields = mysql_fetch_fields(m_Result);

    for (unsigned int n = 0;  n < col_num;  n++) {
        m_CachedRowInfo.Add(
            fields[n].name,
            fields[n].max_length,
            s_GetDataType(fields[n].type)
            );
    }
}