Hola Barry4679 & Drakinite & all of you,
Many thanks for help.
I manage to get collate DDL and to load it using ".load" Sqlite function and to process it via start-process
Code: Select all
param()
$ErrorActionPreference = "Stop"
[int]$returnCode = 0
[int]$maxReturnCode = 0
Import-Module PSSQLite
try
{
$command = "C:\Program Files (x86)\sqlLite\sqlite3.exe"
$parameters = "/-init C:\PowerShell\test1.txt `"`""
Start-Process -FilePath $command -ArgumentList $parameters -RedirectStandardOutput "C:\PowerShell\output.txt" -RedirectStandardError "C:\PowerShell\error.txt" -WindowStyle Hidden
}
catch
{
Write-Error $_.Exception.ToString()
}
return $maxReturnCode
where load is in test1.txt
Code: Select all
.load /PowerShell/SQLite3MMExt.dll
.open "/Users/phili/AppData/Roaming/MediaMonkey5/MM5.DB
SELECT ID FROM Songs where SongPath = ":\$Musique-$PlayLists\Salsa\Various-I Love Salsa-122-Sal A Bailar [by Víctor Manuelle].mp3"
Still the same no way to bypass IUNICODE problem and DLL is correctly loaded !!!
I did additional test and by the end the simpler query I can make returning one row with ID column associated to the song is:
Code: Select all
param()
$ErrorActionPreference = "Stop"
[int]$returnCode = 0
[int]$maxReturnCode = 0
Import-Module PSSQLite
try
{
$dbMM5 = "C:\Users\phili\AppData\Roaming\MediaMonkey5\MM5.DB"
$playListSourceFileName = "C:\PowerShell\Bailes Primera.m3u"
$recordsArray = [IO.File]::ReadAllLines($playListSourceFileName)
for ($i=0;$i -lt $recordsArray.count;$i++) {$songPath = $recordsArray[$i].split(":")
$songPath = ":"+$songPath[1].replace(".mp3",".mp_")
$songPath = $songPath.replace("'","''")
$query = "SELECT ID, Extension FROM Songs WHERE SongPath LIKE '"+$songPath+"'"
$sqlConn = @{Datasource = $dbMM5}
[pscustomobject[]]$songsFetched = Invoke-SqliteQuery @sqlConn -Query $query
foreach($item in $songsFetched) {write-host($SongPath)
write-host($item.ID)}
}
}
catch
{
Write-Error $_.Exception.ToString()
}
return $maxReturnCode
I am pretty sure that this query works because of DB relational path not using primary and/or unique index that have the collate constrainte. I don't see other explanation. Now about IUNICODE error, well I know I can get around it. Not the best for sure but at least it allows to go forward.
Thanks