I developed an application in iOS using qt. I am trying to create a DB sqlitedata.db. But DB is not getting created.
I have used
QStandardPaths::standardLocations(QStandardPaths::StandardLocation type)
to get the correct path.
The path returned from qDebug() was:
/var/mobile/Applications/262093E8-F9A7-4624-9559-FB3C6BF393E5/Library/Application Support/sqlitedata.db
But inside the Library folder, there is no folder named Application Support and no DB.
Please help with a solution to create a DB and read / update the DB through application.
make sure the path returned from QStandardPath actually exists. If it doesn't, than create it first.
Related
I am using Installshield to deploy my application which is developed in vc++,MS-Access DB.Here I have to store the database dynamic location when the time of installation. If the db file already exist then it only gets the path.
After that I need to create a property file that store the path of db.and from the property file data i need to access my db.How to do this? Can any one help me in this?
I am working with the libmysqld c library in a C++ application on windows in order to interface with an embedded mysql server i.e. a mysql server that is online for the lifetime of the process that embeds it. The application that creates the database uses a mysql .ini file for creating the datadir relative to the application directory instead of in the global mysql install folder e.g.
[libmysqld_server]
basedir=./
datadir=./Database
I can programatically create a trigger with no problem e.g.
status = mysql_query(mysql,
"CREATE TRIGGER del_trigger AFTER DELETE ON table FOR EACH ROW\
INSERT INTO otherTable (col1, col2) VALUES (OLD.col1, OLD.col2)\
");
if (status == 0) {
Log(DEBUG, "Initialize(): <%p> Delete Trigger creation passed ...", this);
}
else {
Log(DEBUG, "Initialize(): <%p> Delete Trigger creation failed with error %s...", this, mysql_error(mysql));
}
The problem I run into however is that when the trigger gets called, mysql will complain that the mysql.proc table does not exist because I do not have a mysql database inside my application specific datadir. I have tried copying the mysql folder from the installation directory in C:\Program Files\MySQL... but then I run into issues where mysql reports
Error:Cannot load from mysql.proc. The table is probably corrupted
The only advice I have seen related to the above error is to run the 'mysql_upgrade' command which does not seem to work for the case of an embedded database using its own datadir. I'm at the point where all of the tables are created and their respective triggers are setup but just can't get around this mysql.proc error.
UPDATE:
I am also seeing some inconsistent behavior here. My version of MySQL is "mysql-5.5.16-win32" and it comes with a mysql_embedded.exe binary that I can use to open up a console and point to the database files generated by my application when it isn't running. When I perform operations in the mysql_embedded.exe, the triggers work without issue (no 'mysql.proc is probably corrupted' errors). So it seems like only the libmysqld c api is having an issue with the mysql system tables.
The solution was as simple as verifying that the "mysql" database was the same version as mysql version embedded in libmysqld. I verified my client version info via the following:
const char * version = mysql_get_client_info();
This returned "5.1.44" instead of the "5.5.16" that I was expecting. Downloading the mysql ZIP archive for 5.1.44 and using the mysql database in the datadir fixed the issue that I was experiencing.
I'm curious what the point of the structure.sql file is. It seems to be updated and created every time rails migrations are run. So it seems to be a visual representation of our database. What else can it be used for?
When one runs structure:load, what does it do? What does it mean to load a structure file into a database? Why would you need to do that?
Should one be committing the structure.sql file?
Seems like your rails app is configured to use the sql schema format
#/config/application.rb
...
config.active_record.schema_format = :sql
...
the structure.sql is in place of a schema.db.
Running db:structure:load ( or db:schema:load) will load your entire database. You only need to do this when bringing on a new app instance from scratch. After awhile, your migration files will become quite lengthy and it will be better to do a load first, then a migration when bringing up a new app instance
I am just starting with Django, and I would like to make an app that uses my existing sqlite db.
I read the docs and I found that you can create models from a db, using inspectdb; altho I can't find an example of how you use that command, on an existing db.
I copied the db file inside the directory of my project, ran the command and I see that a sqlite3 file is created in my directory project.
Altho the file has nothing to do with the database that I made. I tried to pass the db name to the inspectdb command but it says that it doesn't accept parameters.
So how can I actually tell the command to use my db to create the model for my app?
There must be some obvious step that I am missing...this is what I did:
-created the project
-created the app
-copied my db inside the project folder
-ran inspectdb
But I see the model empty, and a new db called db.sqlite3 created
Found the answer: there is a variable that has to be set, to define which one is the db that the application will use. the default is set to "db.sqlite3", which explain why I am getting this behavior.
Once you modify the name with the database that I already made, the command run without issues.
Not sure if it is just me getting stomped, but this info about the name that has to be changed was not mentioned anywhere...
Thanks
How can I programmatically dump/query Launch Services database in MacOS (i.e. analog of command lsregister -dump)?
EDIT: I want to get set of associations UTI -> Bundle_IDs. Using LSCopyAllRoleHandlersForContentType - does not always work, here a similar trouble, therefore concluded that the best working method - parsing the output of "lsregister -dump", but the location of lsregister changes from version to version.