The invention relates to the field of
database application, in particular to a method and a
system for achieving
database operation by utilizing an
object relational mapping (ORM) frame in
object orientation. The method includes
processing all structured
query language (
SQL) statements in a unification mode to enable all the processed
SQL statements to achieve
database access and operation through a simple application program interface (API), avoid access switching caused by the fact that different databases have different interfaces and enable
database access to be simple; automatically generating an
SQL script through an ORM entity, utilizing template metaprograms and macros to achieve a
generation process to avoid the trouble of manual memory of a large amount of SQL statements, reduce manual spelling errors and improve development efficiency; conducting operation on the databases through a chained calling mode to achieve flexibility of an access mode. The
system comprises a
processing module, a converting module and an operation module, and can achieve contents in the method. By means of the method and the
system, operation of small databases or large databases becomes simple and automatic, and access efficiency and accuracy are effectively improved.