zoukankan      html  css  js  c++  java
  • Rust 配置 diesel 库 Windows 上安装配置 (postgres、sqlite、mysql)解决diesel_cli报错或安装完后无法正常运行

    Rust 配置 diesel 库 Windows 上安装配置 (postgres、sqlite、mysql)解决diesel_cli报错或安装完后无法正常运行


    在被 rust-postgresql 折磨之后,选择了 diesel 库,这才了解到对象关系映射(Object Relational Mapping, ORM) ,
    可以像使用本地变量和函数一样操作关系型数据库。这有点像非关系型数据库(如MongoDB)操作方式的意味,不过不知道孰先孰后。
    diesel 提供了一个叫 diesel_cli 的工具,用来将 MySQL、PostgreSQL 或 Sqlite 上的数据表结构转换成代码
     
    网上教程有点即使让你正常的安装完这个diesel_cli但依旧无法在windows上成功编译,原因是依赖另一些dll链接库,可能是最新版的缘故。
    报错:
    error: linking with `link.exe` failed: exit code: 1181
      |
      = note: "/* 省略一些链接参数 */"
      = note: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
    error: aborting due to previous error
     
    error: failed to compile `diesel_cli v1.4.0`, intermediate artifacts can be found at `C:UserssunnysabAppDataLocalTempcargo-installhOpejX`
     
    Caused by:
      could not compile `diesel_cli`.
    To learn more, run the command again with --verbose.
    网上不是我说解决方法治标不治本,这个解决了又来新的问题!
     
    postgresql解决办法
    postgresql安装包 https://www.postgresql.org/download/windows/
    推荐二进制包,这样后面直接可以配置docker。
    postgresql 二进制包 https://www.enterprisedb.com/download-postgresql-binaries
     
    Mysql 的解决方案
    这里选择对应的框架,并下载个zip包就可以。解压出来。https://downloads.mysql.com/archives/c-c/
     
    SQLite 解决方案 (暂时未解决)
    如果不同框架就点击此连接https://www.sqlite.org/download.html
    用了汇编DOSBox编和masm编译sqlite3.lib  调用的时候还是报错未解决。
    如果有能解决SQLite的请联系我
    我需要将lib(libpg.lib)和pgAdmin 4/bin(.dll)的依赖给映射出来
     
     
    // 如果要配置sqlite则执行下面命令
    cargo install diesel_cli --no-default-features --features “sqlite-bundled”
    // postgres配置 
    argo install diesel_cli --no-default-features --features postgres
    // mysql配置
    argo install diesel_cli --no-default-features --features mysql
     
     
     
  • 相关阅读:
    xml转json
    3DES双倍长加密
    数据的集合运算
    SQL:1999基本语法
    表的连接操作
    数据库的连接
    表空间的创建
    用户的创建
    通用函数
    转换函数
  • 原文地址:https://www.cnblogs.com/eternalnight/p/15257109.html
Copyright © 2011-2022 走看看