react-native-sqlite-storage icon indicating copy to clipboard operation
react-native-sqlite-storage copied to clipboard

plugin.warn is not a function

Open sammysium opened this issue 4 years ago • 7 comments

I am doing a simple insert query that contains different data types (if it matters) and i get the error "plugin.warn is not a function": where data is a dictionary object passed to the method.

is_active, status,user_id are integers all the rest are strings.


var dt = new Date();


db.transaction(function(tx) {
          
            tx.executeSql('INSERT INTO client (auto_id,user_id,username,first_name,last_name,email,is_active,date_joined,status,birthdate,marital_status,gender,phone,identification,nationality,lang,syncedon) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
            [
             auto_id,0,data.username,data.firstName,data.lastName,data.email,0,dt,1,data.birthdate,data.maritalStatus,data.gender,data.phone,data.idnumber,data.nation,data.lang,null

            ]
            
            
            );
          }, function(error) {
            console.log('Transaction ERROR: ' + error.message);
            reject(false)
          }, function() {
            console.log('Populated database OK');
            resolve(true)
          });

There are few examples on data manipulation. Am I even doing the insert right?

sammysium avatar Dec 22 '19 08:12 sammysium

H

I am doing a simple insert query that contains different data types (if it matters) and i get the error "plugin.warn is not a function": where data is a dictionary object passed to the method.

is_active, status,user_id are integers all the rest are strings.


var dt = new Date();


db.transaction(function(tx) {
          
            tx.executeSql('INSERT INTO client (auto_id,user_id,username,first_name,last_name,email,is_active,date_joined,status,birthdate,marital_status,gender,phone,identification,nationality,lang,syncedon) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
            [
             auto_id,0,data.username,data.firstName,data.lastName,data.email,0,dt,1,data.birthdate,data.maritalStatus,data.gender,data.phone,data.idnumber,data.nation,data.lang,null

            ]
            
            
            );
          }, function(error) {
            console.log('Transaction ERROR: ' + error.message);
            reject(false)
          }, function() {
            console.log('Populated database OK');
            resolve(true)
          });

There are few examples on data manipulation. Am I even doing the insert right?

Hi @sammysium remove new Data(). it will work

ramakrishnavarma avatar Jan 29 '20 04:01 ramakrishnavarma

I'm hitting this as well! Triggering an error on this line: https://github.com/andpor/react-native-sqlite-storage/blob/4.1.0/lib/sqlite.core.js#L507 by doing something like:

const listOfThings = ['foo', 'bar']

typeormConn
  .getRepository(SomeRepo)
  .createQueryBuilder('somerepo')
  .leftJoinAndSelect(
    'somerepo.otherrepo',
    'otherrepo',
  )
  // otherrepo.things is of type "simple-json"
  .where('otherrepo.things = :listOfThings', { listOfThings })
  .getMany()

full code: https://github.com/jolocom/smartwallet-app/blob/24b61f12a23de08559ac296dd7985f5e4ab75d6b/src/lib/storage/storage.ts#L173

mnzaki avatar Mar 02 '20 12:03 mnzaki

I'm also getting this same error. Doing a simple insert similar to @sammysium. The function call used to work until I updated my project from using react-native-sqlite-storage 3.3.11 to 5.0.0.

blainefricks avatar May 07 '20 16:05 blainefricks

same problem.. my project update from react-native-sqlite-storage 3.3.3 to 5.0.0, RN0.62.2

Screen Shot 2020-08-27 at 10 30 38

nppull avatar Aug 27 '20 03:08 nppull

thanks @mnzaki remove this line fixed for me 👍 💯 👯

plugin.warn('addStatement - parameter of type <'+t+'> converted to string using toString()')

nppull avatar Aug 27 '20 09:08 nppull

Same issue happen at insert query

vikil143 avatar Dec 08 '20 09:12 vikil143

I was getting this error with Date objects, I fixed it with date.toString();

ReddyyZ avatar Jul 17 '21 17:07 ReddyyZ