CN106257460A - Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system - Google Patents

Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system Download PDF

Info

Publication number
CN106257460A
CN106257460A CN201610714565.5A CN201610714565A CN106257460A CN 106257460 A CN106257460 A CN 106257460A CN 201610714565 A CN201610714565 A CN 201610714565A CN 106257460 A CN106257460 A CN 106257460A
Authority
CN
China
Prior art keywords
database
data base
function
type
universal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610714565.5A
Other languages
Chinese (zh)
Inventor
赵学臣
李露露
高振雪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TIANJIN TDQS ELECTRIC NEW TECHNOLOGY Co Ltd
Original Assignee
TIANJIN TDQS ELECTRIC NEW TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TIANJIN TDQS ELECTRIC NEW TECHNOLOGY Co Ltd filed Critical TIANJIN TDQS ELECTRIC NEW TECHNOLOGY Co Ltd
Priority to CN201610714565.5A priority Critical patent/CN106257460A/en
Publication of CN106257460A publication Critical patent/CN106257460A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/289Object oriented databases

Abstract

The invention discloses a kind of data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system, comprise the following steps, 1) definition Universal Database access class;2) for each certain database type, each realize a dynamic link library, dynamic link library realizes the universal card function that each type of database is corresponding;3) Universal Database accesses data base's connectivity function of apoplexy due to endogenous wind according to incoming type of database, and dynamic link library that dynamic load the type data base is corresponding also matches universal card function with card format the plug-in unit function of this type of database self.The present invention uses Object-oriented Technique, after the implementation method analyzing various database access interface, the abstract Universal Database that extracts accesses class, unified external offer such as opens data base, closes data base, performs the database access interface function such as SQL statement, db transaction operation, in the way of plug-in unit bottom for each database realizing the coupling of these interface functions.

Description

Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system
Technical field
The present invention relates to micro-capacitance sensor and control technical field, particularly relate to a kind of data base for micro-capacitance sensor monitoring system General-purpose accessing implementation method.
Background technology
Micro-capacitance sensor refers to by groups such as distributed power source, energy storage device, energy conversion device, load, monitoring and protection devices Small-sized the distribution system become.Micro-capacitance sensor is an autonomous system being capable of self-contr ol, protecting and manage, both can be with External electrical network is incorporated into the power networks, it is also possible to isolated operation.Exploitation and extend micro-capacitance sensor can sufficiently promote distributed power source with can be again The extensive access of the raw energy, it is achieved the highly reliable supply to load various energy resources form, is realize active power distribution network one Plant effective means, make tradition electrical network to intelligent grid transition, the most at home and abroad obtained large-scale application.Micro-capacitance sensor monitors System is that the data acquisition realizing micro-capacitance sensor controls with monitoring, ensures micro-capacitance sensor safe and reliable operation requisite software and hardware collection One-tenth system.
In micro-capacitance sensor monitoring system, the foundation of microgrid data model, the storage of microgrid data depend on data base administration System.In actual application, according to micro-capacitance sensor scale and user's request, data base can be selected for large commercial data base such as Oracle, SQL Server etc., it is possible to select toy data base management system, such as My SQL etc., in the case of extremely indivedual, very To microgrid model being set up hereof, depart from data base management system.Each data base general has respective API Access interface, can access for these api interfaces of each data base call.Also have some general data bank access methods Such as ODBC, ADO etc., these modes are mainly used under windows platform, do not possess cross-platform feature, use also than Cumbersome.
Summary of the invention
It is an object of the invention to for technological deficiency present in prior art, and provide a kind of for micro-capacitance sensor monitoring system Data base's general-purpose accessing implementation method of system.
Be the technical scheme is that by realizing the purpose of the present invention
A kind of data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system, comprises the following steps,
1) definition Universal Database accesses class, and wherein, described Universal Database accesses class wrapper and defines multiple data Storehouse access interface function;
2) for each certain database type, each realize a dynamic link library, realize in dynamic link library The universal card function that each type of database is corresponding;
3) data base's connectivity function of Universal Database access apoplexy due to endogenous wind is according to incoming type of database, and dynamic load should Dynamic link library that types of database is corresponding also matches this type of database self with card format universal card function Plug-in unit function.
Described step 1) in database access interface function include data base's connectivity function, data base close function, Obtain class database type function, perform SQL statement and db transaction handling function.
Described step 2) in type of database include Oracle, SQL Server, My SQL, sybase database and Pure document storage mode.
Compared with prior art, the invention has the beneficial effects as follows:
The present invention uses Object-oriented Technique, after the implementation method analyzing various database access interface, abstract carries Producing Universal Database and access class, unified external offer is such as opened data base, is closed data base, execution SQL statement, data base The database access interface functions such as transaction operation, at bottom for Oracle, SQL Server, My SQL in the way of plug-in unit, Sybase database and pure file mode storage achieve the coupling of these interface functions.Micro-capacitance sensor monitoring system is being visited Concrete operating system platform and type of database need not be concerned about the when of asking data base, only need to simply call these number of ports According to storehouse access interface function, according to configuration, Universal Database accesses class object can be automatically matched to respective concrete implementation method. So, greatly reduce the difficulty to the programming of micro-capacitance sensor monitoring software, improve the versatility of software, stability, simultaneously facilitate Safeguard, also have good extensibility.
Detailed description of the invention
Below in conjunction with specific embodiment, the present invention is described in further detail.Should be appreciated that described herein specifically Embodiment only in order to explain the present invention, is not intended to limit the present invention.
Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system of the present invention, comprises the following steps,
1) definition Universal Database accesses class, and wherein, described Universal Database accesses class wrapper and defines multiple data The database access interface function of storehouse type, closes function including data base's connectivity function, data base, obtains type of database letter Number, perform SQL statement and db transaction handling function etc., as hereinafter open with close data base be connected Open (), Close () performs SQL statement ExecuteSQL (), Exec () etc..Meanwhile, this Universal Database accesses class and defines data base The universal card function that type is unrelated, such as qs_open () hereinafter, qs_prepare_sql () etc., these universal cards Function is called in above-mentioned database access interface function.
2) for each type of database, each realize a dynamic link library, dynamic link library realizes each number According to the universal card function such as qs_open () of storehouse type oneself, qs_prepare_sql () etc., data base can be Oracle, SQL Server, My SQL or sybase database etc..
3) Universal Database accesses the database access interface function of apoplexy due to endogenous wind, if Open () interface function is according to incoming Type of database, dynamic link library that dynamic load the type data base is corresponding also matches this with card format plug-in unit function The plug-in unit function of type of database self.
That is, when actual access data base, statement Universal Database accesses the example of class, database access interface function root According to incoming type of database, call its database access interface function.
The present invention uses Object-oriented Technique, after the implementation method analyzing various database access interface, abstract carries Producing Universal Database and access class, unified external offer is such as opened data base, is closed data base, execution SQL statement, data base The database access interface functions such as transaction operation, at bottom for Oracle, SQL Server, My SQL in the way of plug-in unit, Sybase database and pure file mode storage achieve the coupling of these interface functions.Micro-capacitance sensor monitoring system is being visited Concrete operating system platform and type of database need not be concerned about the when of asking data base, only need to simply call these interface letters Number, according to configuration, Universal Database accesses class object can be automatically matched to respective concrete implementation method.So, it is substantially reduced Difficulty to the programming of micro-capacitance sensor monitoring software, improves the versatility of software, stability, simultaneously facilitates maintenance, also has very well Extensibility.
Detailed description of the invention
The first step: determine and realize the database access interface function of data base's general-purpose accessing class CQSDBI, including data Storehouse connects, data base closes, perform the general database access interface function of SQL statement, db transaction operation etc., actual makes In with, only need to state the example of CQSDBI class, call these database access interface functions, and without being concerned about concrete data base Type.
Major database access interface function is as follows
It is connected and disconnected from data base:
bool Open(const char*i_pszSrv,const char*i_pszUser,const char*i_ pszPwd);
bool Open(const char*i_pszSrv,const char*i_pszIpAddr,const char*i_ pszDBName,const char*i_pszUser,const char*i_pszPwd,const char*dbType);
Void Close (bool bClose=true);
Judge whether data base opens:
bool IsOpen()const{return m_bOpen;}
Acquisition type of database:
int GetDBType()const{return m_nDBType;}
Acquisition data source name: const char*GetDBName () const{return m_qsSrcName.GetBuf ();}
Execution SQL statement:
bool ExecuteSQL(const char*i_pszSqlStr);
int Exec();
Judge whether tables of data exists
bool IsTableExist(const char*i_szTableName);
Acquisition error number and error character string:
int GetErrorNo();
const char*GetErrorStr();
Preparation SQL statement:
bool PrepareSQL(const char*i_pStringSQL);
Close this SQL process:
void CloseSQL();
Binding row:
bool BindCol(int i_nColType,int i_nColSize,void*i_pColAddr);
Binding parameter:
bool BindPara(int i_nParaType,int i_nParaSize,void*i_pParaAddr);
Acquisition Query Result:
bool Fetch();
Whether arrive record tail:
bool IsEnd();
Beginning transaction operation:
bool BeginTrans();
Submit affairs:
bool Commit();
Rollback affairs:
bool Rollback();
Second step: at the universal card letter that each type of database defined in data base's general-purpose accessing class CQSDBI is general Number.Then in the public member function of opening, above-mentioned universal card function is called respectively, i.e. each class database Type correspondence realizes a dynamic link library, realizes respective universal card function in storehouse.In the Open function of CQSDBI, According to incoming type of database, load these dynamic link libraries, above-mentioned universal card function is matched each independent digit Interface function according to storehouse type.
These universal card functions are defined as follows:
void*(*qs_open)(const char*,const char*,const char*,const char*,const char*);
void(*qs_close)(const void*,bool);
bool(*qs_execute_sql)(const void*,const char*);
bool(*qs_is_table_exist)(const void*,const char*);
int(*qs_get_error_no)(const void*);
const char*(*qs_get_error_str)(const void*);
bool(*qs_prepare_sql)(const void*,const char*);
void(*qs_close_sql)(const void*);
bool(*qs_bind_col)(const void*,int,int,void*);
bool(*qs_bind_para)(const void*,int,int,void*);
int(*qs_exec)(const void*);
bool(*qs_fetch)(const void*);
bool(*qs_is_end)(const void*);
bool(*qs_begin_trans)(const void*);
bool(*qs_commit)(const void*);
bool(*qs_rollback)(const void*);
3rd step: determine and realize oracle database plug-in unit class CQSOracleDBI.Carry according to oracle database The requirement of Oracle calling interface function (Oracle Call Interface is called for short OCI), it is achieved similar above-mentioned CQSDBI's Universal card function mates with plug-in unit function.
Step: determine and realize SQL Server data base's plug-in unit class CQSSqlserver.The present invention selects the skill of ODBC Art requirement, it is achieved the similar universal card function of above-mentioned CQSDBI and mating of plug-in unit function.
4th step: determine and realize My SQL plug-in unit class CQSMysqlDBI.Visit according to the API that My SQL database provides Ask interface, it is achieved the similar universal card function of above-mentioned CQSDBI and mating of plug-in unit function.
5th step: determine and realize My SQL plug-in unit class CQSSybaseDBI.Visit according to the API that sybase database provides Ask interface, it is achieved the similar universal card function of above-mentioned CQSDBI and mating of plug-in unit function.
6th step: determine and realize file mode plug-in unit class CQSFi leDB.Select csv stored in file format data, root QT storehouse is combined, it is achieved the universal card function of similar above-mentioned CQSDBI and plug-in unit function according to the general read-write mode of text Coupling.
Present invention achieves the unified operation of above-mentioned type of database, for other type of database, can do similar Extension is supported, it is achieved that when micro-capacitance sensor monitoring system accesses data base, it may not be necessary to be concerned about concrete operating system platform With type of database, each database access interface function that only need to simply call Universal Database access class can complete.Tool The interface of each data base is realized by body acupuncture, bottom plug-in unit complete.So greatly reduce the complexity of upper layer software (applications) programming Degree, has good versatility and stability.It addition, the present invention also supports effectively to extend, to the number being not included in temporarily in plug-in unit According to storehouse type, can realize one by one according to the requirement of Universal Database access class interface, possess good autgmentability
The above is only the preferred embodiment of the present invention, it is noted that for the common skill of the art For art personnel, under the premise without departing from the principles of the invention, it is also possible to make some improvements and modifications, these improvements and modifications Also should be regarded as protection scope of the present invention.

Claims (3)

1. the data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system, it is characterised in that comprise the following steps,
1) definition Universal Database accesses class, and wherein, described Universal Database accesses class wrapper and defines multiple data base visit Ask interface function;
2) for each certain database type, each realize a dynamic link library, dynamic link library realizes each number According to the universal card function that storehouse type is corresponding;
3) Universal Database accesses data base's connectivity function of apoplexy due to endogenous wind according to incoming type of database, dynamic load the type number The dynamic link library corresponding according to storehouse also matches universal card function with card format the plug-in unit letter of this type of database self Number.
2. the data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system as claimed in claim 1, it is characterised in that Described step 1) in database access interface function include data base's connectivity function, data base close function, obtain data Storehouse type of functions, execution SQL statement and db transaction handling function.
3. the data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system as claimed in claim 1, it is characterised in that Described step 2) in type of database include Oracle, SQL Server, My SQL, sybase database and pure file are deposited Storage mode.
CN201610714565.5A 2016-08-24 2016-08-24 Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system Pending CN106257460A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610714565.5A CN106257460A (en) 2016-08-24 2016-08-24 Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610714565.5A CN106257460A (en) 2016-08-24 2016-08-24 Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system

Publications (1)

Publication Number Publication Date
CN106257460A true CN106257460A (en) 2016-12-28

Family

ID=57714129

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610714565.5A Pending CN106257460A (en) 2016-08-24 2016-08-24 Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system

Country Status (1)

Country Link
CN (1) CN106257460A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107590208A (en) * 2017-08-25 2018-01-16 国网辽宁省电力有限公司 A kind of electric network data heterogeneous database data cut-in method of plug-in type
CN107707544A (en) * 2017-09-29 2018-02-16 国网江苏省电力公司电力科学研究院 A kind of equipment automatic identification collocation methods of IEC 61850
CN109684399A (en) * 2018-12-24 2019-04-26 成都四方伟业软件股份有限公司 Data bank access method, database access device and Data Analysis Platform
CN110069292A (en) * 2019-03-26 2019-07-30 国电南瑞科技股份有限公司 A kind of implementation method that power grid regulation system supports third-party application
CN111522849A (en) * 2020-04-22 2020-08-11 深圳市春蚕智能信息技术有限公司 Database dynamic access method, server and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448867A (en) * 2002-03-30 2003-10-15 深圳市中兴通讯股份有限公司 Method for accessing database system uniformly
CN101930469A (en) * 2010-09-02 2010-12-29 江西省电力公司超高压分公司 Universal data access method of cross-platform multi-heterogeneous database in scheduling data service platform
CN102193922A (en) * 2010-03-04 2011-09-21 杭州华三通信技术有限公司 Method and device for accessing database
US20130007062A1 (en) * 2011-07-01 2013-01-03 Salesforce.Com, Inc. Truncating data associated with objects in a multi-tenant database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448867A (en) * 2002-03-30 2003-10-15 深圳市中兴通讯股份有限公司 Method for accessing database system uniformly
CN102193922A (en) * 2010-03-04 2011-09-21 杭州华三通信技术有限公司 Method and device for accessing database
CN101930469A (en) * 2010-09-02 2010-12-29 江西省电力公司超高压分公司 Universal data access method of cross-platform multi-heterogeneous database in scheduling data service platform
US20130007062A1 (en) * 2011-07-01 2013-01-03 Salesforce.Com, Inc. Truncating data associated with objects in a multi-tenant database

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107590208A (en) * 2017-08-25 2018-01-16 国网辽宁省电力有限公司 A kind of electric network data heterogeneous database data cut-in method of plug-in type
CN107707544A (en) * 2017-09-29 2018-02-16 国网江苏省电力公司电力科学研究院 A kind of equipment automatic identification collocation methods of IEC 61850
CN109684399A (en) * 2018-12-24 2019-04-26 成都四方伟业软件股份有限公司 Data bank access method, database access device and Data Analysis Platform
CN110069292A (en) * 2019-03-26 2019-07-30 国电南瑞科技股份有限公司 A kind of implementation method that power grid regulation system supports third-party application
CN110069292B (en) * 2019-03-26 2022-03-29 国电南瑞科技股份有限公司 Method for realizing third-party application support of power grid regulation and control system
CN111522849A (en) * 2020-04-22 2020-08-11 深圳市春蚕智能信息技术有限公司 Database dynamic access method, server and storage medium

Similar Documents

Publication Publication Date Title
CN106257460A (en) Data base's general-purpose accessing implementation method for micro-capacitance sensor monitoring system
CN102073767B (en) Method for managing metadata of virtual data warehouse of electric power information system group
CN104376062B (en) A kind of synchronous method of heterogeneous database platform data
CN102929911B (en) Substation and scheduling station method of integrated modeling
CN102750358B (en) Mapping method and system of system data model to common information model (CIM)
CN101329682A (en) Method for integrating distribution type isomerization information resource
CN104820946A (en) Cloud computing system for agricultural information integration
CN102708213A (en) Method for realizing BOM (Bill of Material) information transmission between PDM (Product Data Management) system and ERP (Enterprise Resource Planning) system
CN103455554A (en) Intelligent power distribution network model base system
CN108460142A (en) A kind of Database Systems based on block chain technology
CN106709143A (en) VFTO batch simulation analysis method and system based on ATP automatic modeling
CN108897756A (en) Data query analysis method and storage medium across data center
CN101826178A (en) Power distribution inspection system
CN115187425A (en) Power utilization data processing method based on configuration software and relational database trigger
CN204374961U (en) Medical inspection information acquisition system
CN106682230A (en) Information service system based on HTML5 and CSS3 mobile display technological architecture
CN204423369U (en) Based on the distributed photovoltaic power station data base management system of MongoDB
CN206166318U (en) Office furniture braced system with locking function
CN105141030B (en) A kind of communications management system for SVC
CN109871375A (en) The information platform and its control method of distributed new scale access
CN103605780A (en) Interface processing system for IEC61850 data
CN103309983B (en) Electrical anti-error system and method based on embedded database SQLite
CN104572692A (en) VS-based method for realizing conversion between XML (extensive makeup language) document and mass database
CN106941512A (en) A kind of efficient data storage server
CN101894354A (en) Embedded agricultural database-based agricultural remote information system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20161228

RJ01 Rejection of invention patent application after publication