mariadb: execute "IN" closure query in update

50 Views Asked by At

how to update this query in MariaDB?

query:


    UpdatewarehouseBinOfItems() {
        return `UPDATE producedItem
                SET warehouseBinId = ?
                WHERE id IN (?)`;
    }

function handling the query:

UpdatewarehouseBinOfItems(id, binId, response, promises) {
        return new Promise(async function(resolve) {
            promises.push(
                db.batch(
                    new WarehouseSQL().UpdatewarehouseBinOfItems(),
                    [binId, id],// this is the way i have used that in mysql but in mariaDB this doesn't 
                                //work :(
                    (error, data) => {
                        if (!error) {
                            console.log(`data from & id lenght ${id.length} && ${JSON.stringify(data)}\n`)
                            resolve(data);
                        } else {
                            console.log(error);
                            return response
                                .status(404)
                                .json(msgs.get("warehouse_bin_Update_failed"));
                        }
                    }
                )
            );
        });
    }


data im passing :

binId = 1,
id =[8273,57037,57038,57039,57040,57047,57048,57049,57050,57051,57052,57053,57054,57137,57138,57139,57140]


The above query works well in MySQL but since I'm trying to move into MariaDB and working on the changes I'm not able to handle query like above :( any solution please other than looping the function

0

There are 0 best solutions below