I am using this plugin in my ionic project. I am able to open the db. I can see the log:
DB opened: test.db
I created a brand new db using SQL Lite Manager (a firefox plugin) and a table called Products. I then copied the db over to my www folder of my xcode project. I noticed that the extension was called .sqlite, I renamed it to .db. Hopefully that did not create any issues.
Now whenever I try to query that table I get a "No Such Table" - Code 5. I am not sure what that means. The table exists. I tried lower case, upper case etc.., but nothing seems to work.
XCode log window shows me the below log entry, so I assume that its able to find the DB.
open full db path:
/var/mobile/Containers/Data/Application/397075D2-943E-40DC-B076-5C0B5B7D1F42/Documents/test.db
Here is my code:
var db = $cordovaSQLite.openDB("test.db", 1);
var query = "SELECT * FROM 'main'.'Products'";
$cordovaSQLite.execute(db, query).then(function (res)
{ ... });
The second question is how do I check if I was able to open the db successfully from js?
Use the query without the 'main'. You only have 1 database anyway:
var query = "SELECT * FROM Products";
Related
I want to find and delete files in Google Drive, which contain special string in the file name.
I tried it in the following way:
created a spreadsheet named testDeleteByName, where I will run Google App script,
created a project in the Cloud Console,
activated Google Drive API for the project, created OAuth and added the spreadsheet testDeleteByName to this project in the project setting of the spreadsheet.
In the spreadsheet I added the script
function SearchFiles() {
var searchFor ='title contains "untitled"';
var files = DriveApp.searchFiles(searchFor);
while (files.hasNext()) {
files.next().setTrashed(true);
}
}
Then I created a spreadsheet named untitled testsheet to test the script.
After this I executed the script in the testDeleteByName.
As result I get
An error in execution log
Exception: Access denied: DriveApp. SearchFiles # Code.gs:5
The test file untitled testsheet is disappeared (not even in the bin)
The file testDeleteByName with the script is removed into the bin.
What I'm doing wrong? How looks the correct way?
I have an application which uses a SQLite database to store data locally. I get the path to and open the database using:
string dbPath = System.IO.Path.Combine(FileSystem.AppDataDirectory, "mydatabase")
db = new SQLiteConnection(dbPath);
I have created an example database (example.db3) and copied this to the Resources\Raw folder with the Build Action MauiAsset.
My question is how do I get the path to this database file so I can use
string dbPath = System.IO.Path.Combine("*path to Resources\Raw foldder*", "example.db3");
to get the full path to open the example database.
I have tried searching but the best I can get is using FileSystem.Current.OpenAppPackageFileAsync but this opens the file for stream reading whereas I need to get the path.
Ideally the method would work on all platforms.
It is a known issue about this problem.
You can follow it up here: https://github.com/dotnet/maui/issues/3270.
Thanks for your feedback and support.
I am working in Xamarin Forms with an iOS app.
The code downloaded successfully an sqlite file and I moved the file to the following location:
/var/mobile/Containers/Data/Application/787D3CB8-01E1-41BB-B786-972534E7F563/Documents/Data/test-file.sqlite
but now when I try to open it with the following code I get a strange error:
SQLite.SQLiteException: 'file is not a database'
The database is also not encrypted
here is my code:
var db = new SQLiteAsyncConnection(_dbPath);
var versionlist = await db.QueryAsync<version_history>("SELECT * FROM version_history ORDER BY id DESC LIMIT 1")
after I do the QueryAsync I get the error, the file is not a database.
but the db object does have the information
Please help me, any ideas?
It turned out it wasn't a real sqlite file after all. It was a zip file but named as a sqlite file and the more crazy is, the fact that it was readable by the sql lite lib, when using SQLiteAsyncConnection.
Even when it was a zip file.
But the moment you fire a query, you will get the error saying that it is not a database.
I start Xamarin Studio 4.0.3 and create a new solution for MonoDroid application. I am targetting version 2.3 or higher. I include Sqlite.cs from the sqlite-net (latest from site) project. I make sure I have a reference to Mono.Data.SQLite in the project. Then in the OnCreate of the default MainActivity I try to use the code shown in the readme to make a database connection:
string path = Android.OS.Environment.DataDirectory.ToString();
string dbname = path + "/" + "test.db3";
var db = new SQLiteConnection(dbname, SQLiteOpenFlags.Create|SQLiteOpenFlags.ReadWrite ,true);
However it always fails with an exception saying it can't open the database. If I follow Greg Shackles example and use SqliteDbHelper method it works, but I would like to understand what I am doing wrong that sqlite-net connection method is not working. I have a feeling I am missing something simple. I did also try just passing in a filename to SQLiteConnection() as well but when it failed I added the OpenFlags to see if that was the issue.
I just found out that apparently you're supposed to use the personal folder, instead of the databases folder:
string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var db = new SQLiteConnection(Path.Combine(folder, "mydb.db"));
I've upgraded my umbraco to 4.7.1.1
when I create a new content item, I write it in my db and I have a task that calls a web-service that creates
a media folder accordingly
this works well from the WS in my computer (with the production DB),
but when i run the WS from the production server I get this error on media.createNew(name, new MediaType(1031), new User(0), parentId):
node: Could not find a IDataType control matching DataEditorId cccd4ae9-f399-4ed2-8038-2e88d19e810c in the controls collection. To correct this, check the data type definition in the developer section or ensure that the package/control is installed correctly.====== at umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId) at umbraco.cms.businesslogic.property.Property.MakeNew(PropertyType pt, Content c, Guid versionId) at umbraco.cms.businesslogic.Content.createNewVersion() at umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) at umbraco.cms.businesslogic.media.Media.MakeNew(String Name, MediaType dct, User u, Int32 ParentId) at Netcraft.Utilities.Common.MediaHandler.CreateNode(String name, Int32 parentId, Int32 contentId) in C:..\Common\MediaHandler.cs:line 29 at Netcraft.Utilities.Common.MediaHandler.CreateMediaFolder(Document document) in C:..\Common\MediaHandler.cs:line 79 at Netcraft.WebService.EventManagerService.Execute() in C:..\EventManagerService.asmx.cs:line 75==============
the dlls and configs are identical, I understand he's looking for the folder control.. what is the problem?
when the code is finished, a new folder is created but when i click it i get :
Value cannot be null.
Parameter name: Property contents (27) on Content Type Folder could not be retrieved for Document 21741 on Tab Page Contents. To fix this problem, delete the property and recreate it.
Update:
I looked up the control id (cccd4ae9-f399-4ed2-8038-2e88d19e810c),
it's MediaFolder which sounds like a standard control(?)
where should i check if it's installed?
I'm capable of creating a media folder manually
and the test from my local environment (a webservice on my computer pointing to the prod DB) , created a media folder on the production env..
what does this mean?
I'm an umbraco newbie :)
thanks!
Igal
figured it out..
the webservice i was using , had an application pool that didn't have permissions on the media folder.
that fixed it!