javascript - Expected type utf8 for Argument 'sql' but got type 'object' -


i'm trying gnome javsscript tutorial, seems not work in original version.

  var gdastrconn = gda.connection.open_from_string("sqlite", "db_dir=" + glib.get_home_dir () + ";db_name=gnome_demo", null, 0);   print('connected');   gdastrconn.execute_non_select_command (this.connection, 'create table demo (id integer, name varchar(100))'); 

the documentation function execute_non_select_command, says:

gint                gda_connection_execute_non_select_command                                                         (gdaconnection *cnc,                                                          const gchar *sql,                                                          gerror **error); convenience function execute sql command on opened connection. returned value, see gda_connection_statement_execute_non_select()'s documentation.  cnc : opened connection sql : query statement must not begin "select" error : place store errors, or null returns : number of rows affected or -1, or -2 

now following error.:

(gjs:25295): gjs-warning **: js error: error: expected type utf8 argument 'sql' got type 'object' 

why error, cause sql param string: 'create table demo (id integer, name varchar(100))'?

what wrong call?

on line 3 omit first argument in function, line this:

gdastrconn.execute_non_select_command ('create table demo (id integer, name varchar(100))'); 

i don't know why works, learning gjs myself.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -