C++ Function that Converts A Search String into an SQL Query

We have a C++ / MFC Windows application that stores data in a Microsoft Access format data file.

we need a C++ function to help with searching for text in the database. The search conventions below are very

similar to the Google Adwords search rules so you can consult them if confused.

The function should take a LPCTSTR the user has entered and convert it to a valid SQL query. Lets say the field

that will be queried is called: Description

So the function would return for the search phrase

[dell computer]

something like:

SELECT * FROM Assets WHERE [Description] = 'dell computer'

The format of the text search will be:

(1) [Search String] - the data base field must contain EXACTLY what was in between the brackets [ ] and nothing else. So the search:

[dell computer] will return only the database rows with a field that contains

dell computer

if the field contains

used dell computer

that will not be returned.

(2) "Search String" - the data base field must contain the phrase "Search String", it can contain words before or after the phrase:

Search String

but the phrase "Search String" must be in the Description field.

So if the phrase is "dell computer"

used dell computer

will be returned

dell damaged computer

would not be returned as "dell computer" must be present in the exact form shown in the quotes.

(3) +search

a '+' character before a word means the word must be present somewhere in the description field

so +dell +computer

would return rows containing:

dell damaged computer

old dell computer

computer from dell

but would not return


as the words "dell" and "computer" must be in the description field.

(4) -search

a '-' character before a word means don't return any rows where the description field contains the word

So the search string -queen elizabeth

would return rows with a description field containing

elizabeth warren

elizabeth taylor

but would not return rows

queen elizabeth

queen rock band

as they contain the negative keyword: queen

Skills: C++ Programming, SQL

See more: c program for binary search using function, binary search function in c, query form sql database to show in textboxs c, sql, c++programming, anything goes, c++ programming, microsoft, database programming, microsoft access, troubleshooting, query form sql database to show in textboxs c#, vba sql query connection string, sql query search xml files, sql php search function, sql query tree children, sql query tree structure, connection string sql express serviceprovider, sql query child child, sql server search zip code

About the Employer:
( 32 reviews ) Mississauga, Canada

Project ID: #13107565

Awarded to:


Hi there, I've vast VC++/MFC experience, and was nearly employed by MS them selves, multiple times. Your C++ function(requirement) is actually not too complicated to implement. If you are keen, let me know.

$135 USD in 1 day
(32 Reviews)

25 freelancers are bidding on average $164 for this job


Hello. I am expert in C++, Windows API, MFC and Microsoft Visual Studio. It's my main specialisation. Also, I have knowledge of SQL and I have some experience with Microsoft Access.

$112 USD in 2 days
(984 Reviews)
$147 USD in 3 days
(316 Reviews)

!!!!!!!!!!!!!!!!!!!!! Hello !!!!!!!!!!!! I am a Computer Vision expert specializing in various Computer Vision techs such as Face Recognition, ANPR(LPR), Vehicle/Pedestrian/Object Counting, General Object Classifica More

$222 USD in 5 days
(57 Reviews)

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 7 years. My work is online game developing, and mainly focus on server side, using c++ under Linux environ More

$120 USD in 2 days
(96 Reviews)

Hello. How are you. I have read and understood the project. I'm an Expert in Data Structures and Algorithms. And I know well ; Java ,C/C++, Python ,SQL. I'm interested this project. So, firstly I want to discu More

$200 USD in 4 days
(127 Reviews)
$155 USD in 3 days
(28 Reviews)

Hi, THANKS FOR THE OPPORTUNITY. Check good reviews from customers I have previously worked for. Its my duty, as I have done here before to deliver on this. Kindly let's start work. I have completed projects in so More

$83 USD in 6 days
(5 Reviews)

Hello, Im interested to work on this. I have good experience in SQL queries and done many jobs successfully. I gone through your requirements Thanks, Sheik

$100 USD in 3 days
(17 Reviews)
$100 USD in 3 days
(63 Reviews)

Hi, I have Master Degree in Computer Science. and great experience in C++ and Microsoft Access. I have few questions about project details. First of all, would you be able to provide me the database to test function o More

$45 USD in 3 days
(44 Reviews)

Dear Valued Customer I am a full time Senior Engineer developing Enterprise solutions in C++ and .Net Technologies for about 3+ years. I know all the minor details of N-layer Architecture Software Design, Design Patte More

$250 USD in 5 days
(35 Reviews)

Hi! I'm senior lecturer on databases with 10+ years experience in different DBMS (including MS Access). Also I'm senior lecturer on designing of compilers, so I can create any parser (as I see you need not difficult st More

$88 USD in 3 days
(19 Reviews)
$100 USD in 3 days
(11 Reviews)

Hi, Sir. I am glad to bid you. I have rich experience of C++ developing and I have completed a lot. I have just saw your project and I think I can do it perfectly. I have already do such as C++ functions of searchi More

$155 USD in 3 days
(4 Reviews)

FREELANCER RECOMMENDED ------------------------------------------------------ Can help... I am an Expert... Lets Start! Please start a Discussion with me and we can get started from there... Please check the past p More

$1000 USD in 10 days
(4 Reviews)
$222 USD in 10 days
(10 Reviews)

Hi, I do have deep experience in c++ and sql. I will do this job within 1-2 days. I look forward to hearing from you. Regards, Garnik

$50 USD in 2 days
(1 Review)

Lot of academics, professors wrote lot of articles, books about translation theory and You want it to have for few hundred dollars in freelance? Seriously?

$30 USD in 1 day
(2 Reviews)

Hi. I am an expert in VBA, VBScript, Visual Basic, C#, C++, Delphi, Java, ASP, ASP.NET, Access, MySQL, MSSQL, QuickBooks, Oracle. I can create auto scripts to scrape websites, auto click, format txt, csv, xls, xlsx, do More

$150 USD in 3 days
(2 Reviews)

Hello, Vast C++ programming experience and in addition to this I have done projects in MFC and for that please see my profile. Furthermore,Please see my profile as i Have great ratting and that shows i can delive More

$155 USD in 3 days
(5 Reviews)