GVKun编程网logo

哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?

11

关于哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于centos7下源码编译安装php支持PostgreSQL

关于哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于centos 7下源码编译安装php支持PostgreSQL postgresql手册 postgresql官网下载 postgresql视频教、free pascal访问postgresql数据库、MySQL等同于PostgreSQL的EXPLAIN ANALYZE、playframework – Postgresql与Play框架等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?

哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?

我们拥有较早的经验,并且许多可重用的代码/组件大部分是使用Spring MVC,Hibernate,PostgreSQL数据库完成的。

但是最近我们计划开始一个新项目。我们决定在Scala中使用Play框架。我们是Scala的Play框架的新成员。因此,我们无法决定要使用哪种ORM(对象关系映射)框架。由于有许多可重用的代码,我们希望选择Hibernate。

我们发现关于Hibernate的可怕词汇是“
JPA在Scala中使用Hibernate玩游戏,这可能不是最好的方法,应该将其视为遗留和不推荐使用的”。我们真的很困惑使用什么?

在寻找可能性时,我们发现了Anorm和Hibernate。可能存在其他尚不知道的框架。

因此,请建议我们在Scala和PostgreSQL的Play框架中使用什么?

提前致谢!

答案1

小编典典

如果您确实需要ORM,那么JPA可能是您要走的路。这将迫使您拥有可变的域模型类等,但这也许是您愿意接受的折衷方案。(个人而言,我不会)

如果您愿意采用其他方式与数据库进行通讯,则有一些有趣的选择:

  • ANORM -关闭到SQL,但更好的方式比直接使用JDBC - https://playframework.com/documentation/2.3.7/ScalaAnorm
  • 圆滑 - “功能关系映射”,类型安全查询- http://slick.typesafe.com
  • 激活 -具有可插拔持久性后端的“软件事务存储”-http: //activate-framework.org

这是一篇比较不同库的不错的博客文章:http :
//manuel.bernhardt.io/2014/02/04/a-quick-tour-of-relational-database-access-
with-scala/

centos 7下源码编译安装php支持PostgreSQL postgresql手册 postgresql官网下载 postgresql视频教

centos 7下源码编译安装php支持PostgreSQL postgresql手册 postgresql官网下载 postgresql视频教

1. 下载源码

$ mkdir /usr/downloads
$ wget -c http://cn2.php.net/distributions/php-5.6.20.tar.gz
$ tar -xvf php-5.6.20.tar.gz
$ mv php-5.6.20 /usr/local/src
$ cd !$ & cd php-5.6.20
登录后复制

2. 阅读安装指导

$ ls -also
$ less README
$ less INSTALL
登录后复制

3. 安装依赖包

$ yum install apr apr-util apr-devel apr-util-devel prce lynx
登录后复制

4. 安装httpd

$ wget -c http://apache.fayea.com//httpd/httpd-2.4.20.tar.gz
$ tar -xvf httpd-2.4.20.tar.gz
$ cd httpd-2.4.20
$ ./configure \
--prefix=/usr/local/programs/apache2 \
--enable-rewrite \
--enable-so \
--enable-headers \
--enable-expires \
--with-mpm=worker \
--enable-modules=most \
--enable-deflate \
--enable-module=shared
$ make
$ make install
$ cd /usr/local/programs/apache2
$ cp bin/apachectl /etc/init.d/httpd ## 复制启动脚本
$ /etc/init.d/httpd start ## 启动apache服务器,访问http://localhost/
$ egrep -v ''^[ ]*#|^$'' /usr/local/apache2/conf/httpd.conf | nl ## 查看apache服务器的配置
## 将apache加入系统服务
vi /etc/rc.d/rc.local
```
/usr/local/programs/apache2/bin/apachectl start
```
$ cat /etc/rc.local
登录后复制

4. 安装postgresql

立即学习“PHP免费学习笔记(深入)”;

$ yum install readline-devel  ## 安装readline依赖
$ cd /usr/downloads
$ wget -c https://ftp.postgresql.org/pub/source/v9.5.0/postgresql-9.5.0.tar.bz2
$ tar -xvf postgresql-9.5.0.tar.bz2
$ cd postgresql-9.5.0
$ ./configure --prefix=/usr/local/programs/postgresql
$ make
$ su
$ make install
$ /sbin/ldconfig /usr/local/programs/postgresql/lib ## 刷新下共享动态库
$ cd /usr/local/programs/postgresql
$ bin/psql --version  ## 检查运行情况
## 开始对postgresql的配置
$ vi /etc/profile.d/postgresql.sh ## 增加环境变量,不推荐直接在/etc/profile中添加,系统更新升级时会需要merge
``` 
PATH=/usr/local/programs/postgresql:$PATH
export PATH
```
$ source /etc/profile ## 更新环境变量

## 增加用户和其他文件夹
$ adduser postgres
$ passwd postgres 
$ mkdir /usr/local/programs/postgresql/logs
$ mkdir /usr/local/programs/postgresql/data
$ chown postgres /usr/local/programs/postgresql/data
$ su - postgres

## 初始化数据库
$ ./bin/initdb -D ./data
$ ./bin/createdb test
$ ./bin/psql test
## 已有数据库,可导入data文件夹后尝试root访问,假如带密码,可能需要进一步研究下
$ ./bin/postgres -D ./data >./logs/start-log-1.log 2>&1 &
$ ./bin/psql --list  ##列出数据库
## ok,安装完成

## 自定义设置,权限控制等,可以跳过,等熟悉使用后再做
## 编辑数据库配置及权限文件:
$ vi /usr/local/programs/postgresql/data/postgresql.conf   ## 数据库配置文件
$ chown postgres postgresql.conf
$ chmod 644 postgresql.conf
$ vi /usr/local/programs/postgresql/data/pg_hba.conf   ## 权限文件
$ vi /usr/local/programs/postgresql/data/pg_ident.conf

## 设置开机自启动:
$ vi /etc/rc.d/rc.local    ## 添加如下内容
```
/usr/local/programs/postgresql/bin/postgresql start
```
登录后复制

5. 安装php

## 源码已经在第一步中下载,现在开始安装:
$ yum install libxml2 libxml2-devel libpng libpng-devel libjpeg libjpeg-devel freetype freetype-devel
$ ./configure \
--prefix=/usr/local/programs/php \
--with-apxs2=/usr/local/programs/apache2/bin/apxs \
--with-zlib \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-zlib-dir \
--enable-mbstring \
--with-pgsql=/usr/local/programs/postgresql \
--with-pdo-pgsql=/usr/local/programs/postgresql 
$ make
$ make test
> Bug #42718 (unsafe_raw filter not applied when configured as default filter) [ext/filter/tests/bug42718.phpt]  XFAIL REASON: FILTER_UNSAFE_RAW not applied when configured as default filter, even with flags
> Bug #67296 (filter_input doesn''t validate variables) [ext/filter/tests/bug49184.phpt]  XFAIL REASON: See Bug #49184
> Bug #53640 (XBM images require width to be multiple of 8) [ext/gd/tests/bug53640.phpt]  XFAIL REASON: Padding is not implemented yet
> zend multibyte (7) [ext/mbstring/tests/zend_multibyte-07.phpt]  XFAIL REASON: https://bugs.php.net/bug.php?id=66582
> zend multibyte (9) [ext/mbstring/tests/zend_multibyte-09.phpt]  XFAIL REASON: https://bugs.php.net/bug.php?id=66582
>Bug #70470 (Built-in server truncates headers spanning over TCP packets) [sapi/cli/tests/bug70470.phpt]  XFAIL REASON: bug is not fixed yet

## 查阅官方的bug,发现:
> id=66582: status : Closed. Fixed in master (PHP7)
> id=42718: status : Assigned
> id=42718: reference to id=49184, unsolved for many years
## 那就不关心了,直接装吧
$ make install
> You may want to add: /usr/local/programs/php/lib/php to your php.ini include_path

## 那就按它说的设置吧
$ cp php.ini-development /usr/local/programs/php/lib/php.ini
```
include_path = ".;/usr/local/programs/php/lib/php"

## 然后,编辑httpd的设置,确保其能正确解析php文件
```
...
LoadModule php5_module modules/libphp5.so
...
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .php5

...
<ifmodule dir_module>
    DirectoryIndex index.html index.php
</ifmodule>     
```

## 重启httpd,测试
$ cd /usr/local/programs/apache2
$ bin/httpd -h
$ bin/httpd -k stop
$ bin/httpd -f conf/httpd.conf
## 默认设置的www页面在./htdocs/下,那就先去里面建一个测试页面吧
$ vi htdocs/index.php
```
<?php phpinfo(); ?>
```
$ curl http://localhost/index.php |grep postgresql
#ok
登录后复制

后续应该做的事

* 1. 启动时,不需要要手动指定配置文件
* 2. php初始化www目录设置
* 3. php 用户、权限管理等

'').addClass(''pre-numbering'').hide(); $(this).addClass(''has-numbering'').parent().append($numbering); for (i = 1; i '').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了centos 7下源码编译安装php支持PostgreSQL,包括了postgresql,centos 7方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

free pascal访问postgresql数据库

free pascal访问postgresql数据库

根据fp自带例子修改

1、testpg1.pp

Program testpg;

{ Demo program to test pascal connection with postgres database }
{ Translated from the testlibpq example program of PostGreSQL   }

Uses postgres,strings;


Procedure exit_nicely(Conn : PPGconn);

begin
  PQfinish(conn);
  halt(1);
end;


Var
  pghost,pgport,pgoptions,pgtty,dbname : Pchar;
  nFields,i,j : longint;
  conn : PPGConn;
  res : PPGresult;

begin
  pghost := ''localhost'';        { host name of the backend server }
  pgport := ''5432'';        { port of the backend server }
  pgoptions := NiL;     { special options to start up the backend server }
  pgtty := NiL;         { debugging tty for the backend server }
  dbName := ''template1'';

  { make a connection to the database }
  conn := PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);

  { check to see that the backend connection was successfully made }
  if (PQstatus(conn) = CONNECTION_BAD) then
    begin
    Writeln (stderr, ''Connection to database '',dbname,'' failed.'');
    Writeln (stderr, PQerrorMessage(conn));
    exit_nicely(conn);
    end;


  { start a transaction block }
  res := PQexec(conn, ''BEGIN'');
  if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
    begin
    Writeln (stderr, ''BEGIN command failed'');
    PQclear(res);
    exit_nicely(conn);
    end;

  {
   * should PQclear PGresult whenever it is no longer needed to avoid
   * memory leaks
   }
  PQclear(res);

  {
   * fetch instances from the pg_database, the system catalog of
   * databases
   }
  res := PQexec(conn, ''DECLARE myportal CURSOR FOR select * from pg_database'');
  if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
    begin
    Writeln (stderr, ''DECLARE CURSOR command failed'');
    PQclear(res);
    exit_nicely(conn);
    end;
  PQclear(res);

  res := PQexec(conn, ''FETCH ALL in myportal'');
  if (PQresultStatus(res) <> PGRES_TUPLES_OK) then
    begin
    Writeln (stderr, ''FETCH ALL command didn''''t return tuples properly'');
    PQclear(res);
    exit_nicely(conn);
    end;

  { first, print out the attribute names }
  nFields := PQnfields(res);
  for i := 0 to nFields-1 do
    Write (PQfname(res, i),space (15-strlen(PQfname(res, i))) );
  writeln;
  writeln;

  { next, print out the instances }
  for i := 0 to PQntuples(res)-1 do
    begin
    for j := 0 to nFields-1 do
      write(PQgetvalue(res, i, j),space (15-strlen(PQgetvalue(res, i,j))));
    writeln;
    end;

  PQclear(res);

  { close the portal }
  res := PQexec(conn, ''CLOSE myportal'');
  PQclear(res);

  { end the transaction }
  res := PQexec(conn, ''END'');
  PQclear(res);

  { close the connection to the database and cleanup }
  PQfinish(conn);
end.

编译运行:

$ fpc testpg1.pp 
Free Pascal Compiler version 3.0.4 [2017/10/03] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling testpg1.pp
Linking testpg1
/usr/bin/ld: 警告: link.res 含有输出节;您忘记了 -T?
105 lines compiled, 0.1 sec
~/prg/mypas/psqlExample$ ./testpg1 
datname        datdba         encoding       datcollate     datctype       datistemplate  datallowconn   datconnlimit   datlastsysoid  datfrozenxid   datminmxid     dattablespace  datacl         

template1      10             6              zh_CN.UTF-8    zh_CN.UTF-8    t              t              -1             12410          656            1              1663           {=c/postgres,postgres=CTc/postgres}                                                                                                                                                                                                                                            
template0      10             6              zh_CN.UTF-8    zh_CN.UTF-8    t              f              -1             12410          656            1              1663           {=c/postgres,postgres=CTc/postgres}                                                                                                                                                                                                                                            
postgres       10             6              zh_CN.UTF-8    zh_CN.UTF-8    f              t              -1             12410          656            1              1663                          
mymotif        16393          6              zh_CN.UTF-8    zh_CN.UTF-8    f              t              -1             12410          656            1              16394                         
mydb           16393          6              zh_CN.UTF-8    zh_CN.UTF-8    f              t              -1             12410          656            1              16396                         
testdb         16393          6              zh_CN.UTF-8    zh_CN.UTF-8    f              t              -1             12410          656            1              16394                         
drupal8.2.1    16393          6              zh_CN.UTF-8    zh_CN.UTF-8    f              t              -1             12410          656            1              16473                         

二、testpg2.pp

Program testpg;

{ Demo program to test pascal connection with postgres database }
{ Translated from the testlibpq example program of PostGreSQL   }

Uses postgres,strings;


Procedure exit_nicely(Conn : PPGconn);

begin
  PQfinish(conn);
  halt(1);
end;


Var
  pghost,pgport,pgoptions,pgtty,dbname : Pchar;
  nFields,i : longint;
  conn : PPGConn;
  res : PPGresult;
  dummy : string;

begin
  pghost := ''localhost'';        { host name of the backend server }
  pgport := ''5432'';        { port of the backend server }
  pgoptions := NiL;     { special options to start up the backend server }
  pgtty := NiL;         { debugging tty for the backend server }
  if paramcount=1 then
    begin
    dummy:=paramstr(1)+#0;
    dbname:=@dummy[1];
    end
  else
    dbName := ''testdb'';

  { make a connection to the database }
  conn := PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);

  { check to see that the backend connection was successfully made }
  if (PQstatus(conn) = CONNECTION_BAD) then
    begin
    Writeln (stderr, ''Connection to database '',dbname,'' failed.'');
    Writeln (stderr, PQerrorMessage(conn));
    exit_nicely(conn);
    end;

  res := PQexec(conn, ''select * from userdeatail'');
  if (PQresultStatus(res) <> PGRES_TUPLES_OK) then
    begin
    Writeln (stderr, ''select command failed.'');
    PQclear(res);
    exit_nicely(conn);
    end;


  { first, print out the attribute names }
  nFields := PQnfields(res);
  Write (''|'',PQfname(res, 0),space (4-strlen(PQfname(res, 0))) );
  Write (''|'',PQfname(res, 1),space (20-strlen(PQfname(res, 1))) );
  Write (''|'',PQfname(res, 2),space (40-strlen(PQfname(res, 2))) );
  writeln (''|'');
  writeln (''+----+--------------------+----------------------------------------+'');

  { next, print out the instances }
  for i := 0 to PQntuples(res)-1 do
    begin
    write(''|'',PQgetvalue(res, i, 0),space (4-strlen(PQgetvalue(res, i,0))));
    write(''|'',PQgetvalue(res, i, 1),space (20-strlen(PQgetvalue(res, i,1))));
    write(''|'',PQgetvalue(res, i, 2),space (40-strlen(PQgetvalue(res, i,2))));
    writeln (''|'');
    end;

  PQclear(res);

  { close the connection to the database and cleanup }
  PQfinish(conn);
end.

testdb库中表:

CREATE TABLE userdeatail
(
  uid integer,
  intro character varying(30),
  profile character varying(30)
);

编译运行:

$ fpc testpg2.pp 
Free Pascal Compiler version 3.0.4 [2017/10/03] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling testpg2.pp
testpg2.pp(19,3) Note: Local variable "nFields" is assigned but never used
Linking testpg2
/usr/bin/ld: 警告: link.res 含有输出节;您忘记了 -T?
78 lines compiled, 0.1 sec
1 note(s) issued
$ ./testpg2 
|uid |intro               |profile                                 |
+----+--------------------+----------------------------------------+
|11  |wxw                 |pppp                                    |

三、一些出错的处理:
(1)编译连接时找不到-lpq库:
$ fpc testpg1.pp
/usr/bin/ld: 找不到 -lpq
testpg1.pp(107,1) Error: Error while linking
testpg1.pp(107,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
改为:
 $ fpc testpg1.pp -Fl/opt/PostgreSQL/10/lib(/opt/PostgreSQL/10为PostgreSQL实际安装的路径)
或在Makefile中处理:
追加环境变量:export PGLIBDIR=/opt/PostgreSQL/10/lib
在Makefile中增加下面内容:
ifdef PGLIBDIR
override FPCOPT+=$(addprefix -Fl,$(PGLIBDIR))
endif

(2)、出现Unix domain socket连接错误:
$ ./testpg1 
Connection to database template1 failed.
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
有两种处理方法:
1、指定pg Unix domain socket的位置
在.bashrc中设置环境变量$PGHOST:export PGHOST=/tmp
2、改用tcp/ip连接方式:
 即pghost := NiL; 改为  pghost := ''localhost''; {或pghost := ''127.0.0.1''}

(3)、出现用户名密码错误
$ ./testpg1
Connection to database template1 failed.
fe_sendauth: no password supplied
处理方法:PQsetdb,改为PQsetdbLogin
即:conn=PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
改为:conn=PQsetdbLogin(pghost,pgport,pgoptions,pgtty,dbname,user,pwd)

修改后代码testpg1.pp

Program testpg;

{ Demo program to test pascal connection with postgres database }
{ Translated from the testlibpq example program of PostGreSQL   }

Uses postgres,strings;


Procedure exit_nicely(Conn : PPGconn);

begin
  PQfinish(conn);
  halt(1);
end;


Var
  pghost,pgport,pgoptions,pgtty,dbname,myuser,passwd : Pchar;
  nFields,i,j : longint;
  conn : PPGConn;
  res : PPGresult;

begin
  pghost := ''localhost'';        { host name of the backend server }
  pgport := NiL;        { port of the backend server }
  pgoptions := NiL;     { special options to start up the backend server }
  pgtty := NiL;         { debugging tty for the backend server }
  dbName := ''template1'';
  myuser:=''postgres'';
  passwd:=''wxwpxh'';
  { make a connection to the database }
  {conn := PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);}
  conn := PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName,myuser,passwd);

  { check to see that the backend connection was successfully made }
  if (PQstatus(conn) = CONNECTION_BAD) then
    begin
    Writeln (stderr, ''Connection to database '',dbname,'' failed.'');
    Writeln (stderr, PQerrorMessage(conn));
    exit_nicely(conn);
    end;


  { start a transaction block }
  res := PQexec(conn, ''BEGIN'');
  if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
    begin
    Writeln (stderr, ''BEGIN command failed'');
    PQclear(res);
    exit_nicely(conn);
    end;

  {
   * should PQclear PGresult whenever it is no longer needed to avoid
   * memory leaks
   }
  PQclear(res);

  {
   * fetch instances from the pg_database, the system catalog of
   * databases
   }
  res := PQexec(conn, ''DECLARE myportal CURSOR FOR select * from pg_database'');
  if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
    begin
    Writeln (stderr, ''DECLARE CURSOR command failed'');
    PQclear(res);
    exit_nicely(conn);
    end;
  PQclear(res);

  res := PQexec(conn, ''FETCH ALL in myportal'');
  if (PQresultStatus(res) <> PGRES_TUPLES_OK) then
    begin
    Writeln (stderr, ''FETCH ALL command didn''''t return tuples properly'');
    PQclear(res);
    exit_nicely(conn);
    end;

  { first, print out the attribute names }
  nFields := PQnfields(res);
  for i := 0 to nFields-1 do
    Write (PQfname(res, i),space (15-strlen(PQfname(res, i))) );
  writeln;
  writeln;

  { next, print out the instances }
  for i := 0 to PQntuples(res)-1 do
    begin
    for j := 0 to nFields-1 do
      write(PQgetvalue(res, i, j),space (15-strlen(PQgetvalue(res, i,j))));
    writeln;
    end;

  PQclear(res);

  { close the portal }
  res := PQexec(conn, ''CLOSE myportal'');
  PQclear(res);

  { end the transaction }
  res := PQexec(conn, ''END'');
  PQclear(res);

  { close the connection to the database and cleanup }
  PQfinish(conn);
end.

修改后testpg2.pp代码:

Program testpg;

{ Demo program to test pascal connection with postgres database }
{ Translated from the testlibpq example program of PostGreSQL   }

Uses postgres,strings;


Procedure exit_nicely(Conn : PPGconn);

begin
  PQfinish(conn);
  halt(1);
end;


Var
  pghost,pgport,pgoptions,pgtty,dbname,myuser,passwd : Pchar;
  nFields,i : longint;
  conn : PPGConn;
  res : PPGresult;
  dummy : string;

begin
  pghost := ''localhost'';        { host name of the backend server }
  pgport := ''5432'';        { port of the backend server }
  pgoptions := NiL;     { special options to start up the backend server }
  pgtty := NiL;         { debugging tty for the backend server }
  myuser:=''mymotif'';
  passwd:=''wxwpxh'';

  if paramcount=1 then
    begin
    dummy:=paramstr(1)+#0;
    dbname:=@dummy[1];
    end
  else
    dbName := ''testdb'';


  { make a connection to the database }
  {conn := PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);}
  conn := PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName,myuser,passwd);

  { check to see that the backend connection was successfully made }
  if (PQstatus(conn) = CONNECTION_BAD) then
    begin
    Writeln (stderr, ''Connection to database '',dbname,'' failed.'');
    Writeln (stderr, PQerrorMessage(conn));
    exit_nicely(conn);
    end;

  res := PQexec(conn, ''select * from userdeatail'');
  if (PQresultStatus(res) <> PGRES_TUPLES_OK) then
    begin
    Writeln (stderr, ''select command failed.'');
    PQclear(res);
    exit_nicely(conn);
    end;


  { first, print out the attribute names }
  nFields := PQnfields(res);
  Write (''|'',PQfname(res, 0),space (4-strlen(PQfname(res, 0))) );
  Write (''|'',PQfname(res, 1),space (20-strlen(PQfname(res, 1))) );
  Write (''|'',PQfname(res, 2),space (40-strlen(PQfname(res, 2))) );
  writeln (''|'');
  writeln (''+----+--------------------+----------------------------------------+'');

  { next, print out the instances }
  for i := 0 to PQntuples(res)-1 do
    begin
    write(''|'',PQgetvalue(res, i, 0),space (4-strlen(PQgetvalue(res, i,0))));
    write(''|'',PQgetvalue(res, i, 1),space (20-strlen(PQgetvalue(res, i,1))));
    write(''|'',PQgetvalue(res, i, 2),space (40-strlen(PQgetvalue(res, i,2))));
    writeln (''|'');
    end;

  PQclear(res);

  { close the connection to the database and cleanup }
  PQfinish(conn);
end.

 

MySQL等同于PostgreSQL的EXPLAIN ANALYZE

MySQL等同于PostgreSQL的EXPLAIN ANALYZE

我想在MySQL中获得类似于PostgreSQL中EXPLAIN ANALYZE所示的详细查询计划。有等同的吗?

答案1

小编典典

编辑:虽然不是直接等效项,也不像解释分析那样详细,但是您可以查看一些工具

mysql提供EXPLAIN和过程analyse()
http://dev.mysql.com/doc/refman/5.0/en/explain.htmlhttp://dev.mysql.com/doc/refman/5.0/en/procedure-analyse
.html

playframework – Postgresql与Play框架

playframework – Postgresql与Play框架

我试图使用 Postgresql与玩他们的Yabe教程,并得到这个错误:

无法连接到数据库,驱动程序未找到(org.postgresql.Driver)

这是我的连接字符串:

# If you need a full JDBC configuration use the following :
 db.url=jdbc:postgresql:yabe
 db.driver=org.postgresql.Driver  
 db.user=yabe
 db.pass=yabe
#
# Connections pool configuration :
 db.pool.timeout=1000
 db.pool.maxSize=30
 db.pool.minSize=1

在我的lib文件夹我有这个:
Postgresql相关9.1-901.jdbc3.jar

我尝试将驱动程序名称改为相同的名称是tha jar但仍然得到相同的错误.有任何想法吗?

Play框架已经包含Postgres的驱动程序.请执行以下操作:

>从dependencies.yml文件中删除对postgresql驱动程序的任何引用
做一个“play deps –sync”
>删除lib /文件夹中与postgresql驱动程序相关的任何jar
>将您的连接字符串更改为:

分贝= postgres的://用户:PWD @本地:5432 /矢部

这应该可以解决你的冲突.

我们今天的关于哪些最佳数据访问选项可用于带有Scala和PostgreSQL的Play框架?的分享就到这里,谢谢您的阅读,如果想了解更多关于centos 7下源码编译安装php支持PostgreSQL postgresql手册 postgresql官网下载 postgresql视频教、free pascal访问postgresql数据库、MySQL等同于PostgreSQL的EXPLAIN ANALYZE、playframework – Postgresql与Play框架的相关信息,可以在本站进行搜索。

本文标签: