Merge pull request #339 from sabracrolleton/master
[postmodern.git] / cl-postgres / strings-utf-8.lisp
blobbc64ece64e1feed5d248d0c38db518afb9f60194
1 ;;;; -*- Mode: LISP; Syntax: Ansi-Common-Lisp; Base: 10; Package: CL-POSTGRES; -*-
2 (in-package :cl-postgres)
4 (defparameter *client-encoding* "UNICODE")
6 (declaim (inline enc-byte-length))
7 (defun enc-byte-length (sequence)
8 (cl-postgres-trivial-utf-8:utf-8-byte-length sequence))
10 (declaim (inline enc-write-string))
11 (defun enc-write-string (string output &key null-terminate)
12 (cl-postgres-trivial-utf-8:write-utf-8-bytes string output
13 :null-terminate null-terminate))
15 (declaim (inline enc-read-string))
16 (declaim (ftype (function (t &key (:null-terminated t)
17 (:byte-length fixnum))
18 string)
19 enc-read-string))
20 (defun enc-read-string (input &key null-terminated (byte-length -1))
21 (cl-postgres-trivial-utf-8:read-utf-8-string
22 input :null-terminated null-terminated :stop-at-eof t :byte-length byte-length))
24 (declaim (inline enc-string-bytes))
25 (defun enc-string-bytes (string &key null-terminate)
26 (cl-postgres-trivial-utf-8:string-to-utf-8-bytes
27 string :null-terminate null-terminate))