473,809 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parsing binary varchar[]-s

Hi,

I use binary mode for sending params and receiving data using libpq with
protocol v3; PostgreSQL version is 7.4.3.
Here, varchar[]-s are returned in binary mode; they're generated from internal
structs by "array_send " function in src/backend/utils/adt/arrayfuncs.c.
PQftype(..) returns 1015 for those columns. I couldn't find any #define for
this OID -- does this mean it can change in future pg releases ? Also, can I
safely use the binary format as described (by the code) in "array_send " ? Is
this interface is frozen, as a part of protocol v3 spec ?

--
Best Regards,
Igor Shevchenko

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
1 1576
Igor Shevchenko <ig**@carcass.a th.cx> writes:
I use binary mode for sending params and receiving data using libpq with
protocol v3; PostgreSQL version is 7.4.3.
Here, varchar[]-s are returned in binary mode; they're generated from internal
structs by "array_send " function in src/backend/utils/adt/arrayfuncs.c.
PQftype(..) returns 1015 for those columns. I couldn't find any #define for
this OID -- does this mean it can change in future pg releases ?
It's "_varchar" in pg_type.h, and no the OID is not likely to change.
(Any OID under 10000 is manually assigned and we would have to go out
of our way to change it.)
Also, can I safely use the binary format as described (by the code) in
"array_send " ? Is this interface is frozen, as a part of protocol v3
spec ?


Yes, the intention is that those formats are frozen. We haven't gotten
around to collecting the information in a document, so you have to look
at the code, but it's supposed to not change.

At least up to a point ;-). Sooner or later we are going to want to
support null elements within arrays, and that will surely impact the
internal format as well as the transmitted format. My guess is that
arrays that do not contain any nulls will look the same as now, but
if there are nulls then a bit will be set in the flags word and we'll
insert a null bitmap someplace. So I'd strongly recommend checking the
flags word and punting if it contains a value you do not recognize.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
5742
by: AK | last post by:
Once upon a time there was a table: CREATE TABLE VENDOR(VENDOR_ID INT, NAME VARCHAR(50), STATE CHAR(2))@ in a while the developers realized that a vendor may be present in xseveral states, so the structure was changed to CREATE TABLE VENDOR(VENDOR_ID INT, NAME VARCHAR(50), STATE_LIST VARCHAR(150))@
4
9906
by: Hazzard | last post by:
What is the best way to do this? Binary with 0 representing off and 1 on? Int16 with 1 representing first button, 2 the second, 3 ... varchar with a character values at certain positions in the string representing radio button values. Thanks, -hazz
0
1584
by: earsypaul | last post by:
Hello, With MS SQL server we can bcp hexadecimal data into varbinary columns quite nicely. We're migrating some data to DB2 and trying to import to a "varchar for bit data" data type column. With delimited data it looks like importing binary data is not an option as the binary data might have LFs, CRs etc and the import tool will get confused as to where the columns and rows begin or end. The DELPRIORITYCHAR modifier does not appear to...
3
17399
by: Cuong.Tong | last post by:
Greeting, I am writing my own web server and having some problme parsing the the mulitpart/form-data stream that is sent from the browsers. I have a form looks something like this <form action="process.dll>
10
1558
by: nicenjguy | last post by:
This is my problem Table 1 is a list of reports that have the following columns Report ID, Report Name, Groups Allowed, Roles Allowed 1 Report 1 Clerk, Mgr User, PowerUser Table 2 is a list of users UserID, User Name, Group, Role
5
12939
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I am having a problem converting string to binary and I am hoping someone can help me out I have a sql query that does an update that updates a binary field calles password password=CAST(@password as binary) However when I go to sql server and convert that binary field to varchar, all I get is the first letter of the password that I typed in. How do I
12
6021
radcaesar
by: radcaesar | last post by:
Hi, I am reading a xml file using T-SQL. I want the xml data to use in openxml. So i was using cursor here. Here i am concatenating the xml data into a variable called @FileContents. When i print this variable content inside the WHILE FetchStatus of CURSOR, its printing fine. If i print after the cursor execution s over, it doen't shows anything and its blank. Where am i missing ? DECLARE @FileName varchar(255) DECLARE @ExecCmd...
31
2524
by: broli | last post by:
I need to parse a file which has about 2000 lines and I'm getting told that reading the file in ascii would be a slower way to do it and so i need to resort to binary by reading it in large chunks. Can any one please explain what is all this about ?
17
2573
by: anojjona | last post by:
Hi, I need to figure out what some code that was maliciously executed against a database does. However, it's in a very strange format. It simply declares a variable and sets it equal to a huge binary thing (seems to be some sort of compiled code) cast as nvarchar. It then executes this variable. Is there any way to decipher or decompile this code? Does anyone have information either on what SQL Server does when it's asked to execute...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.