src/Data/Tools/BizDataObj_SQLHelper.php
public function buildInsertSQL($dataObj, $joinValues = null)
    {
        // generate column value pairs.
        $sqlFields = $dataObj->bizRecord->getToSaveFields('CREATE');

        $dbInfo = Openbizx::$app->getConfiguration()->getDatabaseInfo($dataObj->databaseAliasName);
        $dbType = $dbInfo["Driver"];

        $sql_col = "";
        $sql_val = "";
        $db = $dataObj->getDBConnection('WRITE');

        /* @var $field BizField */
        foreach ($sqlFields as $field) {
            $col = $field->column;

            // if Field Id has null value and Id is an identity type, remove the Id's column from the array
            if ($field->objectName == "Id" && $dataObj->idGeneration == "Identity") {
                continue;
            }

            if ($field->isLobField()) {  // special value for blob/clob type
                $_val = $field->getInsertLobValue($dbType);
            } else {
                $_val = $field->getSqlValue();
                if ($_val == '' && $field->valueOnCreate != "") {
                    $_val = $field->getValueOnCreate();
                }
            }

            //if (!$_val || $_val == '') continue;
            // modified by jixian for not ignore 0 value
            if ($_val === '') {
                continue;
            }
            $sql_col .= "`" . $col . "`, ";
            $sql_val .= $db->quote($_val) . ", ";
            //$sql_val .= QueryStringParam::formatQueryValue($_val). ", ";
        }

        // if joinValues is given then add join values in to the main table InsertSQL.
        if (is_array($joinValues)) {
            foreach ($joinValues as $joinColumn => $joinValue) {
                if (!$joinValue || $joinValue == '') {
                    continue;
                }
                $sql_col .= "`" . $joinColumn . "`, ";
                $sql_val .= "'" . $joinValue . "', ";
            }
        }

        $sql_col = substr($sql_col, 0, -2);
        $sql_val = substr($sql_val, 0, -2);

        $sql = "INSERT INTO  `" . $dataObj->mainTableName . "` (" . $sql_col . ") VALUES (" . $sql_val . ")";
        return $sql;
    }
public function buildInsertSQL($dataObj, $joinValues = null)
    {
        // generate column value pairs.
        $sqlFields = $dataObj->bizRecord->getToSaveFields('CREATE');

        $dbInfo = Openbizx::$app->getConfiguration()->getDatabaseInfo($dataObj->databaseAliasName);
        $dbType = $dbInfo["Driver"];

        $sql_col = "";
        $sql_val = "";
        $db = $dataObj->getDBConnection('WRITE');

        /* @var $field BizField */
        foreach ($sqlFields as $field) {
            $col = $field->column;

            // if Field Id has null value and Id is an identity type, remove the Id's column from the array
            if ($field->objectName == "Id" && $dataObj->idGeneration == "Identity") {
                continue;
            }

            if ($field->isLobField()) {  // special value for blob/clob type
                $_val = $field->getInsertLobValue($dbType);
            } else {
                $_val = $field->getSqlValue();
                if ($_val == '' && $field->valueOnCreate != "") {
                    $_val = $field->getValueOnCreate();
                }
            }

            //if (!$_val || $_val == '') continue;
            // modified by jixian for not ignore 0 value
            if ($_val === '') {
                continue;
            }
            $sql_col .= "`" . $col . "`, ";
            $sql_val .= $db->quote($_val) . ", ";
            //$sql_val .= QueryStringParam::formatQueryValue($_val). ", ";
        }

        // if joinValues is given then add join values in to the main table InsertSQL.
        if (is_array($joinValues)) {
            foreach ($joinValues as $joinColumn => $joinValue) {
                if (!$joinValue || $joinValue == '') {
                    continue;
                }
                $sql_col .= "`" . $joinColumn . "`, ";
                $sql_val .= "'" . $joinValue . "', ";
            }
        }

        $sql_col = substr($sql_col, 0, -2);
        $sql_val = substr($sql_val, 0, -2);

        $sql = "INSERT INTO  `" . $dataObj->mainTableName . "` (" . $sql_col . ") VALUES (" . $sql_val . ")";
        return $sql;
    }
Build insert-sql
INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)

@param BizDataObj $dataObj
@param array $joinValues array of join values
@return string Insert-SQL statement