Giter Club home page Giter Club logo

craft-connect's People

Contributors

andreibrindas avatar khalwat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

craft-connect's Issues

[FR] charset

Hi there,
absolute fan of your plugin. The only issue we are facing is with the encoding. It would be great if the charset could be defined in the connection. Now i have to convert it in Twig. For Example:

{%set overallComment = reviewVal.overallComment| raw | convert_encoding('UTF-8', 'ISO-8859-1')%}

Using in Craft Module

What is the best practice (code) of connecting via a module I built in Craft using PHP?

CraftCMS Connect Plug-in use with MSSQL Server

Hi,
I am trying to use connect plug to connect to Microsoft SQL Server DB which resides on a different server than my web server. After the setup when I am using open() to open the connection and then using the isActive method and it is returning 0. Looks like it is not connected to the DB as my SQL query is not returing the expected result as well.
Please guide me what I am doing wrong. Any help is higly appreciated. Below is my .env and config file setting.

.env file

putenv("REMOTE_DB_DRIVER=sqlsrv");
putenv("REMOTE_DB_SERVER=xxxx");
putenv("REMOTE_DB_USER=xxxx");
putenv("REMOTE_DB_PASSWORD=xxxx");
putenv("REMOTE_DB_DATABASE=xxxx");
putenv("REMOTE_DB_PORT=1433");

config file (general.php)

//sql server db
'remote' => [
'driver' => getenv('REMOTE_DB_DRIVER'),
'server' => getenv('REMOTE_DB_SERVER'),
'user' => getenv('REMOTE_DB_USER'),
'password' => getenv('REMOTE_DB_PASSWORD'),
'database' => getenv('REMOTE_DB_DATABASE'),
'port' => getenv('REMOTE_DB_PORT')
],

then in twig template:

{% set db = craft.connect.open('remote') %}
{% if isActive %}
hello active
{% else %}
not active
{% endif %}

MSSQL support?

Part of the docs says that Connect should be able to talk to any database that Yii2 has support for, and links to a page where Yii2 says it supports MSSQL.

However the only viable options that seem to be taken by the REMOTE_DB_DRIVER config are 'mysql' and 'pgsql', attempting to use 'mssql' leaves a "Driver not found" error:

Database Exception – yii\db\Exception
could not find driver
↵
Caused by: PDOException
could not find driver
in /home/ubuntu/sites/gllm/7_website/craft/vendor/yiisoft/yii2/db/Connection.php at line 712

I've tried spelunking into the code but can't find anything obvious. I have found an old issue on Stack Overflow where it was recommended to run composer require yiisoft/yii2-mssql but that is not an installable package anymore. Further, it seems as though it's been retired (attempting to find that on GitHub or Packagist forwards to a renamed Yii3 variant now) and that support ought to be built-in since Yii 2.1?

Working example of using createCommand with craft-connect?

Hi.
First, thanks for this great plugin! However I seem to be unable to actually use the createCommand function. I'm trying to do a simple INSERT INTO but can't get it to work.

The error i'm receiving is the following: "Call to a member function getQueryBuilder() on string"

{% set db = craft.connect.open('remote') %}
{% set sql = 'INSERT INTO tblContact_Management (city, email, lang, lastname) VALUES (citytest, mailtest, nl, De La Phantoma)' %}
{% set projectResults = craft.connect.query(db)
  .createCommand(sql)
%}

Here's my actual code for trying to insert something. I have no issues on retrieving data though.

Write do remote mysql

Is there a way to add option to send data to remote mysql ..
write directly to remote mysql .. as we allready use it to read data from. but need to send data too.. on button click

Craft-connect plugin documentation info missmatch

Describe the bug

On the plugin documentation repo, it says it's compatible with Craft CMS version 3.x.x, but when you go ahead and install the plugin, Craft CMS 4.x.x is required.

To reproduce

Steps to reproduce the behaviour:

  1. Have a Craft CMS install on 3.x.x
  2. Run the composer require install
  3. See the error

Expected behaviour

The docs should have different composer commands for the compatible Craft CMS versions

Versions

  • Plugin version: latest
  • Craft version: 3.x.x

Using where with comparands

First and foremost, great plugin! Works as expected and does what it's expected to do.
However I can't seem to figure out how to use operands in the while.

I've tried the following:
.where({'price':'250000'}) - works fine
.where({'price':'< 250000'}) - retrieves nothing
.where(['price' => '250000']) - returns error (found this somewhere in the readme.md)

Cant seem to find any solution in the yii files either.

EDIT: found it.

.where('price <= 250000') - the solution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.