#######################################################################
SQL: CREATE TABLE test(id serial NOT NULL,bt bytea);
#######################################################################
#include "stdafx.h"
#include "stdlib.h"
#include "stdio.h"
#include <libpq-fe.h>
#include <string>
PGconn *pgConnection;
#pragma comment(lib, "libpq.lib")
#pragma comment(lib, "geogisf.lib")
int main(int argc, char* argv[])
{
char szConnectionString[_MAX_PATH];
const char* szServer = "10.0.0.134";
int iPort = 5432;
const char* szDatabase = "test";
const char* szUser = "postgres";
const char* szPassword = "postgres";
sprintf(szConnectionString, "hostaddr=%s port=%d dbname=%s user=%s password=%s",
szServer, iPort, szDatabase, szUser, szPassword);
pgConnection = PQconnectdb(szConnectionString);
char* strtext = "delivers the latest breaking news and information on the latest top";
size_t to_length;
unsigned char* bytea = PQescapeByteaConn(pgConnection,
(unsigned char*)strtext,
strlen(strtext),
&to_length);
std::string strsql;
strsql = "insert into test (bt) values ('";
strsql += (char*)bytea;
strsql += "')";
PGresult* pgResult = PQexec(pgConnection, strsql.c_str());
int status = PQresultStatus(pgResult);
if(status!=PGRES_COMMAND_OK)
{
printf("insert error");
}
PQclear(pgResult);
PQfinish(pgConnection);
return 0;
}
分享到:
相关推荐
odoo 数据类型这建立在基础上,以创建一组我们将用于从 Postgres 插入和检索数据的数据类型。使用图像该图像与预先设置的 Postgres 图像一起在 docker 注册表中可用: docker pull snapforbeginners/odoo-datatypes:...
postgres数据库odbc数据源 用于odbc连接postgres数据库
本资源使用python进行编写,解压后在pycharm中进行使用,该探查数据库适用于postgres数据库,运行结束后以.xlsx格式进行保存,探查的内容有:数据库名称、数据表名称、数据表注释、排序、字段名称、字段注释、字段...
lz4:接收bytea类型的数据,返回压缩后的bytea类型数据 un_lz4:接收bytea类型的数据,返回解压后的bytea类型数据 lz4_utf8:接收utf8编码的文本数据,返回解压后的bytea类型数据 un_lz4_utf8:接收bytea类型的数据...
Postgres-XZ的数据治理经验分享.pdf
使用Jmeter往PostgreSQL大象数据库中插入测试数据; GUID的自动生成,大象数据库的链接配置
将postgres 表结构和数据转换到sqllite数据库中的工具类源码,基于springboot 的小型java项目
导入osm数据到postgres数据库工具
Linux下postgres安装说明
SQL必知必会PostgresSQL数据导入脚本 SQL必知必会PostgresSQL数据导入脚本 SQL必知必会PostgresSQL数据导入脚本
PostgresSQL是一个很优秀的开源数据库,并提供了针对空间数据的存扩展;这个PPT介绍了PostgresSQL数据库的基本情况
See how creating an advanced Postgres index for a case-insensitive search speeds up your back end - enabling you to create a dynamic user experience using Angular 2. Create reusable components that ...
请在浏览器中访问以下网址: http://localhost:5000所有配置设置位于: app/configuration.py 该站点当前也已部署并托管在Heroku上,并且正在使用ElephantSQL Cloud Postgres数据库来保存所有电影数据
该资源包的执行效果查看地址:...“地图之家”专栏中的“2.(高级示例篇)leaflet+postgres+postgis+geoserver实现高性能聚合图(亿级别数据量)”。如下载有问题,可联系博主。 解压密码:leaflet
上亿数据的select怎么整?不仅仅是分页的问题。请看附件方案
postgres中文文档!
用于在postgres定义主键的函数,如更改id update table set id=get_uuid()
PostgresSQL的简明教程,里面包含了使用方法
将postgres数据导入到sqlite;支持自动创建sqlite表,支持全库导入和指定表导入。
postgressql 连接数据库 和关闭数据库