Please check what the sizeof() builtin function does. Maybe you meant strlen() instead? If so, just pass -1 and don't bother to count the string length. Using the actual length is only faster if your compiler does the counting at compile time. As in char sql[] = "SELECT 1"; sqlite3_prepare( .. sql, sizeof(sql), .. )