Compare/SQL.php

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Compare/SQL.php

Post by jramirezgranada » 22 Feb 2019, 17:52

Hi there;

I need to extend /vendor/aimeos/aimeos-core/lib/mwlib/src/MW/Criteria/Expression/Compare/SQL.php what is the best way to do that.

I need this, in the tables views in admin when you search a text it is camel case, so i want to add a new operator in that file to create a searc non-camel-case.

Thanks
--
Jorge A Ramirez
System Engineer
PHP Developer

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Compare/SQL.php

Post by aimeos » 23 Feb 2019, 17:32

Which database are you using? If it's MySQL, the simplest way to case insensitive comparison is using "utf8mb4_unicode_ci" as collation in ./config/database.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Re: Compare/SQL.php

Post by jramirezgranada » 23 Feb 2019, 18:18

I'm using postgres.

Thks
--
Jorge A Ramirez
System Engineer
PHP Developer

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Compare/SQL.php

Post by aimeos » 24 Feb 2019, 16:17

You can overwrite the createSearch() method in every manager where you need the alternative criteria implementation:
https://github.com/aimeos/aimeos-core/b ... se.php#L74

Unfortunately, it's not possible to replace the base class to provide an alternative criteria implementation for all classes inheriting from that one.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

david22
Posts: 1
Joined: 27 Feb 2019, 19:32

Re: Compare/SQL.php

Post by david22 » 27 Feb 2019, 19:44

Hello,

Will you please tell me, how to create a MySQL Database Using MySQLi and PDO?
As I am a beginner, I have tried to run the code but it did not work.

<?php

//Make the database connection.
db_connect() or die('Unable to connect to database server!');

function db_connect($server = 'localhost', $username = 'root', $password = '', $database = 'hct_db', $link = 'db_link') {
global $$link;
$$link = mysql_connect($server, $username, $password);
if ($$link) mysql_select_db($database);
return $$link;
}

//Function to handle database errors.
function db_error($query, $errno, $error) {
die('Cannot connect to database');
}

//Function to query the database.
function db_query($query, $link = 'db_link') {
global $$link;
$result = mysql_query($query, $$link) or db_error($query, mysql_errno(), mysql_error());
return $result;
}

//Get a row from the database query
function db_fetch_array($db_query) {
return mysql_fetch_array($db_query, MYSQL_ASSOC);
}
?>

Post Reply