[SQLite3] Regexp problem
-
Stefan Padlo
- Posts: 5
- Joined: Wed 23 Mar 2011 23:02
[SQLite3] Regexp problem
Hi all!
I have a problem with the REGEXP function using SQLite. It says that there's no function such regexp.
My question is : how to implement sqlite_create_function with C++ Builder + UniDAC?
Thanks!
I have a problem with the REGEXP function using SQLite. It says that there's no function such regexp.
My question is : how to implement sqlite_create_function with C++ Builder + UniDAC?
Thanks!
-
Stefan Padlo
- Posts: 5
- Joined: Wed 23 Mar 2011 23:02
-
MamProblem
- Posts: 13
- Joined: Mon 09 May 2011 11:11
Hello,
Below is a small sample demonstrating how to use SQLite user functions in C+Builder:
Below is a small sample demonstrating how to use SQLite user functions in C+Builder:
Code: Select all
// defining user function
// where
// InValues - Input array values of variant
// InValues_Siz - for compatibility (is not used)
// return - return value of variant
Variant __fastcall Reverse(Variant *InValues, const int InValues_Size)
{
// your own function body, for example
return ReverseString(VarToStr(InValues[0]));
}
void __fastcall TForm1::UniConnection1AfterConnect(TObject *Sender)
{
// Registering user function
// where:
// UniConnection1 - pointer to TUniConnection
// "REVERSE" - name of user function
// 1 - number of user function parameters
// Reverse - pointer to user function
TLiteUtils::RegisterFunction(UniConnection1,"REVERSE",1,Reverse);
}
// Using user function
void __fastcall TForm1::Button1Click(TObject *Sender)
{
UniQuery1->SQL->Text = "select REVERSE('ABCD')";
UniQuery1->Open(); //result 'DCBA'
}