udpate failed with escapeFn problem
See original GitHub issueWhen run test
import { Database, DataTypes, Model } from 'https://deno.land/x/denodb/mod.ts';
import { hash } from "https://deno.land/x/bcrypt/mod.ts";
import { assertEquals } from "../testdeps.ts";
import { mysqlOptions} from "../config/db.ts";
class User extends Model {
static table = 'user';
static timestamps = true;
static fields = {
id: {
primaryKey: true,
autoIncrement: true,
},
name: DataTypes.STRING,
password: DataTypes.STRING,
email: DataTypes.STRING,
};
}
const db = new Database('mysql', mysqlOptions);
db.link([User ]);
await db.sync({ drop: false });
Deno.test("model: create", async () => {
const password = await hash('20090909');
const data = await User.create({
name: 'test',
password,
email: 'test@qq.com'
})
assertEquals(data.affectedRows, 1)
});
Deno.test("model: update", async () => {
const record = await User.where('id', 1).update({name: 'deno'})
assertEquals(record.name, 'deno')
});
db.close()
Record was created, but when update, got error like this
model: update
ReferenceError: Buffer is not defined
at escapeFn (https://deno.land/x/dex/lib/query/string.js:44:16)
at Client_MySQL.finalEscape [as _escapeBinding] (https://deno.land/x/dex/lib/query/string.js:18:12)
at https://deno.land/x/dex/lib/client.js:151:19
at String.replace (<anonymous>)
at Client_MySQL._formatQuery (https://deno.land/x/dex/lib/client.js:143:16)
at https://deno.land/x/dex/lib/interface.js:13:28
at Array.map (<anonymous>)
at Builder.Target.toQuery (https://deno.land/x/dex/lib/interface.js:12:8)
at Builder.toString (https://deno.land/x/dex/lib/query/builder.js:68:17)
at SQLTranslator.translateToQuery (https://deno.land/x/denodb/lib/translators/sql-translator.ts:209:25)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Escape From Tarkov Game update installation error ... - Reddit
Escape From Tarkov Game update installation error (read everything in the error message) Open task manager and close everything that is BSG, ...
Read more >Escape from Tarkov Error checking the launcher update fix
When Escape from Tarkov says there's an error checking the launcher update, it's typically due to server outages. The launcher will usually say ......
Read more >Game update installation error fixed - Escape from Tarkov ...
Follow me on twitter: https://twitter.com/ditechgamingUse my code in the item shop: Ditech-Gaming.
Read more >Escape literal used in the update query does not ... - GitHub
Caused by: java.lang.IllegalArgumentException: MismatchedTokenException(-1!=39) at org.jdbi.v3.core.internal.lexer.DefineStatementLexer.
Read more >Are you getting a Content Update Pop Up Error? — FarmVille 2
If you're experiencing an issue with the "Content Update", please force-close your app or follow the troubleshootings steps found on the links.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Grand, I am glad you like it Chaim 😃
Well, as it seems the issue has been solved, I will close the issue for now.
@linuxing3 do not hesitate to reopen it if your issue is still not fixed.
Other than that, have a great day guys
that worked! Thanks! Love this library btw