This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 解决方法: | |
| plugins文件夹下的platform拷贝到exe文件夹。 | |
| 数据库驱动文件夹sqldrivers也要拷贝到exe文件夹。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <QApplication> | |
| #include <QtGui> | |
| #include <QtSql> | |
| #include <QTableView> | |
| #include <QString> | |
| #include <QObject> | |
| #include <QMessageBox> | |
| #include <QFile> | |
| #include <QDataStream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USE STOCK; | |
| select count(*) from stock_TRADE_LIST; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- MySQL dump 10.13 Distrib 5.6.24, for Win64 (x86_64) | |
| -- | |
| -- Host: 127.0.0.1 Database: stock | |
| -- ------------------------------------------------------ | |
| -- Server version 5.6.26-log | |
| /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
| /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
| /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
| /*!40101 SET NAMES utf8 */; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //二进制char*转string要补最后的0 | |
| #include <QApplication> | |
| #include <QtGui> | |
| #include <QtSql> | |
| #include <QTableView> | |
| #include <QString> | |
| #include <QObject> | |
| #include <QMessageBox> | |
| #include <QFile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 一、大端模式和小端模式的起源 | |
| 关于大端小端名词的由来,有一个有趣的故事,来自于Jonathan Swift的《格利佛游记》:Lilliput和Blefuscu这两个强国在过去的36个月中一直在苦战。战争的原因:大家都知道,吃鸡蛋的时候,原始的方法是打破鸡蛋较大的一端,可以那时的皇帝的祖父由于小时侯吃鸡蛋,按这种方法把手指弄破了,因此他的父亲,就下令,命令所有的子民吃鸡蛋的时候,必须先打破鸡蛋较小的一端,违令者重罚。然后老百姓对此法令极为反感,期间发生了多次叛乱,其中一个皇帝因此送命,另一个丢了王位,产生叛乱的原因就是另一个国家Blefuscu的国王大臣煽动起来的,叛乱平息后,就逃到这个帝国避难。据估计,先后几次有11000余人情愿死也不肯去打破鸡蛋较小的端吃鸡蛋。这个其实讽刺当时英国和法国之间持续的冲突。Danny Cohen一位网络协议的开创者,第一次使用这两个术语指代字节顺序,后来就被大家广泛接受。 | |
| 二、什么是大端和小端 | |
| Big-Endian和Little-Endian的定义如下: | |
| 1) Little-Endian就是低位字节排放在内存的低地址端,高位字节排放在内存的高地址端。 | |
| 2) Big-Endian就是高位字节排放在内存的低地址端,低位字节排放在内存的高地址端。 | |
| 举一个例子,比如数字0x12 34 56 78在内存中的表示形式为: | |
| 1)大端模式: | |
| 低地址 -----------------> 高地址 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Qt中Mysql数据库连接开发 | |
| 代码: | |
| #include "mainwindow.h" | |
| #include <QApplication> | |
| #include <QtGui> | |
| #include <QtSql> | |
| #include <QTableView> | |
| #include <QString> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //msvc2013_64 x64 Debug libmysql.dll复制到msvc2013_64/bin目录下 | |
| #include <QtCore/QCoreApplication> | |
| #include <QtSql/QSql> | |
| #include <QtSql/QSqlDatabase> | |
| #include <QtSql/QSqlQuery> | |
| #include <QStringList> | |
| #include <QDebug> | |
| int main(int argc, char *argv[]) { | |
| QCoreApplication a(argc, argv); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <direct.h> | |
| #include <stdlib.h> | |
| #include <memory> | |
| std::string cr = fileInfo.path().toStdString(); | |
| char * writable = new char[cr.size() + 1]; | |
| std::copy(cr.begin(), cr.end(), writable); | |
| writable[cr.size()] = '\0'; |