- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用我在网上找到的 libmysql.dll 和 mysql-functions.i 从 Progress OpenEdge 连接到 MySQL。
它可以从 Progress OpenEdge 101b 连接到 MySql,但是当我尝试从 Progress OpenEdge 1102 连接到 MySql 时,Progress 崩溃,并出现以下 APPCRASH 问题签名和异常代码:c0000374。
我从这里得到了libmysql.dll:https://code.google.com/p/pvpgn-magic-builder/source/browse/trunk/module/include/mysql/4.1.21/libmySQL.dll?r=125
这是 mysql-functions.i 代码:
define variable mysql-row as character extent 1000.
define variable db_log_query as logical no-undo init no.
function db_close returns integer (input mysql as memptr):
run mysql_close(mysql).
set-size(mysql) = 0.
return 1.
end.
function db_connect returns integer (input-output mysql as memptr):
define variable mysql_conn as memptr.
define variable mysql-host as character no-undo format "x(12)".
define variable mysql-db as character no-undo.
define variable mysql-port as integer no-undo.
define variable mysql-user as character no-undo.
define variable mysql-pass as character no-undo.
set-size(mysql) = 952.
set-size(mysql_conn) = 952.
assign mysql-host = "localhost"
mysql-db = ""
mysql-port = 5002
mysql-user = "root"
mysql-pass = "".
run mysql_init(0,output mysql).
run mysql_real_connect(input-output mysql,mysql-host,mysql-user,
mysql-pass,mysql-db,mysql-port,"",0,output mysql_conn).
set-size(mysql_conn) = 0.
return 1.
end.
function db_last_error returns character (input mysql as memptr).
define variable err-msg as character no-undo.
define variable mysql_err as memptr no-undo.
set-size(mysql_err) = 1000.
run mysql_error(mysql,output mysql_err).
err-msg = replace(get-string(mysql_err,1),"'","\\'").
set-size(mysql_err) = 0.
return err-msg.
end.
function db_fetch_into_array returns integer (input mysql_res as memptr):
define variable num-fields as integer.
define variable i as integer.
define variable mysql_row as memptr.
define variable mysql_element as memptr.
define variable row_lengths as memptr.
define variable stat as integer.
define variable field-lengths as integer no-undo extent 200.
if get-size(mysql_res) = 0 then
return -1.
set-size(mysql_row) = 800.
run mysql_num_fields(mysql_res,output num-fields).
run mysql_fetch_row(mysql_res,output mysql_row).
if get-pointer-value(mysql_row) = 0 then do:
stat = -1.
return stat.
end.
run mysql_fetch_lengths(mysql_res,output row_lengths).
do i = 1 to num-fields:
field-lengths[i] = get-long(row_lengths,i * 4 - 3).
end.
set-size(mysql_element) = field-lengths[i].
do i = 1 to num-fields:
set-pointer-value(mysql_element) = get-long(mysql_row, i * 4 - 3).
if field-lengths[i] > 0 then
mysql-row[i] = get-string(mysql_element,1,field-lengths[i]).
else
mysql-row[i] = "".
end.
set-size(mysql_element) = 0.
set-size(mysql_row) = 0.
set-size(row_lengths) = 0.
return 1.
end.
function db_free_result returns integer (mysql_res as memptr):
run mysql_free_result(mysql_res).
set-size(mysql_res) = 0.
return 1.
end.
function db_query returns integer(mysql as memptr,sql-query as character):
define variable stat as integer.
run mysql_query(mysql,sql-query,output stat).
if sql-query begins "select" or db_log_query = no then
return stat.
define variable sql as character no-undo.
define variable log-sql as character no-undo.
define variable query-stat as integer no-undo.
define variable cur-table as character no-undo.
define variable err-msg as character no-undo.
define variable mysql_err as memptr no-undo.
define variable mysql2 as memptr no-undo.
if sql-query begins "insert" or sql-query begins "delete" or
sql-query begins "replace" then
cur-table = entry(3,sql-query," ").
else
cur-table = entry(2,sql-query," ").
assign cur-table = entry(1,cur-table,"(")
/* Now handled by mysql_real_escape_string
log-sql = replace(sql-query,"\\","")
log-sql = replace(replace(log-sql,"'","\\'"),'"','\\"').
*/
log-sql = sql-query.
if stat <> 0 then do:
set-size(mysql_err) = 1000.
run mysql_error(mysql,output mysql_err).
err-msg = replace(get-string(mysql_err,1),"'","\\'").
set-size(mysql_err) = 0.
end.
sql = "SET SQL_LOG_BIN=0".
db_connect(mysql2).
run mysql_query(mysql2,sql,output query-stat).
sql = "insert into utility.update_log" +
"(user_id,sql,error,program_name,table_name) values('" +
userid(ldbname(1)) + "','" + /* will have to fix this */
log-sql + "','" +
err-msg + "','" +
program-name(1) + "','" +
cur-table + "')".
run mysql_query(mysql2,sql,output query-stat).
db_close(mysql2).
return stat.
end.
function db_use_result returns memptr (input mysql as memptr):
define variable mysql_res as memptr.
set-size(mysql_res) = 84.
run mysql_use_result(mysql,output mysql_res).
return mysql_res.
end.
function db_escape_string return character (input mysql as memptr,
input cFrom as character):
define variable lcFrom as longchar no-undo.
define variable mFrom as memptr no-undo.
define variable mTo as memptr no-undo.
define variable iTo as integer no-undo.
define variable cOut as character no-undo.
if get-size(mysql) = 0 then
leave.
assign lcFrom = cFrom.
copy-lob from object lcFrom to mFrom no-error.
set-size(mTo) = (get-size(mFrom) * 2) + 1 no-error.
run mysql_real_escape_string(input mysql,
output mTo,
input mFrom,
input get-size(mFrom),
output iTo) no-error.
set-size(mTo) = iTo no-error.
assign cOut = string(mTo).
set-size(mFrom) = 0 no-error.
set-size(mTo) = 0 no-error.
assign lcFrom = "".
return string(cOut).
end.
/********************** end public functions *******************/
procedure mysql-fetch-into-array:
define variable num-fields as integer.
define variable i as integer.
define variable mysql_row as memptr.
define variable mysql_element as memptr.
define variable row_lengths as memptr.
define variable field-lengths as integer no-undo extent 200.
define input parameter mysql_res as memptr.
define output parameter stat as integer.
IF get-size(mysql_res) = 0 then do:
assign stat = -1.
return.
end.
set-size(mysql_row) = 800.
set-size(row_lengths) = 1000.
run mysql_num_fields(mysql_res,output num-fields).
run mysql_fetch_row(mysql_res,output mysql_row).
if get-pointer-value(mysql_row) = 0 then do:
stat = -1.
leave.
end.
run mysql_fetch_lengths(mysql_res,output row_lengths).
do i = 1 to num-fields:
field-lengths[i] = get-long(row_lengths,i * 4 - 3).
end.
do i = 1 to num-fields:
/* Updates pointer size to include all the field */
set-size(mysql_element) = field-lengths[i].
set-pointer-value(mysql_element) = get-long(mysql_row, i * 4 - 3).
mysql-row[i] = get-string(mysql_element,1,field-lengths[i]).
end.
set-size(mysql_element) = 0.
set-size(mysql_row) = 0.
set-size(row_lengths) = 0.
end.
procedure mysql-fetch-fields-into-array:
/* note: this function needs to be fixed, see
mysql-fetch-into-array to fix */
define variable num-fields as integer.
define variable i as integer.
define variable mysql_field as memptr.
define variable mysql_element as memptr.
define variable used-length as integer.
define variable tmp-long as integer.
define input parameter mysql_res as memptr.
define output parameter stat as integer.
if get-size(mysql_res) = 0 then do:
assign stat = -1.
return.
end.
set-size(mysql_field) = 100.
run mysql_num_fields(mysql_res,output num-fields).
set-size(mysql_element) = 2000.
used-length = 0.
do i = 1 to num-fields:
run mysql_fetch_field(mysql_res,output mysql_field).
tmp-long = get-long(mysql_field,1).
set-pointer-value(mysql_element) = tmp-long.
mysql-row[i] = get-string(mysql_element,1).
end.
set-size(mysql_element) = 0.
set-size(mysql_field) = 0.
end.
procedure mysql_fetch_field external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
define return parameter mysql_field as memptr.
end procedure.
procedure mysql_init external "libmysql.dll" persistent:
define input parameter nothing as long.
define return parameter mysql as memptr.
end.
procedure mysql_real_connect external "libmysql.dll" persistent:
define input-output parameter mysql as memptr.
define input parameter host as character.
define input parameter mysql-user as character.
define input parameter passwd as character.
define input parameter db as character.
define input parameter port as unsigned-short.
define input parameter socket as character.
define input parameter client_flag as short.
define return parameter stuff as memptr.
end.
procedure mysql_error external "libmysql.dll" persistent:
define input parameter mysql as memptr.
define return parameter my-err as memptr.
end.
procedure mysql_close external "libmysql.dll" persistent:
define input parameter mysql as memptr.
end procedure.
procedure mysql_query external "libmysql.dll" persistent:
define input parameter mysql as memptr.
define input parameter sql-query as character.
define return parameter stat as short.
end procedure.
procedure mysql_use_result external "libmysql.dll" persistent:
define input parameter mysql as memptr.
define return parameter mysql_res as memptr.
end.
procedure mysql_fetch_row external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
define return parameter mysql_row as memptr.
end .
procedure mysql_num_fields external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
define return parameter num-rows as short.
end.
procedure mysql_fetch_lengths external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
define return parameter row_lengths as memptr.
end.
procedure mysql_free_result external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
end.
procedure mysql_real_escape_string external "libmysql.dll" persistent:
define input parameter mysql as memptr.
define output parameter cTo as memptr.
define input parameter cFrom as memptr.
define input parameter iLength as long.
define return parameter ierror as long.
end.
最佳答案
该 APPCRASH 错误似乎与不正确地释放 memptr 有关:
http://knowledgebase.progress.com/articles/Article/000036217
http://knowledgebase.progress.com/articles/Article/000047105
您所展示的代码中还有很多固定大小的 memprs 和其他硬编码的大小。即:
set-size(mysql_row) = 800.
... extent 200.
是否有可能其中一些对于返回的数据来说太小?
关于mysql - 使用 libmysql.dll 连接 MySQL 的 Progress 4GL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29863091/
我正在使用 Visual Studio 2010。 我正在尝试在 OpenGL 中编写简单的 Camera 类。 我需要在 Camera.h 中包含 gl/gl.h gl/gl.h 已经包含在 mai
这个问题适用于了解 MapBox GL JS 内部结构的人。 我正在使用 MapBox GL JS 渲染多达 40,000 个多边形的地理 map ,每个多边形的颜色都基于该多边形的“所有者”。每个所
我想知道3D建筑物的“填充颜色”是否可以根据某些事件动态更改,例如将鼠标悬停在建筑物上时的mouseMoveEvent,突出显示3D建筑物。 最佳答案 试试这个 map.on('load', func
我正在使用 mapbox-gl 并从 osm2vectortiles.org 下载矢量切片 我想让 map 仅在已知多边形内可见,但找不到任何方法来实现这一点。 我可以想象几种解决这个问题的方法,但每
在探索javascript的过程中,我遇到了一个很莫名其妙的问题。序言是:我将不同 mime 类型的图像(主要是 pngs/jpgs)转换为具有 ImageBitmap 接口(interface)的位
我一直在使用行程图层可视化行程数据,并且尝试在每条行程线的开头放置一个图标。是否可以让多个图标随时间改变位置、出现和消失? Example of what I'm trying to do (red
我有一个 map 应用程序,它使用 Mapbox.com 来提供英国邮政编码边界的矢量切片。边界文件很大,不适合使用 TopoJSON 之类的工具进行下载。这很好用。 我还使用数据驱动的样式来格式化
将鼠标悬停在一个 3D 建筑上时,如何突出显示它?像 OSM 建筑物突出显示功能。 mapbox street v7 建筑图层特征属性好像很少,只包括: 拉伸(stretch) 高度 最小高度 类型
有没有办法隐藏/删除或禁用控件,例如 mapbox-gl-draw 中的控件? 我添加绘制控件如下 draw = mapboxgl.Draw({ drawing: true,
这可能非常简单,但我找不到如何在 deck.gl 的标签下方添加新层。它在底层使用 Mapbox GL JS。对于 mapbox gl,解释为 here . 我还在他们的文档中搜索了 z-index
我正在寻找一种方法,允许我像 Mapbox JS 一样为我的 map 创建一个简单的自定义标记。 深入浏览了网络,似乎没有明显或非常直接的方法来实现这一目标。我猜这是一个被错过的功能。 尝试过使用Ma
接下来的教程向我展示了以下代码: ... void update() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES);
我正在寻找一种方法,允许我像 Mapbox JS 一样为我的 map 创建一个简单的自定义标记。 深入浏览了网络,似乎没有明显或非常直接的方法来实现这一目标。我猜这是一个被错过的功能。 尝试过使用Ma
我想在交互式 map 上显示一个圆圈的轮廓(无填充)但是,mapbox-gl-js 中的绘制选项似乎仅限于填充。 https://www.mapbox.com/mapbox-gl-style-spec
我在 kepler.gl 中工作并从数据库加载数据。如果数据库更新,我希望能够动态更新数据集。有没有办法向数据集添加一行并更新 map ? 我已经尝试删除数据集(使用 removeDataset)并将
如何在 mapbox-gl 中为图层文本字段添加背景颜色 .. 或者如何完成以便文本字段上有背景框 map.addLayer({ "id": "markers", "type": "s
我正在尝试使用 mapbox-gl 创建等值线图。在示例等值线 map 中,看起来他们根据要素的属性设置了要素的油漆填充颜色。有没有办法通过访问 map 来设置颜色? 即。我在称为 id 的功能属性中
我想根据最近的草皮更改 map 点击时的图标大小。我如何做到这一点? nearestBuilding.properties['icon-size'] = 0.2; 不起作用。 var retail =
我正在尝试在 MapBox GL JS 中聚类自定义标记,但我不知道如何将自定义标记图像从 url 获取到符号层?它要么不起作用,要么根本没有标记出现。它是如何完成的?我需要知道如何使用带有符号层的
寻找一种使用 Mapbox GL JS 获取 map 中心当前坐标的方法,就像在 Mapbox Studio 上一样(见下文) Mapbox Studio Screenshot 谢谢 最佳答案 Map
我是一名优秀的程序员,十分优秀!