|
|
| version 1.1, 2001/12/15 21:28:21 | version 1.11.2.8, 2003/01/31 12:34:35 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: sql driver manager implementation. | Parser: sql driver manager implementation. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| $Id$ | |
| */ | */ |
| static const char* IDENT_CHARSETS_C="$Date$"; | |
| #include "pa_charsets.h" | #include "pa_charsets.h" |
| #include "pa_charset.h" | #include "pa_value_includes.h" |
| // globals | // globals |
| Charsets *charsets; | Charsets charsets; |
| // | // methods |
| Charsets::Charsets(Pool& apool) : Hash(apool) { | Charsets::Charsets() { |
| put(UTF8_charset->name(), UTF8_charset); | |
| } | } |
| static void destroy_charset(const Hash::Key& key, Hash::Val *& value, void *) { | Charset& Charsets::get(StringPtr aname) { |
| static_cast<Charset *>(value)->~Charset(); | if(CharsetPtr result=Hash<key_type, value_type>::get(aname)) |
| return *result.get(); | |
| else | |
| throw Exception("parser.runtime", | |
| aname, | |
| "unknown charset"); | |
| } | } |
| Charsets::~Charsets() { | void Charsets::load_charset(StringPtr arequest_name, StringPtr arequest_file_spec) { |
| for_each(destroy_charset); | //we know that charset? |
| if(Hash<key_type, value_type>::get(arequest_name)) | |
| return; // don't load it then | |
| // make global_name string on cache_pool pool | |
| StringPtr global_name(new String(arequest_name->cstr(charsets_pool))); | |
| put(global_name, value_type(new Charset(global_name, arequest_file_spec))); | |
| } | } |