Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin.warn is not a function #402

Open
sammysium opened this issue Dec 22, 2019 · 7 comments
Open

plugin.warn is not a function #402

sammysium opened this issue Dec 22, 2019 · 7 comments

Comments

@sammysium
Copy link

sammysium commented Dec 22, 2019

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?

@ramakrishnavarma
Copy link

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

@mnzaki
Copy link

mnzaki commented Mar 2, 2020

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

@blainefricks
Copy link

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.

@nppull
Copy link

nppull commented Aug 27, 2020

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
Copy link

nppull commented Aug 27, 2020

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

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

@vikil143
Copy link

vikil143 commented Dec 8, 2020

Same issue happen at insert query

@ReddyyZ
Copy link

ReddyyZ commented Jul 17, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants