Table Name fixer

Source: Internet
Author: User
Tags expression engine

Recently, I encountered a problem where the customer released SQL files to the production database, which is under audit consideration. users who cannot directly use JDBC must use a third-party user name. In this way, developers will be troubled. During each release, the table name must contain the JDBC user name in the production environment.

In order to solve this problem, we have developed an auxiliary software to automatically add the specified table owner to the table name in the SQL file submitted by the developer.

 

:

 

There are also two episodes:

1. To replace the table name, you cannot simply replace it. What can be used? Naturally, it is a powerful regular expression. Fortunately, Microsoft has a built-in Regular Expression support library in ATL. However, there is no/B in the Perl style and it cannot match the word separator. The/B in the Regular Expression Library atlrx. h of VC is only equivalent to the/s of Perl and represents a blank character. There is no way, so we have to select a third-party Regular Expression Library. When talking about regular expressions in C ++, the first thing that comes to mind is Greta and boost libraries (refer to my other article: ATL in Visual Studio 2008). Unfortunately, these libraries are huge. Although they are powerful, I don't want to bring a DLL together for release to reduce the volume. Why is it so big? As a result, I searched the internet for a small and powerful Regular Expression Library compatible with the Perl style,Deelx Regular Expression Engine

2, even if the project supports Unicode encoding, use cstdiofile to read the keyword file, if not ASCII encoding, Unicode or UTF-8 format, will become garbled. Therefore, a new class cxstdiofile is derived from cstdiofile to differentiate file Encoding Based on the file header.

Attachment File Header encoding:

Uni16_be: 0xfe, 0xff

Uni16_le: 0xff, 0xfe

Utf8_sign: 0xef, 0xbb, 0xbf // UTF-8 with signature format

Of course, to avoid garbled characters, you must use widechartomultibyte and multibytetowidechar.

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.