How to display SQL data in Wordpress? - sql

Does Wordpress has an ORM? How do you access data from an SQL server like MySQL and display it in Wordpress?

The best practice to interact with data in WordPress is using WordPress API, so you don't worry the compatible issue.
If you want to query the data by using SQL syntax, you can use wpdb.

Related

Best api for connecting to MS Sql server without creating additional tables to the database

I want to build a small api for an existing MS Sql server in my local network. I am not planning this api to do INSERT, UPDATE query on the sql server. Just a small SELECT query. Mostly for counting the rows in a table for a date range.
I don't want the api to create any default tables in the database either while setting up. Just to perform a select query on get request. The sql raw query is just fine for me.
Which APIs should I look for this purpose?
My intention is to get live production from the server and display those in mobile/desktop app.
Currently I have achieved this using pyodbc package in python and I can make a tkinter app out of it. But I want more advanced setup for a flutter app. So building an api is much better I suppose.

Using SQLServer to query elasticSearch data

In my use case, ElasticSearch is already configured and has data that can be queried via REST API. I'm wondering if there is a way to write SQL statements that can query this data that ElasticSearch is already configured on.
Example, configure an adapter to ElasticSearch in MS SQLServer and use linkedserver to connect and run normal SQL statements.
I have read about the "river", but it seems to do the opposite of what I'm looking for. Any pointers will really help.
SQL Server is a relational database. It operates with tables in common. Posting requests to some URI is very unusual work for SQL Server. And there is no standard mechanism to do this.
What can you do:
Write a CLR-function to send post-requests
Map result json to some table (it can be difficult, because Elastic Search is document-oriented and SQL Server is not)
So, as for me, this way is very complicated. I advice to use some hand-written service to operate with DB and Elastic Search, and don't try to put all logic to SQL Server.
Something like Elasticsearch-SQL plugin might be of interest to you.
This won't allow you to use it as a linked server in MSSQL, but it will allow whatever application you have, to send SQL queries to the sql API on your ElasticSearch server and get results.
Example:
http://localhost:9200/_sql?sql=select * from indexName limit 10

Switching Fusion Tables to SQL Server Google Maps

We have been working on some of the database in CSV format and putting them into Google Fusion Tables. But, now is it possible if we can SQL Server to get the data from the database and output a layer with markers to the user.
We want to avoid ASP.NET and C# if possible. We would prefer JS And PHP, but can't seem to find much help regarding the matter.
Does anyone have input on using SQL Server with Google Maps to plot points based on data in the DB?
I think what you could do is write a PHP file that queries SQL Server and returns a JSON array. You could then use JS to plot your map points.
Take a look at this blog post: SQL Server JSON to Table and Table to JSON.
It talks about SQL Server to JSON. They are using it with PowerShell, but one could use it as a starting point for PHP.

Running SQL Server queries against sqlite or plain files?

I have a website developed using a SQL Server database. But I need to port it to a new web server that doesn't have access to a database.
I therefore need an alternative solution, preferably without rewriting all the database queries. I would prefer being able to run the same queries against a sqlite file or just a plain textfile.
As far as storage goes it won't be storing large amounts of data, so performance won't be an issue.
Thanks for your time!,
Kind regards
Solved it by using Sql Server Compact Edition (see comments in OP).

Living document for replication of SQL Server Tables

I've been tasked to create an internal site for my company to document the replication of tables in our databases. I'd like to make the site dynamic, but to do this I'd need to query sql server to figure out how each table replicates. I know you can query sql server to figure out things like column names and many other features, can you query sql server to determine how a table replicates, and if so is there a good document to show me how or get me started? We're running sql server 2005 and c# or tsql are the preferred languages for me to use for this.
Try taking a look at the documentation for the syspublications and syssubscriptions system views in the Distribution database. Does that provide you with the information you need to build your site? If not, what else are you looking for? I've included links to the documentation for those views below.
syspublications
syssubscriptions