SQLite3的使用(封装很长,直接使用sqlite3_open函数,LIBS += sqlite3.dll 即可)good
1.下载sqlite3相关文件sqlite3.dll、sqlite3.h(可从http://download.csdn.net/detail/mingxia_sui/5249070下载),添加到工程的根目录下。
2. QT += sql
LIBS += sqlite3.dll
Qt的.pro文件中要加上以上两句。
这样就可以调用sqlite3中的数据库操作函数了。
3.以下的例子是一个已经封装好的类,可以直接调用哦!
***************************************************************************************
***************************************************************************************
.h文件代码:
#ifndef SKMONITORSQL_H
#define SKMONITORSQL_H #include <QObject>
#include <QDateTime>
#include "sqlite3.h"
#include <QStringList> class QSKMonitorSQL : public QObject
{
Q_OBJECT
public:
explicit QSKMonitorSQL(QString sFileName, QObject *parent = 0);
bool fn_connectSQL();
bool fn_closeSQL();
void fn_InitTable(QString sTableName, QStringList sNameList, QStringList sType);
void fn_InitTableForBase(QString sTableName, QStringList sNameList, QStringList sType); void fn_InsertData(QString sTableName, QStringList sDataList, QDateTime dt);
void fn_InsertDataForBase(QString sTableName, QStringList sDataList); int fn_UpdateData(QString sTableName, QStringList sDataList,int index);
void fn_DeleteData(QString sTableName); int fn_QueryDataByIndex(QString sTableName, int iStart,int iNumber,QVector<QStringList> *pData);
int fn_QueryDataByTime(QString sTableName, QDateTime dtStart,QDateTime dtEnd,QVector<QStringList> *pData);
int fn_QueryDataByValue(QString sTableName, int nType, QString sFrontV, QString sBackV, QVector<QStringList> *pData);
int fn_QueryAllData(QString sTableName, QVector<QStringList> *pData); int fn_RecordSize(QString sTableName);
uint fn_GetMinRowID(QString sTableName);
bool fn_RecordSizeByTime(QString sTableName, QDateTime dtStart, QDateTime dtEnd, int *pRows, int *pMaxID,int *pMinID); QString fn_UnicodeToUTF8(QString str); void fn_StartBegin();
void fn_StartCommit(); bool m_bDBIsOk; int m_nSetMaxRecordNum;
bool m_bSetRecordFlag;
void fn_SetMaxRowId(int nMaxRows); public:
bool m_bStartBegin;
bool m_bStartCommit; signals: public slots: private:
QString m_sDB;
QString m_sInsertT1;
QString m_sUpdateT1;
QString m_sTable;
QStringList m_sTitleList; //列名
int m_nColumn;
sqlite3 *m_pdb; //数据库
char *m_pzErrMsg; //出错信息
char *m_perrmsg; //出错信息
char **m_ppazResult; }; #endif // SKMONITORSQL_H
***************************************************************************************
***************************************************************************************
.cpp文件:
#include "SKMonitorSQL.h"
#include <QTextCodec>
#include <QVector> QSKMonitorSQL::QSKMonitorSQL(QString sFileName, QObject *parent) :
QObject(parent)
{
m_pdb = NULL; m_nSetMaxRecordNum = 0;
m_bSetRecordFlag = false; //编码转换
m_sDB = fn_UnicodeToUTF8(sFileName);//编码转换 m_bStartBegin = false; //初始化没有插入BEGIN命令
m_bStartCommit = false; //初始化没有插入COMMIT命令
} /*********************************************************************************************
Func: 连接到指定数据库
input: null
ouput:null
********************************************************************************************/
bool QSKMonitorSQL::fn_connectSQL()
{
if( (sqlite3_open(m_sDB.toAscii().data(), &m_pdb)) != 0 ) //打开指定的数据库文件,如果不存在将创建一个同名的数据库文件
{
m_bDBIsOk = false;
return false;
}
m_bDBIsOk = true;
return true;
} /*********************************************************************************************
Func: 关闭指定数据库
input: null
ouput:null
********************************************************************************************/
bool QSKMonitorSQL::fn_closeSQL()
{
if (m_pdb!=NULL)
{
sqlite3_close(m_pdb);
}
return false;
} /*********************************************************************************************
Func: 运行BEGIN命令
input: null
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_StartBegin()
{
if (m_bStartBegin == false)
{
if (m_pdb != NULL)
{
QString stmp;
stmp = "begin;";
stmp = fn_UnicodeToUTF8(stmp); //编码转换
sqlite3_exec( m_pdb , stmp.toAscii().data() , 0 , 0 , &m_pzErrMsg );
m_bStartBegin = true;
m_bStartCommit = false;
}
}
}
/*********************************************************************************************
Func: 运行commit命令
input: null
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_StartCommit()
{
if (m_bStartCommit == true) //提交,存入磁盘
{
if (m_pdb != NULL)
{
QString stmp;
stmp = "commit;";
stmp = fn_UnicodeToUTF8(stmp); //编码转换
sqlite3_exec( m_pdb , stmp.toAscii().data() , 0 , 0 , &m_pzErrMsg );
m_bStartBegin = false;
m_bStartCommit = false;
}
}
} /*********************************************************************************************
Func: 初始化数据表
input: 表名,表列名
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_InitTable(QString sTableName, QStringList sNameList, QStringList sType)
{
fn_StartBegin();
if (m_pdb!=NULL)
{
QString stmp;
stmp = "create table " + sTableName + "(logtime datetime"; for (int i=0;i<sNameList.size();i++)
{
stmp = stmp + "," + sNameList.at(i) + " " + sType.at(i);
} stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg); m_sInsertT1 = "insert into ";
m_sInsertT1 = m_sInsertT1 + sTableName + " values("; //记录插入语句部分str
m_sTable = sTableName; //表的名字
m_nColumn = sNameList.size() + 1; //列总数=记录列数+时间
m_sUpdateT1 = "update " + sTableName; //记录修改语句
m_sUpdateT1 = m_sUpdateT1 + " set ";
m_sTitleList = sNameList; //列名称
}
fn_StartCommit();
} /*********************************************************************************************
Func: 初始化数据表
input: 表名,表列名
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_InitTableForBase(QString sTableName, QStringList sNameList, QStringList sType)
{
fn_StartBegin();
if (m_pdb!=NULL)
{
QString stmp;
stmp = "create table " + sTableName + "("; for (int i=0;i<sNameList.size();i++)
{
if (i != 0)
{
stmp += ",";
}
stmp = stmp + sNameList.at(i) + " " + sType.at(i);
} stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg); m_sInsertT1 = "insert into ";
m_sInsertT1 = m_sInsertT1 + sTableName + " values("; //记录插入语句部分str
m_sTable = sTableName; //表的名字
m_nColumn = sNameList.size() + 1; //列总数=记录列数+时间
m_sUpdateT1 = "update " + sTableName; //记录修改语句
m_sUpdateT1 = m_sUpdateT1 + " set ";
m_sTitleList = sNameList; //列名称
}
fn_StartCommit();
} /*********************************************************************************************
Func: 增加数据到数据库
input: null
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_InsertData(QString sTableName, QStringList sDataList, QDateTime dt)
{
fn_StartBegin();
if (m_pdb!=NULL)
{
if (m_bSetRecordFlag)//设置了最大行数
{
int nMaxRecordSize = fn_RecordSize(sTableName);//当前最大记录数
if (nMaxRecordSize < 0) return; if (nMaxRecordSize >= m_nSetMaxRecordNum)//超出限制,删掉开始项
{
QString stmp;
stmp = "delete from ";
stmp = stmp + sTableName;
stmp = stmp + " where rowid <= (select min(rowid) from ";
stmp = stmp + sTableName + ");"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg);
} QString stmp;
stmp = "insert into ";
stmp = stmp + sTableName + " values(";
QString sdatetime = dt.toString("yyyy-MM-dd hh:mm:ss");
stmp = stmp + "'";
stmp = stmp + sdatetime;
stmp = stmp + "'"; for (int i=0;i<sDataList.size();i++)
{
stmp = stmp + ",'";
stmp = stmp + sDataList.at(i) + "'";
}
stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg );
}
else
{
QString stmp;
stmp = "insert into ";
stmp = stmp + sTableName + " values(";
QString sdatetime = dt.toString("yyyy-MM-dd hh:mm:ss");
stmp = stmp + "'";
stmp = stmp + sdatetime;
stmp = stmp + "'"; for (int i=0;i<sDataList.size();i++)
{
stmp = stmp + ",'";
stmp = stmp + sDataList.at(i) + "'";
}
stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg );
}
}
fn_StartCommit();
} /*********************************************************************************************
Func: 增加数据到数据库
input: null
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_InsertDataForBase(QString sTableName, QStringList sDataList)
{
fn_StartBegin();
if (m_pdb!=NULL)
{
QString stmp; stmp.clear();
stmp = "insert into ";
stmp = stmp + sTableName + " values("; for (int i=0; i<sDataList.size(); i++)
{
if (i != 0)
{
stmp = stmp + ",";
}
stmp = stmp + "'";
stmp = stmp + sDataList.at(i) + "'";
} stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb ,stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg);
}
fn_StartCommit();
} /*********************************************************************************************
Func: 修改数据库数据
input: null
ouput:null
********************************************************************************************/
int QSKMonitorSQL::fn_UpdateData(QString sTableName, QStringList sDataList, int index)
{
int nRet = -1;
fn_StartBegin();
if (m_pdb!=NULL)
{
QString stmp;
int isize;
stmp = "update " + sTableName; //修改语句
stmp = stmp + " set "; isize = sDataList.size();
for (int i=0;i<isize;i++)
{
stmp = stmp + m_sTitleList.at(i);
stmp = stmp + " = ";
stmp = stmp + "'";
stmp = stmp + sDataList.at(i);
stmp = stmp + "'";
if (i != isize - 1) //不是最后一个时
{
stmp = stmp + ",";
}
}
stmp = stmp + " where rowid = (select MIN(rowid) + ";
stmp = stmp + QString::number(index);
stmp = stmp + " from ";
stmp = stmp + m_sTable;
stmp = stmp + ")";
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
nRet = sqlite3_exec(m_pdb, stmp.toAscii().data(), NULL, NULL, &m_pzErrMsg );
}
fn_StartCommit(); return nRet;
} /*********************************************************************************************
Func: 删除数据
input: null
ouput:null
********************************************************************************************/
void QSKMonitorSQL::fn_DeleteData(QString sTableName)
{
fn_StartBegin();
if (m_pdb!=NULL)
{
QString stmp;
stmp = "delete from ";
stmp = stmp + sTableName;
stmp = stmp + ";"; stmp = fn_UnicodeToUTF8(stmp);//编码转换
sqlite3_exec(m_pdb , stmp.toAscii().data() , NULL , NULL , &m_pzErrMsg );
}
fn_StartCommit();
} /*********************************************************************************************
Func: 上电时获得最小的rowid序号
input: null
ouput:null
********************************************************************************************/
uint QSKMonitorSQL::fn_GetMinRowID(QString sTableName)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select min(rowid) from ";
stmp = stmp + sTableName;
stmp = stmp + ";";
int nRow;
int nColumn; stmp = fn_UnicodeToUTF8(stmp);//编码转换
int result = sqlite3_get_table(m_pdb, stmp.toAscii().data(), &m_ppazResult, &nRow, &nColumn, &m_pzErrMsg );
if (result == SQLITE_OK)
{
QString sData;
sData.sprintf("%s", m_ppazResult[1]);
int nMin;
nMin = sData.toInt();
sqlite3_free_table(m_ppazResult); //释放
return nMin;
}
else
{
sqlite3_free_table(m_ppazResult); //释放
return 0;
}
}
else
{
return 0;
}
} /*********************************************************************************************
Func: 获得数据库记录大小
input: null
ouput:记录条数
********************************************************************************************/
int QSKMonitorSQL::fn_RecordSize(QString sTableName)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select count(*) from ";
stmp = stmp + sTableName;
int nRow;
int nColumn; stmp = fn_UnicodeToUTF8(stmp);//编码转换
int result = sqlite3_get_table(m_pdb , stmp.toAscii().data(), &m_ppazResult , &nRow , &nColumn , &m_pzErrMsg );
if (result == SQLITE_OK)
{
QString sNum;
sNum.sprintf("%s",m_ppazResult[1]);
sqlite3_free_table(m_ppazResult);
return sNum.toInt();
}
else
{
sqlite3_free_table(m_ppazResult);
return -1;
}
}
else
{
return 0;
}
} /*********************************************************************************************
Func: 获取数据库全部数据
input: pData-返回的查询数据
ouput:返回查询结果总数
********************************************************************************************/
int QSKMonitorSQL::fn_QueryAllData(QString sTableName, QVector<QStringList> *pData)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select * from ";
stmp = stmp + sTableName; //格式化查询语句 int nRow;
int nColumn;
int result = sqlite3_get_table(m_pdb , stmp.toAscii().data(), &m_ppazResult , &nRow , &nColumn ,
&m_pzErrMsg );
if (result == SQLITE_OK)
{
QStringList listTmp;
QString sData;
for (int i=0;i<nRow;i++)
{
int iTmp;
iTmp = (i + 1)*nColumn; //返回数据中,前nColumn个是字段名字,偏移字段数目
for (int j=0;j<nColumn;j++)
{
sData.sprintf("%s",m_ppazResult[iTmp + j]);
listTmp.append(sData);
}
pData->append(listTmp);
listTmp.clear();
}
sqlite3_free_table(m_ppazResult); //释放
return nRow;
}
else
{
sqlite3_free_table(m_ppazResult); //释放
return -1;
}
}
else
{
return -1;
}
} /*********************************************************************************************
Func: 按序号查询指定范围的数据
input: iStart-开始rowid序号 iNumber-查询总数 pData-返回的查询数据
ouput:返回查询结果总数
********************************************************************************************/
int QSKMonitorSQL::fn_QueryDataByIndex(QString sTableName, int iStart, int iNumber, QVector<QStringList> *pData)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select * from ";
stmp = stmp + sTableName + " ";
stmp = stmp + "where rowid >= ";
stmp = stmp + QString::number(iStart) + " limit ";
stmp = stmp + QString::number(iNumber);
int nRow;
int nColumn;
int result = sqlite3_get_table(m_pdb , stmp.toAscii().data(), &m_ppazResult , &nRow , &nColumn ,
&m_pzErrMsg );
if (result == SQLITE_OK)
{
QStringList listTmp;
QString sData;
for (int i=0;i<nRow;i++)
{
int iTmp;
iTmp = (i + 1)*nColumn; //返回数据中,前nColumn个是字段名字,偏移字段数目
for (int j=0;j<nColumn;j++)
{
sData.sprintf("%s",m_ppazResult[iTmp + j]);
listTmp.append(sData);
}
pData->append(listTmp);
listTmp.clear();
}
sqlite3_free_table(m_ppazResult); //释放
return nRow;
}
else
{
sqlite3_free_table(m_ppazResult); //释放
return -1;
}
}
else
{
return -1;
}
} /*********************************************************************************************
Func: 按时间查询指定范围的数据
input: dtStart-开始时间 dtEnd-结束时间 pData-返回的查询数据
ouput:返回查询结果总数
********************************************************************************************/
int QSKMonitorSQL::fn_QueryDataByTime(QString sTableName, QDateTime dtStart, QDateTime dtEnd, QVector<QStringList> *pData)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select * from ";
stmp = stmp + sTableName + " ";
stmp = stmp + "where logtime >= ";
stmp = stmp + "'" + dtStart.toString("yyyy-MM-dd hh:mm:ss") + "'" + " and logtime <= ";
stmp = stmp + "'" + dtEnd.toString("yyyy-MM-dd hh:mm:ss") + "'";
int nRow;
int nColumn;
int result = sqlite3_get_table(m_pdb , stmp.toAscii().data(), &m_ppazResult , &nRow , &nColumn ,
&m_pzErrMsg );
if (result == SQLITE_OK)
{
QStringList listTmp;
QString sData;
for (int i=0;i<nRow;i++)
{
int iTmp;
iTmp = (i + 1)*nColumn; //返回数据中,前nColumn个是字段名字,偏移字段数目
for (int j=0;j<nColumn;j++)
{
sData.sprintf("%s",m_ppazResult[iTmp + j]);
listTmp.append(sData);
}
pData->append(listTmp);
listTmp.clear();
}
sqlite3_free_table(m_ppazResult); //释放
return nRow;
}
else
{
sqlite3_free_table(m_ppazResult); //释放z
return -1;
}
}
else
{
return 0;
}
} /*********************************************************************************************
Func: 按值查询指定范围的数据
input: nType-比较条件 nFrontV-比较前值 nBackV-比较后值 pData-返回的查询数据
ouput:返回查询结果总数
********************************************************************************************/
int QSKMonitorSQL::fn_QueryDataByValue(QString sTableName, int nType, QString sFrontV, QString sBackV, QVector<QStringList> *pData)
{
return true;
} /*********************************************************************************************
Func: 有开始时间和结束时间算出这段时间有多少数据
input: 开始时间 结束时间 返回行数 最小rowid
ouput:找到数据返回1 没有找到返回0
Select count(*) From MAIN.[hisdata] where hisdata.logtime >= '2012-05-24 15:53:48'
and hisdata.logtime >= '2012-05-24 15:55:48' ;
********************************************************************************************/
bool QSKMonitorSQL::fn_RecordSizeByTime(QString sTableName, QDateTime dtStart, QDateTime dtEnd, int *pRows, int *pMaxID,int *pMinID)
{
if (m_pdb!=NULL)
{
QString stmp;
stmp = "select count(*), MIN(rowid), MAX(rowid) from ";
stmp = stmp + sTableName + " ";
stmp = stmp + "where logtime >= ";
stmp = stmp + "'" + dtStart.toString("yyyy-MM-dd hh:mm:ss") + "'" + " and logtime <= ";
stmp = stmp + "'" + dtEnd.toString("yyyy-MM-dd hh:mm:ss") + "'";
int nRow;
int nColumn;
int result = sqlite3_get_table(m_pdb , stmp.toAscii().data(), &m_ppazResult , &nRow , &nColumn ,
&m_pzErrMsg );
if (result == SQLITE_OK)
{
QString sData;
int counts;
sData.sprintf("%s",m_ppazResult[3]); //获得返回条数
counts = sData.toInt(); //行数
if (counts == 0) //没有数据
{
*pRows = counts;
*pMinID = 0;
*pMaxID = 0;
}
else
{
*pRows = counts;
sData.sprintf("%s",m_ppazResult[4]); //获得最小rowid
*pMinID = sData.toInt();
sData.sprintf("%s",m_ppazResult[5]); //获得最大rowid
*pMaxID = sData.toInt(); }
}
sqlite3_free_table(m_ppazResult); //释放
return 1;
}
else
{
*pRows = 0;
*pMinID = 0;
*pMaxID = 0;
return 0;
}
} /*********************************************************************************************
Func: 设置最大行数
input: nMaxRows:最大行数值
ouput: 无
********************************************************************************************/
void QSKMonitorSQL::fn_SetMaxRowId(int nMaxRows)
{
m_nSetMaxRecordNum = nMaxRows;
m_bSetRecordFlag = true;
} /*********************************************************************************************
Func: unicode 到UTF8转换
input: null
ouput:null
********************************************************************************************/
QString QSKMonitorSQL::fn_UnicodeToUTF8(QString str)
{
QString sName;
QByteArray baT4;
baT4.clear();
baT4=QTextCodec::codecForName("UTF8")->fromUnicode(str);
sName = (QString)baT4;
return sName;
}
***************************************************************************************
***************************************************************************************
That's all! http://blog.csdn.net/mingxia_sui/article/details/8502179 ------------------------------------------------------------------------------------------- sqlite 查询数据 不用回调
int main( void )
{
sqlite3 *db=NULL;
char *zErrMsg = 0;
int rc;
//打开数据库连接
rc = sqlite3_open("zieckey.db", &db);
if( rc )
{
fprintf(stderr, "Can't open sqlite: %s/n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
else printf("open sqlite success/n");
//查询
char* sql = "SELECT rowid,name FROM test ";
int nrow = 0;
int ncolumn = 0;
char ** azResult; //返回结果集
sqlite3_get_table(db , sql , &azResult , &nrow , &ncolumn , &zErrMsg );
printf("row:%d,column:%d/n",nrow,ncolumn);
int i;
int j;
//读取结果集并释放
for(i=0;i<=nrow;i++)
{
for(j=0;j {
printf("value:%s ",azResult[i*ncolumn+j]);
}
printf("/n");
}
sqlite3_close(db); //关闭数据库
return 0;
}
http://blog.csdn.net/zhangxiaonanwin/article/details/6087987
SQLite3的使用(封装很长,直接使用sqlite3_open函数,LIBS += sqlite3.dll 即可)good的更多相关文章
- 专访黄勇:Java在未来的很长一段时间仍是主流(把老板当情人,把同事当小孩,把客户当病人)
url:http://www.csdn.net/article/2015-09-06/2825621 2015-09-06 13:18 摘要:本文采访了现任阿里巴巴公司系统架构师黄勇,从事近十年的Ja ...
- mvc中多参数URL会很长,首次加载不传参数让url很短,路由规则实现方法[bubuko.com]
如要实现列表中地址全路径“bubuko-11-2.html”,在首次进入时,使用短路径“bubuko.html”,只有再次href后才显示全路径“bubuko-11-2.html”,下面使用路由规则来 ...
- Springmvc+Hibernate在Eclipse启动Tomcat需要很长时间的解决方法
最近在学习SpringMvc开发,有一个提问困扰了很久,就是在Eclipse启动Tomcat需要很长时间,大概要1分多钟. 启动日志: 九月 08, 2016 8:59:01 下午 org.apach ...
- 为什么drop table的时候要在checking permissions花很长时间?
昨天,我drop一个表的时候在checking permissions花了20s+,这个时间花在哪里了呢?经常查找发现我的配置文件innodb_file_per_table=1的,innodb需要遍历 ...
- java 将长度很长的字符串(巨大字符串超过4000字节)插入oracle的clob字段时会报错的解决方案
直接很长的字符串插入到clob字段中会报字符过长的异常,相信大家都会碰到这种情况 String sql = "insert into table(request_id,table_name, ...
- 【转】android中重复连接ble设备导致的连接后直接返回STATE_DISCONNECTED的解决办法---不错不错,重新连接需要花费很长的时间
原文网址:http://bbs.eeworld.com.cn/thread-438571-1-1.html /* * 通过使用if(gatt==null ...
- C#使用Xamarin开发可移植移动应用(2.Xamarin.Forms布局,本篇很长,注意)附源码
前言 系列目录 C#使用Xamarin开发可移植移动应用目录 源码地址:https://github.com/l2999019/DemoApp 可以Star一下,随意 - - 一点感想 很意外的,第一 ...
- POJ2774 很长的信息
Description Little cat在Byterland的首都读物理专业.这些天他收到了一条悲伤地信息:他的母亲生病了.担心买火车票花钱太多(Byterland是一个巨大的国家,因此他坐火车回 ...
- 【生产问题】记还原一个很小的BAK文件,但却花了很长时间,分析过程
[生产问题]还原一个很小的BAK文件,但却花了很长时间? 关键词:备份时事务日志太大会发生什么?还原时,事务日志太大会怎么办? 1.前提: [1.1]原库数据已经丢失,只有这个bak了 [1.2]ba ...
随机推荐
- 利用backtrace和ucontex定位segment错误
C程序运行时,经常会碰到"segmentfault"错误.这是由于程序中非法访问内存导致的.当操作系统的内存保护机制发现进程访问了非法内存的时候会向此进程发送一个SIGSEGV信号 ...
- UVa 10502【dp】
uva 10502 题意:给定01矩阵,求有多少个由1构成的矩阵.1本事也算一个矩阵. 到最后还是想不出来..... 每次枚举两行,从第i行到第j行,k枚举矩阵的宽(column).这样就相当于每次看 ...
- Uva 10074【递推dp】
UVa 10074 题意:求01矩阵的最大子0矩阵. http://www.csie.ntnu.edu.tw/~u91029/MaximumSubarray.html#2 这里说的很清楚.先求Larg ...
- POJ-3159_Candies
Candies Time Limit: 1500MS Memory Limit: 131072K Description During the kindergarten days, flymouse ...
- @AGC037 - E@ Reversing and Concatenating
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个长度为 N 且只包含小写字母的字符串 S ,你可以执行 ...
- laravel重定向到上一个页面怎么带参数返回 withsucess 成功提示信息
//控制器中 return back()->with('success','操作成功'); //with的参数1是一个session变量名,参数2为该session变量值,在视图直接这样获取 @ ...
- CENTOS7安装R语言环境
CENTOS7安装R语言环境 yum install texinfo.x86_64 yum install texlive.x86_64 cd /opt wget https://mirrors.tu ...
- Spring IoC 使用详解
在Spring中,依赖注入(DI)模式实现了控制反转(IoC)原理.让我们通过一个例子来帮助理解依赖注入.我们先看到java版的例子,然后在此基础上加上spring的功能.就例子而言,是相当地简单.Q ...
- oracle函数 floor(x)
[功能]返回小于等于x的最大整数值 [参数]x,数字型表达式 [返回]数字 [示例] select floor(3.1),floor(2.8+1.3),floor(0) from dual; 返回4, ...
- Bert系列(三)——源码解读之Pre-train
https://www.jianshu.com/p/22e462f01d8c pre-train是迁移学习的基础,虽然Google已经发布了各种预训练好的模型,而且因为资源消耗巨大,自己再预训练也不现 ...