Get KoolPHP UI with 30% OFF!

PDODataSource.php + ms sql

Paulo
Hello,
1. in order to be able to insert record in mssql using PDO had to change this file:
//pofa comented $_insert_commands[$i] = preg_replace("/(@".$_key.")([\)\'\"]*[\s;,])/",preg_quote(addslashes($_value))."$2",$_insert_commands[$i]);
//pofa comented $_insert_commands[$i] = preg_replace("/(@".$_key.")([\)\'\"]*$)/",preg_quote(addslashes($_value))."$2",$_insert_commands[$i]);
$_insert_commands[$i] = preg_replace("/(@".$_key.")([\)\'\"]*[\s;,])/",$_value."$2",$_insert_commands[$i]);
$_insert_commands[$i] = preg_replace("/(@".$_key.")([\)\'\"]*$)/",$_value."$2",$_insert_commands[$i]);
both update and insert functions
1.1 example: koolgrid reads a number "45.0" , writes "45\.0" and ms sql does not like it ans issues error "data type conversion" (took me 4hours to find it)
1.2 please advise if what i'm doing is correct
2. the lack of debugging tools on the sql classes is troublesome
2.1 on errors you should pass a message to the UI
2.2 had to :
//grid data sources
$conn =new PDO (DATABASECONNECT,DATABASEUSER,DATABASEPWD);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$ds = new PDODataSource($conn);
2.3 and had again to change PDODataSource.php:
foreach($_insert_commands as $_insert_command)
{
error_log($_insert_command); //pofa
$_st_id = $this->_PDO->prepare($_insert_command);
.....
2.4 since this is an overwritable file on future upgrade, these hacks are not advisale
2.5 please add a way we can debug the sql queries properly
--
Paulo Ferreira
Posted Feb 28, 2017 , edited Feb 28, 2017 Kool -