English 中文(简体)
qlite3_column_text Return only 255 bytes,即使有数据可查
原标题:sqlite3_column_text returns only 255 bytes even though there is data in db

女士们,

I m 在SOS申请中使用FMDB。 我的栏目中有一些文字超过255字。 我使用BASE并浏览数据库档案,我可以询问各栏中的数据长度。 因此,我知道我的数据是在那里的,时间已超过255。

在试图从这些栏目中提取数据时,我总是得到精确的255英寸,我没有任何理由。

Here s some piece of code (basically from - (NSString*)stringForColumnIndex:(int)columnIdx { of FMDB FMResultSet.m, and I can trap the error already there.

- (NSString*)stringForColumnIndex:(int)columnIdx {

if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) {
    return nil;
}

const char *c = (const char *)sqlite3_column_text([_statement statement], columnIdx);

int xx = strlen(c); //added by me, already here it is only 255 bytes


if (!c) {
    // null row.
    return nil;
}
return [NSString stringWithUTF8String:c];
}

我失踪了什么? 使用标准提供的校准3.dylib的Im, FMDB 包括qlite.h。 我试图把类似问题拖到几个小时后再谈。

最佳回答

这既不是一种财行,也不是一种限制。 我利用FMDB从我的Kallite数据库返回,时间比255级更长。 我刚刚检查:

    FMResultSet *rs = [fmdb executeQuery:@"select personnel_description from personnel where personnel_id=297"];
    [rs next];
    NSString *test2 = [rs stringForColumnIndex:0];
    NSLog(@"%s len=%d string=%@", __FUNCTION__, [test2 length], test2);
    [rs close];

我的8429个性大体,与英国圣公会对我说的同样长的时间。

This makes me wonder if there s something strange about your data (e.g. binary data instead of characters, DBCS, etc.). Have you tried returning as an object rather than a string and examining that? Perhaps confirm that it is a NSString and not a NSData result set, e.g.:

    id test3 = [rs objectForColumnIndex:0];
    if ([test3 isKindOfClass:[NSString class]])
        NSLog(@"It s a string");
    else
        NSLog(@"It s not");

如果你真的认为这是一个财行问题,你可以尝试在FMDB讨论上提出这个问题。 此外,我也确保你拥有最新的财行法典,你可以从同一地点检索。

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签