Exemple #1
0
func (u *Unqlite) Compile(jx9Code string) (*Jx9, error) {
	code := C.CString(jx9Code)
	defer C.free(unsafe.Pointer(code))
	var jx9 Jx9
	e := C.unqlite_compile(u.db, code, C.int(len(jx9Code)), &jx9.j)
	return &jx9, code2Error(e)
}
Exemple #2
0
func (db *Database) Unqlite_compile(jx9_script string, vm *VM) (error, string) {
	res := C.unqlite_compile(db.handle, C.CString(jx9_script), C.int(len(jx9_script)), &vm.vm)
	if res != C.UNQLITE_OK {
		if res == C.UNQLITE_COMPILE_ERR {
			err := UnQLiteError(res)
			error_log := new(C.char)
			err_msg := C.extract_unqlite_log_error(db.handle, error_log)
			g_err_msg := C.GoString(err_msg)
			//C.free(unsafe.Pointer(err_msg))
			return err, g_err_msg
		}
	}
	return nil, ""
}