Thursday, January 31, 2008

Array support in the works!

Hi all,

Jon Hanna is working to add Array support to Npgsql. He already sent a patch which I applied to my working copy and it is working very well!

Now it is possible to write code like that:

NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;User id=npgsql_tests;password=npgsql_tests;");

conn.Open();


NpgsqlCommand d = new NpgsqlCommand();

Int32[] a = new Int32[2];

a[0] = 4;
a[1] = 2;

NpgsqlCommand command = new NpgsqlCommand("select :arrayParam", conn);

command.Parameters.Add(new NpgsqlParameter("arrayParam", a));
Console.WriteLine(command.ExecuteScalar());

conn.Close();

And get this logged on server:

LOG: statement: select array['4','2']::int4[]

Also, Npgsql is able to receive an array from server as the example above shows. Npgsql will print to console:

System.Int32[]

Which shows it received an int32 array as expected!

Excellent work, Jon!

28 comments:

Jon Hanna said...

Thanks for the kind words on the patch.

One thing worth adding is that since .NET2.0 has several different types of typed collection as well as arrays these can be used too:

Anything that implements IEnumerable<T> where T is a type already supported by npgsql will be treated the same as T[], anything that implements IEnumerable<U> where U implements IEnumerable<T> will be treated the same as T[,] (but cause an error if it's a "jagged" array, as postgres doesn't support them) and so on.

So, List<int> will be treated as a Postgres int4[], ICollection<List<string>> as a two-dimensional text[] and so on.

However, we look for direct support first, so string is still treated as string rather than as IEnumerable<char>, unless you explicitly ask for that.

Michael Parshin did a good job at catching a couple of edge cases in my previous attempt here.

Anonymous said...

In order to play the Cabal, I already forget I spend how much money to buy the cabal alz, in my memory, every time to buy cabal alz, I always want to search sell the cheap cabal alz website, but every time I always failed, so if has someone know the cheapest cabal gold, I hope can told me.

bobo said...

This is the latest and hottest ghd styler ever. If you need a ghd hair straighteners, this is a must buyghd hair straighteners,cheap ghd hair straighteners,pink ghd hair straightenersghd straightenersComme vous pouvez le voir, il s'agit d'une paire de chaussures shox classiquepink ghd hair straighteners . Si vous souhaitez poursuivre la mode, nike shox NZ sont votre meilleu…"Cette paire de Nike Shox Torch est chaud en maintenant la demande.nike chaussurestn chaussures

kiloi said...

cheap polos
polo shirts
ralph lauren polo shirtssport shoes
ugg boots
puma shoes
chaussures pumamp4
trade chinalacoste polo shirts
chaussure puma femmewedding dressestennis racket
cheap handbags

kiloi said...

HAIR STRAIGHTENERS
ED HARDY SHIRTS
HAIR STRAIGHTENERS
MENSCLOTHING mans clothing
cheap ugg boots
converse shoes
wedding dresses
wholesale polo shirts
brand clothingcheap clothing
clothes sportspolos shirtair shoesair shoesed hardy clothinged hardy clothing
英文推广

shen bing said...

cheap hair straightenerscheap flat ironnew polo shirtssexy lingerie storepolo shirtsnorth face jacketschi straightenerpink chichaussures puma chaussure puma

shen bing said...

hair straightenersugg bootscheap handbagscheap bagscheap pursetntattoo wholesalejackets worldjackets cartmen's clothingwomen's clothing

shen bing said...

handbags Louis Vuitton Vuitton handbags Balenciaga Balenciaga Bally handbagsBottega Veneta handbagsCartier handbagsChanel handbagsChloe handbagsChristian Dior handbagsCoach handbagsDolce Gabanna handbags

shen bing said...

Fendi handbags Givenchy handbags Gucci handbags Hermes handbags Jimmy Choo handbags Juicy Couture handbags lsabella Fiore handbags Miu Miu handbags Mulberry handbags Prada handbags Tods handbags Versace handbags Yves Saint Laurent handbags

shen bing said...

Men's Lacoste Polo Shirts Men's RL Striped Polo Shirts Women's Lacoste Polo Shirts Men's polo shirts Men's polo shirts Men's polo shirts 4 polo shirts Women's polo shirts 21 polo shirts Men's polo shirts Women's LACOSTE 5 PCS of Ralph Women's lacoste polo shirts

Anonymous said...

出会い喫茶出会いカフェテレクラ不倫セックスフレンドセフレ出会い出会い出会い掲示板出会い出会い出会い人妻風俗デリヘルデリバリーヘルス出会い出会い無料フィリピンライブチャットアダルトライブチャットデリヘル

Anonymous said...

不動産ソープランドアクセスカウンターコレステロール中性脂肪花粉症在宅ワーク内職在宅アルバイト乾燥肌ダイエット 食事サプリメント無料占い出会い山口クレジットカード現金化クレジット現金化ライブチャットフィリピンチャットレディパソコン在宅ワーク

Anonymous said...

出会い豊島区出会い北区出会い荒川区出会い板橋区出会い練馬区出会い足立区出会い葛飾区出会い江戸川区ニキビCholesterol水虫冷え性むくみ産後わきが車買取転職加齢臭

Anonymous said...

出会い愛知出会い秋田出会い青森出会い千葉出会い愛媛出会い福井出会い福岡出会い福島出会い岐阜出会い群馬出会い広島出会い北海道出会い兵庫出会い茨城出会い石川出会い岩手出会い香川出会い鹿児島出会い神奈川出会い高知

Anonymous said...

出会い熊本出会い京都出会い三重出会い宮城出会い宮崎出会い長野出会い長崎出会い奈良出会い新潟出会い大分出会い岡山出会い沖縄出会い大阪出会い佐賀出会い埼玉出会い滋賀出会い島根出会い静岡出会い栃木出会い徳島

Anonymous said...

出会い東京出会い鳥取出会い富山出会い和歌山出会い山形出会い山口出会い山梨出会い北九州出会い下関出会い川崎出会い神戸出会い久留米出会い水戸出会い名古屋出会い大牟田出会い埼玉出会い堺出会い仙台出会い横浜出会い横須賀出会い札幌出会い川崎

Anonymous said...

出会い堺出会い仙台出会い横浜出会い横須賀出会い札幌出会い千代田区出会い中央区出会い港区出会い新宿区出会い文京区出会い台東区出会い墨田区出会い江東区出会い品川区出会い目黒区出会い大田区出会い世田谷区出会い渋谷区出会い中野区出会い杉並区

Anonymous said...

福井出会い愛知出会い岐阜出会い静岡出会い三重出会い兵庫出会い大阪出会い和歌山出会い滋賀出会い京都出会い奈良出会い山口出会い鳥取出会い島根出会い岡山出会い広島出会い徳島出会い香川出会い愛媛出会い高知出会い

Anonymous said...

出会い札幌出会い函館出会い北海道出会い秋田出会い青森出会い岩手出会い東京出会い八王子出会い府中出会い調布出会い銀座出会い仙台出会い優良出会いサイトアダルト盗撮素人熟女エロアニメAV女優

Anonymous said...

出会い愛知出会い秋田出会い青森出会い千葉出会い愛媛出会い福井出会い福岡出会い福島出会い岐阜出会い群馬出会い広島出会い北海道出会い兵庫出会い茨城出会い石川出会い岩手出会い香川出会い鹿児島出会い神奈川出会い高知

Anonymous said...

出会い熊本出会い京都出会い三重出会い宮城出会い宮崎出会い長野出会い長崎出会い奈良出会い新潟出会い大分出会い岡山出会い沖縄出会い大阪出会い佐賀出会い埼玉出会い滋賀出会い島根出会い静岡出会い栃木出会い徳島

Anonymous said...

福井出会いカフェ愛知出会いカフェ岐阜出会いカフェ静岡出会いカフェ三重出会いカフェ兵庫出会いカフェ大阪出会いカフェ和歌山出会いカフェ滋賀出会いカフェ京都出会いカフェ奈良出会いカフェ山口出会いカフェ鳥取出会いカフェ島根出会いカフェ岡山出会いカフェ広島出会いカフェ徳島出会いカフェ香川出会いカフェ愛媛出会いカフェ高知出会いカフェ

Anonymous said...

出会い東京出会い大阪出会い福岡出会い兵庫出会い神奈川出会い宮城出会い千葉出会い愛知出会い埼玉出会い青森出会い岩手出会い秋田出会い山形出会い山口出会い東京出会い鳥取出会い富山出会い和歌山出会い山形

Anonymous said...

出会い奈良出会い滋賀出会い三重出会い和歌山出会い愛知出会い静岡出会い岐阜出会い広島出会い岡山出会い山口出会い島根出会い鳥取出会い富山出会い石川出会い福井出会い徳島出会い香川出会い愛媛出会い高知出会い福岡

Anonymous said...

セフレ奈良セフレ滋賀セフレ三重セフレ和歌山セフレ愛知セフレ静岡セフレ岐阜セフレ広島セフレ岡山セフレ山口セフレ島根セフレ鳥取セフレ富山セフレ石川セフレ福井セフレ徳島セフレ香川セフレ愛媛セフレ高知セフレ福岡

Anonymous said...

福井テレクラ愛知テレクラ岐阜テレクラ静岡テレクラ三重テレクラ兵庫テレクラ大阪テレクラ和歌山テレクラ滋賀テレクラ京都テレクラ奈良テレクラ山口テレクラ鳥取テレクラ島根テレクラ岡山テレクラ広島テレクラ徳島テレクラ香川テレクラ愛媛テレクラ高知テレクラ

Anonymous said...

福井セフレ愛知セフレ岐阜セフレ静岡セフレ三重セフレ兵庫セフレ大阪セフレ和歌山セフレ滋賀セフレ京都セフレ奈良セフレ山口セフレ鳥取セフレ島根セフレ岡山セフレ広島セフレ徳島セフレ香川セフレ愛媛セフレ高知セフレ

Gigi said...

$75 Replica Rolex Watches sale, Our site provides Rolex replica, replica Rolex Watches, replica breitling, replica Cartier, replica Omega, Tag Heuer Watches. . .more than 100 famous rolex brands"
rolex air king
rolex datejust
rolex day date
rolex daytona
rolex gmt
rolex submariner
rolex yachtmaster
a lange sohne watches
alain silberstein watches
bell ross watches
breguet watches
breitling watches
bvlgari watches
cartier watches
omega watches
patek philippe watches
ロレックスレプリカ
ロレックスコピー