Помогите с функцией в SQLite.
От: Heir  
Дата: 19.12.05 13:23
Оценка:
Друзья !!!

Вот замаялся и прошу вашей помощи.

В SQLite есть функция:
int sqlite3_get_table(sqlite3*,              /* An open database */
                      const char *sql,       /* SQL to be executed */
                      char ***resultp,       /* Result written to a char *[]  that this points to */
                      int *nrow,             /* Number of result rows written here */
                      int *ncolumn,          /* Number of result columns written here */
                      char **errmsg          /* Error msg written here */


Нужно в C# написать обертку для нее. Пишу так:
[DllImport("sqlite3.dll")]
private static extern int sqlite3_get_table(IntPtr handle, String sql, ref String[] presult, out int nrow, out int ncolumn,ref String errmsg);


Вызываю так:
errorNum = sqlite3_get_table(dbHandle,"SELECT * FROM FioTable;",ref result,out nrow,out ncolumn,ref errmsg);


При этом все проходит без ошибок, но в массиве полученных данных (result) есть только одна запись, а должно быть несколько. В доке написанно следующее:
If the 3rd argument were &azResult then after the function returns azResult will contain the following data:

        azResult[0] = "Name";
        azResult[1] = "Age";
        azResult[2] = "Alice";
        azResult[3] = "43";
        azResult[4] = "Bob";
        azResult[5] = "28";
        azResult[6] = "Cindy";
        azResult[7] = "21";


Получается, что я только result[0] получаю, но правда он соответствует именно тому, чего я должен получить. Понимаю, что нестыковка именно в переменной, а точнее в ее определении. Помогите, кто может, кто может, помогите !!!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.