English 中文(简体)
函数sqlite3_open_v2文件路径
原标题:Function sqlite3_open_v2 filepath
  • 时间:2012-05-27 17:11:02
  •  标签:
  • c++
  • sqlite
  • qt

我对 sqlite3_open_v2 函数有问题。 OS 是 Windows, 在 Qt 创造者中开发 。

sqlite3_open ("database.db", & amp;db); // 工作精细

但是

sqlite3_open_v2(“数据库.db”,&;db,SQLITE_open_READWRITE,“”);//不工作

I m quite sure it s not utf-8 codding problem, cause first function works fine and i tried to change codding in project properties. Maybe problem is with filepath in first arg. Absolute paths didn t work too.

有人有使用此功能的想法和示例吗?

问题回答

谢谢你的回答。

最后一个参数有问题。它必须为0或NULL,而不是“”

就这些,还是谢谢

This is probably because the file does not exist in the working directory. I would add some code to print the path of the current working directory just before calling sqlite3_open_v2 to be sure.

SQLITE_open_READWRITE的sqlite3_open和sqlite3-open_v2之间的一个区别是,第一个会在找不到文件时创建一个空数据库,而第二个不会。

为了允许使用sqlite3_open_v2创建数据库,您应该使用:

sqlite3_open_v2("database.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );

Be sure to have a look at the documentation for more information: http://www.sqlite.org/c3ref/open.html





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签