Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql.nim fetch_field get wrong field type #7

Open
autukill opened this issue Jul 18, 2021 · 2 comments
Open

mysql.nim fetch_field get wrong field type #7

autukill opened this issue Jul 18, 2021 · 2 comments

Comments

@autukill
Copy link

autukill commented Jul 18, 2021

Example

import db_mysql
import mysql

let db: DbConn = open("--ip--", "--user--", "--pwd--", "exhibition_db" )

discard mysql.query(PMySQL db, "select * from `products`");
var res:PRES = mysql.store_result(PMySQL db)
var numFields = int(mysql.num_fields(res))
echo "num fields=" , numFields
echo "count row=" , int(res.row_count)

for i in 0..<numFields:
  var field: PFIELD = mysql.fetch_field(res)
  echo "column=" , field.name , "  type=" , int(field.ftype)

# This code should output correct field type

Current Output

num fields=13
count row=6
column=ID  type=0
column=CreateTime  type=0
column=CreateBy  type=0
column=UpdateTime  type=0
column=UpdateBy  type=0
column=ProductName  type=0
column=ExhibitionAreaId  type=0
column=ExhibitionBoothId  type=0
column=CompanyName  type=0
column=PhotoId  type=0
column=ProductDesc  type=0
column=ProductAttachmentUrl  type=0
column=ProductAttachmentCode  type=0

Expected Output

num fields=13
count row=6
column=ID  type=3
column=CreateTime  type=12
column=CreateBy  type=253
column=UpdateTime  type=12
column=UpdateBy  type=253
column=ProductName  type=252
column=ExhibitionAreaId  type=3
column=ExhibitionBoothId  type=3
column=CompanyName  type=252
column=PhotoId  type=254
column=ProductDesc  type=252
column=ProductAttachmentUrl  type=252
column=ProductAttachmentCode  type=252

Additional Information

I tested macos, no problem.

nim --version
Nim Compiler Version 1.4.8 [Windows: amd64]
Compiled at 2021-05-25
Copyright (c) 2006-2021 by Andreas Rumpf

active boot switches: -d:release

win

c
macos

@autukill autukill changed the title mysql.nim Function fetch_field get wrong field type mysql.nim fetch_field get wrong field type Jul 18, 2021
@ringabout
Copy link
Member

What's your DLL version and architecture(32 bit or 64 bit) on both platforms?

@autukill
Copy link
Author

What's your DLL version and architecture(32 bit or 64 bit) on both platforms?

Windows C use 32 bit DLL "mysql-connector-c-6.1.11-win32" download from "https://downloads.mysql.com/archives/c-c/"

dumpbin /headers F:\Users\zuiza\Desktop\mysql-connector-c-6.1.11-win32\lib\libmysql.dll
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file F:\Users\zuiza\Desktop\mysql-connector-c-6.1.11-win32\lib\libmysql.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
             14C machine (x86)
               8 number of sections
        596CE31C time date stamp Tue Jul 18 00:17:32 2017
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
            2102 characteristics
                   Executable
                   32 bit word machine
                   DLL

Windows nim use 64 bit DLL "mysql-connector-c-6.1.11-winx64" download from "https://downloads.mysql.com/archives/c-c/"

dumpbin.exe /headers  F:\Repostitories\kanban-sale\libmysql.dll
Microsoft (R) COFF/PE Dumper Version 14.29.30038.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file F:\Repostitories\kanban-sale\libmysql.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
            8664 machine (x64)
               9 number of sections
        596CE0C2 time date stamp Tue Jul 18 00:07:30 2017
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
            2022 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
                   DLL

macOS nim use "mysql-connector-c-6.1.11-macos10.12-x86_64" download from "https://downloads.mysql.com/archives/c-c/"

@ringabout ringabout transferred this issue from nim-lang/Nim Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants