I got a Node script with an Express server, im trying to insert a new entry into a Table.
If got folloing setup:
db.run('CREATE TABLE lists(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL)');
...
db.get(`INSERT INTO lists (name) VALUES (?) RETURNING *;`, [name], (err, row) => {
...
});
And the Insert statement throws:
Error: SQLITE_ERROR: near "RETURNING": syntax error
--> in Database#get('INSERT INTO lists (name) VALUES (?) RETURNING *;', [ 'Testing' ], [Function (anonymous)])
but this should be working according to the sqlite wiki
any advise?
Support for the RETURNING clause was added in Sqlite 3.35.
https://sqlite.org/releaselog/3_35_0.html
"Add support for the RETURNING clause on DELETE, INSERT, and UPDATE statements."
While you have Sqlite 3.36 installed in your operating system's environment, it seems your Node environment has an older version of the sqlite3 npm package which has Sqlite 3.34.
On GitHub, as of early November 2021, the sqlite3 package version 5.0.2 for npm was released in February 2021 with an older version of Sqlite.
There is no public release of the node-sqlite3 package with Sqlite 3.36 yet.
node-sqlite3 does have a commit that updated Sqlite to 3.36 but no release has been made yet.
Related
I've been unable to query my existing contract recently due to Unable to create Enum via index 128, in Alive, Tombstone when using api.query.contracts.contractInfoOf. I get this error both on the command line and in the polkadot-js apps explorer.
These are the steps I took:
Deploy a contract with a salt
Retrieve the contract deployedAddress
Use contractInfoOf
const contractInfo = await api.query.contracts.contractInfoOf(deployedAddress);
I've tried downgrading ink! to 3.0-rc5, 3.0-rc4, 3.0-rc3 and then compiling but it doesn't seem to make any difference. Whenever my contract is built it references rc6 at the top:
{"metadataVersion":"0.1.0","source":{"hash":"0x...","language":"ink! 3.0.0-rc6","compiler":"rustc 1.58.0-nightly",
Which suggests its ignoring my .toml and using rc6 to compile the contract.
I changed my cargo-contract version to 0.14 but that causes polkadot-js to fail at reading the contract abi.
I've tried using the substrate-contracts-node using the latest commit from master and also using the v0.1.0 release. Same error in both cases.
> rustup info
stable-x86_64-unknown-linux-gnu (default)
rustc 1.56.1 (59eed8a2a 2021-11-01)
There are more details in an issue on polkadot-js.
Any pointers on how to get a working setup would be very helpful!
The problem here was substrate-contracts-node using an old version of the metadata.
I was able to check out the repo before the metadata merge was reverted and build locally (cargo build).
So checkout 8d91b8e to get the node to work with versions 7.7.1 and 6.6.1 of polkadot-js packages.
> git checkout 8d91b8e578065a7c06433cbd41ac059bf478a0bd
> cargo build
> ./target/debug/substrate-contracts-node --dev --tmp --version
substrate-contracts-node 0.1.0-8d91b8e-x86_64-linux-gnu
How fix this error, I use python3.6 and I use Oracle database 11g, I want to connect my python to oracle database, but shows error, how can I fix it?
This is my code:
#importing module
import cx_Oracle
#create a table in oracle database
try:
con = cx_Oracle.connect('db_employees/root#localhost')
#Now execute the sqlquery
cursor = con.cursor()
cursor.execute("insert into employees values(2171114103970002, raden, ceo, 01031997, batam, 001)")
#commit that insert the provided database
con.commit()
except cx_Oracle.DatabaseError as e:
print("There is a problem with Oracle", e)
#by writing finally if any error occurs
#then also we can close the all database operation
finally:
if cursor:
cursor.close()
if con:
con.close()
This is messages error:
C:\Python36>python "D:\testing.py"
There is a problem with Oracle DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Traceback (most recent call last):
File "D:\testing.py", line 20, in <module>
if cursor:
NameError: name 'cursor' is not defined
Here are the installation instructions: Installing cx_Oracle on Windows.
The error is saying you need a 32-bit Oracle client library. You can get one from 32-bit Windows Instant Client (The 64-bit libraries are here if anyone needs them) Any version up to 19c will connect to Oracle DB 11.2. Instructions are at the foot of the page. Make sure you have the correct VS redistributable installed.
Check your path to see if the client is on it, in some cases the path is not set to point the client or contain invalid characters on it and the python library can't access to it.
You can check here a similar issue https://github.com/oracle/python-cx_Oracle/issues/55
I was facing the same issue and here are the steps how I fixed this -
Download latest 64-bit version of oracle basic instantClient from:
https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
In my case I have downloaded - windows.x64-19.10.0.0.0dbru.zip
Unzip the Oracle instantClient and copy all .dll files
Copy these .dll files from Oracle instantclient directory to the python directory
I am trying to build sqlite under windows with soundex funtion, while build succeeds, i still don't get soundex functionality. i couldn't figure out where is the error.
cl -DSQLITE_THREADSAFE=0 -DSQLITE_SOUNDEX sqlite3.c -link -dll -out:sqlite3.dll
outputs:
/out:sqlite3.exe
-dll
-out:sqlite3.dll
sqlite3.obj
When i try newly build dll
C:\sqlite\sqlite-amalgamation-3250200>sqlite3.exe
SQLite version 3.25.2 2018-09-25 19:08:10
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> SELECT SOUNDEX("John"), SOUNDEX("Joahn");
Error: no such function: SOUNDEX
sqlite>
For ubuntu its very clear how to compile with parameters but for windows i couldn't find what is the way to pass DSQLITE_SOUNDEX correctly.
Thanks a lot.
I'm trying to install Magento 1.11.1 EE from command line.
The installation crashes at some point throwing the following error:
ERROR: Error in file: "/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php"
A page URL key for specified store already exists.
Looking at the source code I found that there are 3 scripts that are doing the same thing:
/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php (initial script)
/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php ( ??? basically doing the same thing as the one above but with DROP TABLE IF EXISTS)
/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php
The fix for this would be to remove (by patch of course) one of the scripts (preferably the last one) but I'm trying to understand if this is something that should be there or just a stupid mistake.
You can refere at the link below if you don't have the code opened:
http://www.magentodocs.org/1.7.0.2/d5/dde/_reports_2data_2reports__setup_2data-install-1_86_80_80_8php_source.php
I am doing some practice with clsql. I want to connect my oracle server hence my connection function is;
(connect '("192.168.2.3" "xe" "username" "password") :database-type :oracle)
when i hit the return, the following error message shows up.
Couldn't load foreign libraries "libclntsh", "oci". (searched *FOREIGN-LIBRARY-SEARCH-PATHS*)
[Condition of type SIMPLE-ERROR]
I have already installed oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
and define export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
So, what else should I do to connect the server?
I was playing with oracle lately and found out that all you need is to put path to libclntsh into /etc/ld.conf.d/oracle.conf
My setup was following( redhat,centos - as root): downloaded from oracle
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
install via rpm -ivh oracle*.rpm
Create file /etc/ld.so.conf.d/oracle.conf:
/usr/lib/oracle/12.1/client64/lib
then execute ldconfig
Now as clsql-oracle is not in quicklisp, I downloaded and extracted clsql-6.6.2, then
(require "asdf")
(push #P"/opt/jeff/clsql-6.6.2/" asdf:*central-registry*)
(asdf:load-system :clsql-oracle)
(defparameter *some-db* (connect '("127.0.0.1:1521/db1" "SOME_USER_RO" "*******") :database-type :oracle))
and voila, it works
One thing that trips me up with dynamic linking to the Oracle libs (in C/C++ that is), is the fact that the libclntsh.so shared object comes with the version after the so name. So you may need to create a soft link in the same directory, ensuring that the soft link name is just libclntsh.so