1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
|
return TCL_ERROR;
}
}
/* Timeout */
if (timeout != 0) {
Tcl_Obj* query = Tcl_ObjPrintf("SET SESSION WAIT_TIMEOUT = %d\n",
timeout);
Tcl_IncrRefCount(query);
int result = mysql_query(cdata->mysqlPtr, Tcl_GetString(query));
Tcl_DecrRefCount(query);
if (result) {
TransferMysqlError(interp, cdata->mysqlPtr);
return TCL_ERROR;
}
}
|
>
|
|
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
|
return TCL_ERROR;
}
}
/* Timeout */
if (timeout != 0) {
int result;
Tcl_Obj* query = Tcl_ObjPrintf("SET SESSION WAIT_TIMEOUT = %d\n",
timeout);
Tcl_IncrRefCount(query);
result = mysql_query(cdata->mysqlPtr, Tcl_GetString(query));
Tcl_DecrRefCount(query);
if (result) {
TransferMysqlError(interp, cdata->mysqlPtr);
return TCL_ERROR;
}
}
|
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
|
Tcl_InitHashTable(&names, TCL_STRING_KEYS);
if (result != NULL) {
unsigned int fieldCount = mysql_num_fields(result);
MYSQL_FIELD* fields = mysql_fetch_fields(result);
unsigned int i;
char numbuf[16];
for (i = 0; i < fieldCount; ++i) {
Tcl_Obj* nameObj = Tcl_NewStringObj(fields[i].name,
fields[i].name_length);
Tcl_IncrRefCount(nameObj);
int new;
Tcl_HashEntry* entry =
Tcl_CreateHashEntry(&names, fields[i].name, &new);
int count = 1;
while (!new) {
count = (int) Tcl_GetHashValue(entry);
++count;
Tcl_SetHashValue(entry, (ClientData) count);
sprintf(numbuf, "#%d", count);
Tcl_AppendToObj(nameObj, numbuf, -1);
entry = Tcl_CreateHashEntry(&names, Tcl_GetString(nameObj),
|
>
>
<
<
|
|
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
|
Tcl_InitHashTable(&names, TCL_STRING_KEYS);
if (result != NULL) {
unsigned int fieldCount = mysql_num_fields(result);
MYSQL_FIELD* fields = mysql_fetch_fields(result);
unsigned int i;
char numbuf[16];
for (i = 0; i < fieldCount; ++i) {
int new;
int count = 1;
Tcl_Obj* nameObj = Tcl_NewStringObj(fields[i].name,
fields[i].name_length);
Tcl_HashEntry* entry =
Tcl_CreateHashEntry(&names, fields[i].name, &new);
Tcl_IncrRefCount(nameObj);
while (!new) {
count = (int) Tcl_GetHashValue(entry);
++count;
Tcl_SetHashValue(entry, (ClientData) count);
sprintf(numbuf, "#%d", count);
Tcl_AppendToObj(nameObj, numbuf, -1);
entry = Tcl_CreateHashEntry(&names, Tcl_GetString(nameObj),
|