I am using the ultralite DB to store messages on an iOS client. Currently I am making use of a LONG VARCHAR field to hold the UTF8String. The ultralite documentation mentions that the maximum size that a long varchar field can hold is 2GB. Reference: (http://dcx.sybase.com/1200/en/dbreference/longvarchar1.html). When I fire an insert statement to the DB, if the field size is greater than 30kB, the field does not get inserted ,and there is no error code returned for the execute statement either. Is there an alternative to store strings with length greater than 30kB? |
How are you inserting the data? There are string size limitations (and I think they're around 32K), where you would need to set the long varchar value in the database in chunks. So, you might need to do something like this (not ObjectiveC and missing some error checking, but hopefully you get the picture): PreparedStatement * ps = connection->PrepareStatement( "INSERT INTO T(long_vchar_col) VALUES( ? )" ); while( 1 ) { // assume that after this call, data is pointing at a null-terminated string // of size smaller than 30K data = getNextChunkOfLongString(); if( data == null ) break; ps->AppendParameterStringChunk( 1, data ); } ps->ExecuteStatement(); ps->Close(); Have you tried the Append...Chunk() methods? |
Can you show the code you use to insert? To insert long strings, you must use the AppendStringChunk (when inserting via a result set or table object) or AppendParameterStringChunk (when setting a parameter) methods. The Append-Chunk in the name reflects that you can call the functions repeatedly to build a large value in the database. But they work fine with a single call too. (And since you reference 1200 documentation, I should mention that it's best to update to the latest Mac 12.0.1 build...) |