char* MemoryArray::write(int addr, char *buffer, int bufferSize) { if(m_array == NULL) { return NULL; } if(addr >= m_pagesPerBlock) { return NULL; } if(m_array[addr] == NULL) { allocateRow(addr); } if(isLPNPage(addr)) { memcpy(m_array[addr], buffer, m_bytesPerPage < bufferSize ? m_bytesPerPage : bufferSize); } else { for(int i=0; i<m_sectorsPerPage; i++) { int offset = i * (m_bytesPerPage/m_sectorsPerPage); *(m_array[addr]+i) = buffer[offset]; } } return m_array[addr]; }
/** * This function provides a programmatic means of creating a Row object. * * @param results A reference to the ResultSet object that the row relates to. * @param data A reference to an array containing the row data. * @param number A reference to the number to be associated with the row. * * @return A reference to the Row object created. * */ VALUE rb_row_new(VALUE results, VALUE data, VALUE number) { VALUE row = allocateRow(cRow); initializeRow(row, results, data, number); return(row); }